Commit c747ef79 by fudahua

绑定的时候 新增小程序配置

parent ab4989c9
package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 欢迎语配置表
*
* @author fdh
*/
public class WelcomeDTO implements Serializable {
/**
*
*/
private String welcomeId;
/**
*
*/
private String wxEnterpriseId;
/**
*
*/
private String title;
/**
* 内容
*/
private String welcomeContent;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_welcome.welcome_id
*
* @return the value of tab_haoban_welcome.welcome_id
*/
public String getWelcomeId() {
return welcomeId;
}
/**
* This method sets the value of the database column tab_haoban_welcome.welcome_id
*
* @param welcomeId the value for tab_haoban_welcome.welcome_id
*/
public void setWelcomeId(String welcomeId) {
this.welcomeId = welcomeId;
}
/**
* This method returns the value of the database column tab_haoban_welcome.wx_enterprise_id
*
* @return the value of tab_haoban_welcome.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_welcome.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_welcome.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_welcome.title
*
* @return the value of tab_haoban_welcome.title
*/
public String getTitle() {
return title;
}
/**
* This method sets the value of the database column tab_haoban_welcome.title
*
* @param title the value for tab_haoban_welcome.title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method returns the value of the database column tab_haoban_welcome.welcome_content
*
* @return the value of tab_haoban_welcome.welcome_content
*/
public String getWelcomeContent() {
return welcomeContent;
}
/**
* This method sets the value of the database column tab_haoban_welcome.welcome_content
*
* @param welcomeContent the value for tab_haoban_welcome.welcome_content
*/
public void setWelcomeContent(String welcomeContent) {
this.welcomeContent = welcomeContent;
}
/**
* This method returns the value of the database column tab_haoban_welcome.status_flag
*
* @return the value of tab_haoban_welcome.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_welcome.status_flag
*
* @param statusFlag the value for tab_haoban_welcome.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_welcome.create_time
*
* @return the value of tab_haoban_welcome.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_welcome.create_time
*
* @param createTime the value for tab_haoban_welcome.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_welcome.update_time
*
* @return the value of tab_haoban_welcome.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_welcome.update_time
*
* @param updateTime the value for tab_haoban_welcome.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
...@@ -100,4 +100,26 @@ public interface WxEnterpriseApiService { ...@@ -100,4 +100,26 @@ public interface WxEnterpriseApiService {
* @return * @return
*/ */
public boolean delMiniprogramSettingByEid(String id); public boolean delMiniprogramSettingByEid(String id);
/**
* @param dto
* @return
*/
public boolean saveWelcome(WelcomeDTO dto);
/**
* 获取欢迎语
*
* @param wxEnterpriseId
* @return
*/
public WelcomeDTO getWelcome(String wxEnterpriseId);
/**
* 获取欢迎语
*
* @param wxEnterpriseId
* @return
*/
public boolean delWelcome(String wxEnterpriseId);
} }
package com.gic.haoban.manage.service.dao.mapper;
import com.gic.haoban.manage.service.entity.TabWelcome;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface TabHaobanWelcomeMapper {
/**
*/
int deleteByPrimaryKey(String welcomeId);
/**
*/
int insert(TabWelcome record);
/**
*/
int insertSelective(TabWelcome record);
/**
*/
TabWelcome selectByPrimaryKey(String welcomeId);
/**
*/
int updateByPrimaryKeySelective(TabWelcome record);
/**
*/
int updateByPrimaryKey(TabWelcome record);
/**
*/
TabWelcome selectByWxEnterpriseId(String wxEnterpriseId);
}
\ No newline at end of file
package com.gic.haoban.manage.service.entity;
import java.io.Serializable;
import java.util.Date;
/**
* Created By MBG-GUI-EXTENSION https://github.com/spawpaw/mybatis-generator-gui-extension
* Description:
* 欢迎语配置表
*
* @author fdh
*/
public class TabWelcome implements Serializable {
/**
*
*/
private String welcomeId;
/**
*
*/
private String wxEnterpriseId;
/**
*
*/
private String title;
/**
* 内容
*/
private String welcomeContent;
/**
* 0删除 1正常
*/
private Integer statusFlag;
/**
*
*/
private Date createTime;
/**
*
*/
private Date updateTime;
/**
*/
private static final long serialVersionUID = 1L;
/**
* This method returns the value of the database column tab_haoban_welcome.welcome_id
*
* @return the value of tab_haoban_welcome.welcome_id
*/
public String getWelcomeId() {
return welcomeId;
}
/**
* This method sets the value of the database column tab_haoban_welcome.welcome_id
*
* @param welcomeId the value for tab_haoban_welcome.welcome_id
*/
public void setWelcomeId(String welcomeId) {
this.welcomeId = welcomeId;
}
/**
* This method returns the value of the database column tab_haoban_welcome.wx_enterprise_id
*
* @return the value of tab_haoban_welcome.wx_enterprise_id
*/
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
/**
* This method sets the value of the database column tab_haoban_welcome.wx_enterprise_id
*
* @param wxEnterpriseId the value for tab_haoban_welcome.wx_enterprise_id
*/
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = wxEnterpriseId;
}
/**
* This method returns the value of the database column tab_haoban_welcome.title
*
* @return the value of tab_haoban_welcome.title
*/
public String getTitle() {
return title;
}
/**
* This method sets the value of the database column tab_haoban_welcome.title
*
* @param title the value for tab_haoban_welcome.title
*/
public void setTitle(String title) {
this.title = title;
}
/**
* This method returns the value of the database column tab_haoban_welcome.welcome_content
*
* @return the value of tab_haoban_welcome.welcome_content
*/
public String getWelcomeContent() {
return welcomeContent;
}
/**
* This method sets the value of the database column tab_haoban_welcome.welcome_content
*
* @param welcomeContent the value for tab_haoban_welcome.welcome_content
*/
public void setWelcomeContent(String welcomeContent) {
this.welcomeContent = welcomeContent;
}
/**
* This method returns the value of the database column tab_haoban_welcome.status_flag
*
* @return the value of tab_haoban_welcome.status_flag
*/
public Integer getStatusFlag() {
return statusFlag;
}
/**
* This method sets the value of the database column tab_haoban_welcome.status_flag
*
* @param statusFlag the value for tab_haoban_welcome.status_flag
*/
public void setStatusFlag(Integer statusFlag) {
this.statusFlag = statusFlag;
}
/**
* This method returns the value of the database column tab_haoban_welcome.create_time
*
* @return the value of tab_haoban_welcome.create_time
*/
public Date getCreateTime() {
return createTime;
}
/**
* This method sets the value of the database column tab_haoban_welcome.create_time
*
* @param createTime the value for tab_haoban_welcome.create_time
*/
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
/**
* This method returns the value of the database column tab_haoban_welcome.update_time
*
* @return the value of tab_haoban_welcome.update_time
*/
public Date getUpdateTime() {
return updateTime;
}
/**
* This method sets the value of the database column tab_haoban_welcome.update_time
*
* @param updateTime the value for tab_haoban_welcome.update_time
*/
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}
\ No newline at end of file
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.common.utils.PageUtil; import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.manage.api.dto.*; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.enums.SecretTypeEnum; import com.gic.haoban.manage.api.enums.SecretTypeEnum;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper;
import com.gic.haoban.manage.service.entity.TabMiniprogramSetting; import com.gic.haoban.manage.service.entity.TabMiniprogramSetting;
import com.gic.haoban.manage.service.entity.TabWelcome;
import com.gic.haoban.manage.service.service.MiniprogramSettingService; import com.gic.haoban.manage.service.service.MiniprogramSettingService;
import com.gic.haoban.manage.service.service.SecretSettingService; import com.gic.haoban.manage.service.service.SecretSettingService;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
...@@ -52,6 +56,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -52,6 +56,9 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
@Autowired @Autowired
private MiniprogramSettingService miniprogramSettingService; private MiniprogramSettingService miniprogramSettingService;
@Autowired
private TabHaobanWelcomeMapper welcomeMapper;
@Override @Override
public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) { public void callbackReviceEnterprise(QywxCorpInfoSimpleDTO dto) {
...@@ -196,4 +203,43 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService { ...@@ -196,4 +203,43 @@ public class WxEnterpriseApiServiceImpl implements WxEnterpriseApiService {
miniprogramSettingService.delMiniprogramSetting(id); miniprogramSettingService.delMiniprogramSetting(id);
return true; return true;
} }
@Override
public boolean saveWelcome(WelcomeDTO dto) {
TabWelcome tabWelcome = welcomeMapper.selectByWxEnterpriseId(dto.getWxEnterpriseId());
if (tabWelcome == null) {
tabWelcome.setTitle(dto.getTitle());
tabWelcome.setWelcomeContent(dto.getWelcomeContent());
tabWelcome.setCreateTime(new Date());
tabWelcome.setUpdateTime(new Date());
tabWelcome.setStatusFlag(1);
tabWelcome.setWelcomeId(ToolUtil.randomUUID());
welcomeMapper.insert(tabWelcome);
} else {
tabWelcome.setTitle(dto.getTitle());
tabWelcome.setWelcomeContent(dto.getWelcomeContent());
tabWelcome.setUpdateTime(new Date());
welcomeMapper.updateByPrimaryKeySelective(tabWelcome);
}
return true;
}
@Override
public WelcomeDTO getWelcome(String wxEnterpriseId) {
TabWelcome tabWelcome = welcomeMapper.selectByWxEnterpriseId(wxEnterpriseId);
return EntityUtil.changeEntityByJSON(WelcomeDTO.class, tabWelcome);
}
@Override
public boolean delWelcome(String wxEnterpriseId) {
TabWelcome tabWelcome = welcomeMapper.selectByWxEnterpriseId(wxEnterpriseId);
if (tabWelcome == null) {
return true;
}
tabWelcome.setStatusFlag(0);
tabWelcome.setUpdateTime(new Date());
welcomeMapper.updateByPrimaryKey(tabWelcome);
return true;
}
} }
<?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.haoban.manage.service.dao.mapper.TabHaobanWelcomeMapper">
<resultMap id="BaseResultMap" type="com.gic.haoban.manage.service.entity.TabWelcome">
<id column="welcome_id" jdbcType="VARCHAR" property="welcomeId"/>
<result column="wx_enterprise_id" jdbcType="VARCHAR" property="wxEnterpriseId"/>
<result column="title" jdbcType="VARCHAR" property="title"/>
<result column="welcome_content" jdbcType="VARCHAR" property="welcomeContent"/>
<result column="status_flag" jdbcType="INTEGER" property="statusFlag"/>
<result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
</resultMap>
<sql id="Base_Column_List">
welcome_id, wx_enterprise_id, title, welcome_content, status_flag, create_time, update_time
</sql>
<select id="selectByPrimaryKey" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_welcome
where welcome_id = #{welcomeId,jdbcType=VARCHAR}
</select>
<delete id="deleteByPrimaryKey" parameterType="java.lang.String">
delete from tab_haoban_welcome
where welcome_id = #{welcomeId,jdbcType=VARCHAR}
</delete>
<insert id="insert" parameterType="com.gic.haoban.manage.service.entity.TabWelcome">
insert into tab_haoban_welcome (welcome_id, wx_enterprise_id, title,
welcome_content, status_flag, create_time,
update_time)
values (#{welcomeId,jdbcType=VARCHAR}, #{wxEnterpriseId,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR},
#{welcomeContent,jdbcType=VARCHAR}, #{statusFlag,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
#{updateTime,jdbcType=TIMESTAMP})
</insert>
<insert id="insertSelective" parameterType="com.gic.haoban.manage.service.entity.TabWelcome">
insert into tab_haoban_welcome
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="welcomeId != null">
welcome_id,
</if>
<if test="wxEnterpriseId != null">
wx_enterprise_id,
</if>
<if test="title != null">
title,
</if>
<if test="welcomeContent != null">
welcome_content,
</if>
<if test="statusFlag != null">
status_flag,
</if>
<if test="createTime != null">
create_time,
</if>
<if test="updateTime != null">
update_time,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="welcomeId != null">
#{welcomeId,jdbcType=VARCHAR},
</if>
<if test="wxEnterpriseId != null">
#{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="title != null">
#{title,jdbcType=VARCHAR},
</if>
<if test="welcomeContent != null">
#{welcomeContent,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
#{statusFlag,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.haoban.manage.service.entity.TabWelcome">
update tab_haoban_welcome
<set>
<if test="wxEnterpriseId != null">
wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
</if>
<if test="title != null">
title = #{title,jdbcType=VARCHAR},
</if>
<if test="welcomeContent != null">
welcome_content = #{welcomeContent,jdbcType=VARCHAR},
</if>
<if test="statusFlag != null">
status_flag = #{statusFlag,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 welcome_id = #{welcomeId,jdbcType=VARCHAR}
</update>
<update id="updateByPrimaryKey" parameterType="com.gic.haoban.manage.service.entity.TabWelcome">
update tab_haoban_welcome
set wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR},
title = #{title,jdbcType=VARCHAR},
welcome_content = #{welcomeContent,jdbcType=VARCHAR},
status_flag = #{statusFlag,jdbcType=INTEGER},
create_time = #{createTime,jdbcType=TIMESTAMP},
update_time = #{updateTime,jdbcType=TIMESTAMP}
where welcome_id = #{welcomeId,jdbcType=VARCHAR}
</update>
<select id="selectByWxEnterpriseId" parameterType="java.lang.String" resultMap="BaseResultMap">
select
<include refid="Base_Column_List"/>
from tab_haoban_welcome
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag=1
</select>
</mapper>
\ No newline at end of file
...@@ -738,4 +738,53 @@ public class WxEnterpriseController extends WebBaseController{ ...@@ -738,4 +738,53 @@ public class WxEnterpriseController extends WebBaseController{
return resultResponse(HaoBanErrCode.ERR_1, enterpriseList); return resultResponse(HaoBanErrCode.ERR_1, enterpriseList);
} }
/**
* 绑定小程序配置列表
*
* @return
*/
@IgnoreLogin
@RequestMapping("save-welcome")
public HaobanResponse savewelcome(String title, String welcomeContent) {
LoginDTO loginUser = this.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
if (StringUtils.isAnyBlank(title, welcomeContent)) {
return resultResponse(HaoBanErrCode.ERR_2);
}
WelcomeDTO welcomeDTO = new WelcomeDTO();
welcomeDTO.setTitle(title);
welcomeDTO.setWelcomeContent(welcomeContent);
welcomeDTO.setWxEnterpriseId(wxEnterpriseId);
wxEnterpriseApiService.saveWelcome(welcomeDTO);
return resultResponse(HaoBanErrCode.ERR_1);
}
/**
* 绑定小程序配置列表
*
* @return
*/
@IgnoreLogin
@RequestMapping("get-welcome")
public HaobanResponse getWelcome() {
LoginDTO loginUser = this.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
WelcomeDTO welcome = wxEnterpriseApiService.getWelcome(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1, welcome);
}
/**
* 绑定小程序配置列表
*
* @return
*/
@IgnoreLogin
@RequestMapping("del-welcome")
public HaobanResponse delWelcome() {
LoginDTO loginUser = this.getLoginUser();
String wxEnterpriseId = loginUser.getWxEnterpriseId();
wxEnterpriseApiService.delWelcome(wxEnterpriseId);
return resultResponse(HaoBanErrCode.ERR_1);
}
} }
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