mirror of
https://gitee.com/y_project/RuoYi-Cloud.git
synced 2026-01-26 11:51:55 +08:00
新增微信二维码代码
This commit is contained in:
@@ -4,6 +4,11 @@ import java.util.List;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.ruoyi.system.domain.WxBasketballTeam;
|
||||
import com.ruoyi.system.domain.WxUser;
|
||||
import com.ruoyi.system.domain.vo.UserWxAqrCodeVo;
|
||||
import com.ruoyi.system.service.IWxBasketballTeamService;
|
||||
import com.ruoyi.system.service.IWxUserService;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@@ -29,16 +34,20 @@ public class UserWxAqrCodeController extends BaseController
|
||||
{
|
||||
@Autowired
|
||||
private IUserWxAqrCodeService userWxAqrCodeService;
|
||||
@Autowired
|
||||
private IWxUserService wxUserService;
|
||||
@Autowired
|
||||
private IWxBasketballTeamService wxBasketballTeamService;
|
||||
|
||||
/**
|
||||
* 查询微信用户小程序二维码列表
|
||||
*/
|
||||
@RequiresPermissions("system:code:list")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(UserWxAqrCode userWxAqrCode)
|
||||
public TableDataInfo list(UserWxAqrCodeVo userWxAqrCode)
|
||||
{
|
||||
startPage();
|
||||
List<UserWxAqrCode> list = userWxAqrCodeService.selectUserWxAqrCodeList(userWxAqrCode);
|
||||
List<UserWxAqrCodeVo> list = userWxAqrCodeService.selectUserWxAqrCodeList(userWxAqrCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@@ -48,10 +57,10 @@ public class UserWxAqrCodeController extends BaseController
|
||||
@RequiresPermissions("system:code:export")
|
||||
@Log(title = "微信用户小程序二维码", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, UserWxAqrCode userWxAqrCode)
|
||||
public void export(HttpServletResponse response, UserWxAqrCodeVo userWxAqrCode)
|
||||
{
|
||||
List<UserWxAqrCode> list = userWxAqrCodeService.selectUserWxAqrCodeList(userWxAqrCode);
|
||||
ExcelUtil<UserWxAqrCode> util = new ExcelUtil<UserWxAqrCode>(UserWxAqrCode.class);
|
||||
List<UserWxAqrCodeVo> list = userWxAqrCodeService.selectUserWxAqrCodeList(userWxAqrCode);
|
||||
ExcelUtil<UserWxAqrCodeVo> util = new ExcelUtil<UserWxAqrCodeVo>(UserWxAqrCodeVo.class);
|
||||
util.exportExcel(response, list, "微信用户小程序二维码数据");
|
||||
}
|
||||
|
||||
@@ -64,6 +73,21 @@ public class UserWxAqrCodeController extends BaseController
|
||||
{
|
||||
return AjaxResult.success(userWxAqrCodeService.selectUserWxAqrCodeById(id));
|
||||
}
|
||||
@RequiresPermissions("system:code:getUserAndTeams")
|
||||
@GetMapping(value = "/getUserAndTeams")
|
||||
public AjaxResult getUserAndTeam()
|
||||
{
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
WxUser wxUser = new WxUser();
|
||||
wxUser.setIsDeleted(0);
|
||||
List<WxUser> users = wxUserService.selectWxUserList(wxUser);
|
||||
WxBasketballTeam team = new WxBasketballTeam();
|
||||
team.setIsDeleted("0");
|
||||
List<WxBasketballTeam> teams = wxBasketballTeamService.selectWxBasketballTeamList(team);
|
||||
ajax.put("users", users);
|
||||
ajax.put("teams", teams);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增微信用户小程序二维码
|
||||
|
||||
@@ -11,7 +11,7 @@ import com.ruoyi.common.core.web.domain.BaseEntity;
|
||||
* 微信用户小程序二维码对象 user_wx_aqr_code
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2022-10-19
|
||||
* @date 2022-10-20
|
||||
*/
|
||||
public class UserWxAqrCode extends BaseEntity
|
||||
{
|
||||
@@ -70,6 +70,14 @@ public class UserWxAqrCode extends BaseEntity
|
||||
@Excel(name = "用途说明")
|
||||
private String useDesc;
|
||||
|
||||
/** 球衣号 */
|
||||
@Excel(name = "球衣号")
|
||||
private String jerseyNo;
|
||||
|
||||
/** 球队ID */
|
||||
@Excel(name = "球队ID")
|
||||
private Long teamId;
|
||||
|
||||
public void setId(Long id)
|
||||
{
|
||||
this.id = id;
|
||||
@@ -187,6 +195,24 @@ public class UserWxAqrCode extends BaseEntity
|
||||
{
|
||||
return useDesc;
|
||||
}
|
||||
public void setJerseyNo(String jerseyNo)
|
||||
{
|
||||
this.jerseyNo = jerseyNo;
|
||||
}
|
||||
|
||||
public String getJerseyNo()
|
||||
{
|
||||
return jerseyNo;
|
||||
}
|
||||
public void setTeamId(Long teamId)
|
||||
{
|
||||
this.teamId = teamId;
|
||||
}
|
||||
|
||||
public Long getTeamId()
|
||||
{
|
||||
return teamId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
@@ -204,6 +230,8 @@ public class UserWxAqrCode extends BaseEntity
|
||||
.append("page", getPage())
|
||||
.append("width", getWidth())
|
||||
.append("useDesc", getUseDesc())
|
||||
.append("jerseyNo", getJerseyNo())
|
||||
.append("teamId", getTeamId())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public class WxUser extends BaseEntity
|
||||
|
||||
/** 删除 */
|
||||
@Excel(name = "删除")
|
||||
private Long isDeleted;
|
||||
private Integer isDeleted;
|
||||
|
||||
/** 创建时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@@ -121,12 +121,12 @@ public class WxUser extends BaseEntity
|
||||
{
|
||||
return id;
|
||||
}
|
||||
public void setIsDeleted(Long isDeleted)
|
||||
public void setIsDeleted(Integer isDeleted)
|
||||
{
|
||||
this.isDeleted = isDeleted;
|
||||
}
|
||||
|
||||
public Long getIsDeleted()
|
||||
public Integer getIsDeleted()
|
||||
{
|
||||
return isDeleted;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.ruoyi.system.domain.vo;
|
||||
|
||||
import com.ruoyi.common.core.annotation.Excel;
|
||||
import com.ruoyi.system.domain.UserWxAqrCode;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author 吴一博
|
||||
* @date 2022年10月20日 13:42
|
||||
* @Description
|
||||
*/
|
||||
@Setter
|
||||
@Getter
|
||||
public class UserWxAqrCodeVo extends UserWxAqrCode {
|
||||
@Excel(name = "用户")
|
||||
private String userName;
|
||||
@Excel(name = "球队")
|
||||
private String teamName;
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserWxAqrCode;
|
||||
import com.ruoyi.system.domain.vo.UserWxAqrCodeVo;
|
||||
|
||||
/**
|
||||
* 微信用户小程序二维码Mapper接口
|
||||
@@ -25,7 +26,7 @@ public interface UserWxAqrCodeMapper
|
||||
* @param userWxAqrCode 微信用户小程序二维码
|
||||
* @return 微信用户小程序二维码集合
|
||||
*/
|
||||
public List<UserWxAqrCode> selectUserWxAqrCodeList(UserWxAqrCode userWxAqrCode);
|
||||
public List<UserWxAqrCodeVo> selectUserWxAqrCodeList(UserWxAqrCodeVo userWxAqrCode);
|
||||
|
||||
/**
|
||||
* 新增微信用户小程序二维码
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.ruoyi.system.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.system.domain.UserWxAqrCode;
|
||||
import com.ruoyi.system.domain.vo.UserWxAqrCodeVo;
|
||||
|
||||
/**
|
||||
* 微信用户小程序二维码Service接口
|
||||
@@ -25,7 +26,7 @@ public interface IUserWxAqrCodeService
|
||||
* @param userWxAqrCode 微信用户小程序二维码
|
||||
* @return 微信用户小程序二维码集合
|
||||
*/
|
||||
public List<UserWxAqrCode> selectUserWxAqrCodeList(UserWxAqrCode userWxAqrCode);
|
||||
public List<UserWxAqrCodeVo> selectUserWxAqrCodeList(UserWxAqrCodeVo userWxAqrCode);
|
||||
|
||||
/**
|
||||
* 新增微信用户小程序二维码
|
||||
|
||||
@@ -4,9 +4,12 @@ import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.ruoyi.common.core.utils.StringUtils;
|
||||
import com.ruoyi.common.security.utils.SecurityUtils;
|
||||
import com.ruoyi.system.api.domain.vo.WxAppletsCodeVo;
|
||||
import com.ruoyi.system.api.feign.WxAppletsFeign;
|
||||
import com.ruoyi.system.domain.vo.UserWxAqrCodeVo;
|
||||
import org.apache.commons.lang.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.system.mapper.UserWxAqrCodeMapper;
|
||||
@@ -48,7 +51,7 @@ public class UserWxAqrCodeServiceImpl implements IUserWxAqrCodeService
|
||||
* @return 微信用户小程序二维码
|
||||
*/
|
||||
@Override
|
||||
public List<UserWxAqrCode> selectUserWxAqrCodeList(UserWxAqrCode userWxAqrCode)
|
||||
public List<UserWxAqrCodeVo> selectUserWxAqrCodeList(UserWxAqrCodeVo userWxAqrCode)
|
||||
{
|
||||
return userWxAqrCodeMapper.selectUserWxAqrCodeList(userWxAqrCode);
|
||||
}
|
||||
@@ -109,8 +112,28 @@ public class UserWxAqrCodeServiceImpl implements IUserWxAqrCodeService
|
||||
int id = userWxAqrCodeMapper.insertUserWxAqrCode(userWxAqrCode);
|
||||
System.out.println("id = "+userWxAqrCode.getId()+" accessToken = "+ accessToken);
|
||||
WxAppletsCodeVo wxAppletsCodeVo = new WxAppletsCodeVo();
|
||||
wxAppletsCodeVo.setScene(String.valueOf(userWxAqrCode.getId()));
|
||||
wxAppletsCodeVo.setPage(userWxAqrCode.getPage());
|
||||
if(StringUtils.isEmpty(userWxAqrCode.getScene())) {
|
||||
StringBuffer sceneBuffer = new StringBuffer();
|
||||
sceneBuffer.append("id=");
|
||||
sceneBuffer.append(userWxAqrCode.getId());
|
||||
sceneBuffer.append("&tid=");
|
||||
sceneBuffer.append(userWxAqrCode.getTeamId());
|
||||
sceneBuffer.append("&uid=");
|
||||
sceneBuffer.append(userWxAqrCode.getUserId());
|
||||
wxAppletsCodeVo.setScene(sceneBuffer.toString());
|
||||
}else {
|
||||
wxAppletsCodeVo.setScene(userWxAqrCode.getScene());
|
||||
}
|
||||
if(StringUtils.isEmpty(userWxAqrCode.getScene())) {
|
||||
wxAppletsCodeVo.setPage("pages/index2/index2");
|
||||
}else {
|
||||
wxAppletsCodeVo.setPage(userWxAqrCode.getPage());
|
||||
}
|
||||
if(userWxAqrCode.getWidth() == null) {
|
||||
wxAppletsCodeVo.setWidth(50);
|
||||
}else {
|
||||
wxAppletsCodeVo.setWidth(userWxAqrCode.getWidth());
|
||||
}
|
||||
wxAppletsCodeVo = wxAppletsFeign.getWxacodeunlimit(wxAppletsCodeVo,accessToken);
|
||||
//更新二维码表
|
||||
userWxAqrCode.setCodeImgUrl(wxAppletsCodeVo.getCodeImgUrl());
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
# Tomcat
|
||||
server:
|
||||
port: 9201
|
||||
|
||||
# Mybatis开启驼峰映射
|
||||
mybatis:
|
||||
configuration:
|
||||
mapUnderscoreToCamelCase: true
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
|
||||
@@ -18,20 +18,19 @@
|
||||
<result property="page" column="page" />
|
||||
<result property="width" column="width" />
|
||||
<result property="useDesc" column="use_desc" />
|
||||
<result property="jerseyNo" column="jersey_no" />
|
||||
<result property="teamId" column="team_id" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectUserWxAqrCodeVo">
|
||||
select ID, IS_DELETED, CREATED_TIME, CREATED_BY, MODIFIED_BY, LAST_UPDATED_TIME, scene, code_img_url, user_id, bus_type, page, width, use_desc from user_wx_aqr_code
|
||||
select ID, IS_DELETED, CREATED_TIME, CREATED_BY, MODIFIED_BY, LAST_UPDATED_TIME, scene, code_img_url, user_id, bus_type, page, width, use_desc, jersey_no, team_id from user_wx_aqr_code
|
||||
</sql>
|
||||
|
||||
<select id="selectUserWxAqrCodeList" parameterType="UserWxAqrCode" resultMap="UserWxAqrCodeResult">
|
||||
<select id="selectUserWxAqrCodeList1" parameterType="UserWxAqrCode" resultMap="UserWxAqrCodeResult">
|
||||
<include refid="selectUserWxAqrCodeVo"/>
|
||||
<where>
|
||||
<if test="isDeleted != null "> and IS_DELETED = #{isDeleted}</if>
|
||||
<if test="createdTime != null "> and CREATED_TIME = #{createdTime}</if>
|
||||
<if test="createdBy != null and createdBy != ''"> and CREATED_BY like concat('%', #{createdBy}, '%')</if>
|
||||
<if test="modifiedBy != null and modifiedBy != ''"> and MODIFIED_BY = #{modifiedBy}</if>
|
||||
<if test="lastUpdatedTime != null "> and LAST_UPDATED_TIME = #{lastUpdatedTime}</if>
|
||||
<if test="scene != null and scene != ''"> and scene = #{scene}</if>
|
||||
<if test="codeImgUrl != null and codeImgUrl != ''"> and code_img_url = #{codeImgUrl}</if>
|
||||
<if test="userId != null "> and user_id = #{userId}</if>
|
||||
@@ -39,6 +38,8 @@
|
||||
<if test="page != null and page != ''"> and page = #{page}</if>
|
||||
<if test="width != null "> and width = #{width}</if>
|
||||
<if test="useDesc != null and useDesc != ''"> and use_desc = #{useDesc}</if>
|
||||
<if test="jerseyNo != null and jerseyNo != ''"> and jersey_no = #{jerseyNo}</if>
|
||||
<if test="teamId != null "> and team_id = #{teamId}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@@ -46,6 +47,26 @@
|
||||
<include refid="selectUserWxAqrCodeVo"/>
|
||||
where ID = #{id}
|
||||
</select>
|
||||
<select id="selectUserWxAqrCodeList" resultType="com.ruoyi.system.domain.vo.UserWxAqrCodeVo">
|
||||
select t.*,u.USER_NAME,team.TEAM_NAME
|
||||
from user_wx_aqr_code t left join user_info u on u.id = t.user_id
|
||||
LEFT JOIN basketball_team team on team.id = t.team_id
|
||||
<where>
|
||||
<if test="createdBy != null and createdBy != ''"> and t.CREATED_BY like concat('%', #{createdBy}, '%')</if>
|
||||
<if test="modifiedBy != null and modifiedBy != ''"> and t.MODIFIED_BY = #{modifiedBy}</if>
|
||||
<if test="scene != null and scene != ''"> and t.scene = #{scene}</if>
|
||||
<if test="codeImgUrl != null and codeImgUrl != ''"> and t.code_img_url = #{codeImgUrl}</if>
|
||||
<if test="userId != null "> and t.user_id = #{userId}</if>
|
||||
<if test="busType != null and busType != ''"> and t.bus_type = #{busType}</if>
|
||||
<if test="page != null and page != ''"> and t.page = #{page}</if>
|
||||
<if test="width != null "> and t.width = #{width}</if>
|
||||
<if test="useDesc != null and useDesc != ''"> and t.use_desc = #{useDesc}</if>
|
||||
<if test="jerseyNo != null and jerseyNo != ''"> and t.jersey_no = #{jerseyNo}</if>
|
||||
<if test="teamId != null "> and t.team_id = #{teamId}</if>
|
||||
<if test="teamName != null and teamName != ''"> and team.TEAM_NAME like concat('%', #{teamName}, '%')</if>
|
||||
<if test="userName != null and userName != ''"> and u.USER_NAME like concat('%', #{userName}, '%')</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<insert id="insertUserWxAqrCode" parameterType="UserWxAqrCode" useGeneratedKeys="true" keyProperty="id">
|
||||
insert into user_wx_aqr_code
|
||||
@@ -55,13 +76,15 @@
|
||||
<if test="createdBy != null">CREATED_BY,</if>
|
||||
<if test="modifiedBy != null">MODIFIED_BY,</if>
|
||||
<if test="lastUpdatedTime != null">LAST_UPDATED_TIME,</if>
|
||||
<if test="scene != null">scene,</if>
|
||||
<if test="scene != null and scene != ''">scene,</if>
|
||||
<if test="codeImgUrl != null">code_img_url,</if>
|
||||
<if test="userId != null">user_id,</if>
|
||||
<if test="busType != null">bus_type,</if>
|
||||
<if test="page != null">page,</if>
|
||||
<if test="busType != null and busType != ''">bus_type,</if>
|
||||
<if test="page != null and page != ''">page,</if>
|
||||
<if test="width != null">width,</if>
|
||||
<if test="useDesc != null">use_desc,</if>
|
||||
<if test="useDesc != null and useDesc != ''">use_desc,</if>
|
||||
<if test="jerseyNo != null">jersey_no,</if>
|
||||
<if test="teamId != null">team_id,</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="isDeleted != null">#{isDeleted},</if>
|
||||
@@ -69,13 +92,15 @@
|
||||
<if test="createdBy != null">#{createdBy},</if>
|
||||
<if test="modifiedBy != null">#{modifiedBy},</if>
|
||||
<if test="lastUpdatedTime != null">#{lastUpdatedTime},</if>
|
||||
<if test="scene != null">#{scene},</if>
|
||||
<if test="scene != null and scene != ''">#{scene},</if>
|
||||
<if test="codeImgUrl != null">#{codeImgUrl},</if>
|
||||
<if test="userId != null">#{userId},</if>
|
||||
<if test="busType != null">#{busType},</if>
|
||||
<if test="page != null">#{page},</if>
|
||||
<if test="busType != null and busType != ''">#{busType},</if>
|
||||
<if test="page != null and page != ''">#{page},</if>
|
||||
<if test="width != null">#{width},</if>
|
||||
<if test="useDesc != null">#{useDesc},</if>
|
||||
<if test="useDesc != null and useDesc != ''">#{useDesc},</if>
|
||||
<if test="jerseyNo != null">#{jerseyNo},</if>
|
||||
<if test="teamId != null">#{teamId},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
@@ -87,13 +112,15 @@
|
||||
<if test="createdBy != null">CREATED_BY = #{createdBy},</if>
|
||||
<if test="modifiedBy != null">MODIFIED_BY = #{modifiedBy},</if>
|
||||
<if test="lastUpdatedTime != null">LAST_UPDATED_TIME = #{lastUpdatedTime},</if>
|
||||
<if test="scene != null">scene = #{scene},</if>
|
||||
<if test="scene != null and scene != ''">scene = #{scene},</if>
|
||||
<if test="codeImgUrl != null">code_img_url = #{codeImgUrl},</if>
|
||||
<if test="userId != null">user_id = #{userId},</if>
|
||||
<if test="busType != null">bus_type = #{busType},</if>
|
||||
<if test="page != null">page = #{page},</if>
|
||||
<if test="busType != null and busType != ''">bus_type = #{busType},</if>
|
||||
<if test="page != null and page != ''">page = #{page},</if>
|
||||
<if test="width != null">width = #{width},</if>
|
||||
<if test="useDesc != null">use_desc = #{useDesc},</if>
|
||||
<if test="useDesc != null and useDesc != ''">use_desc = #{useDesc},</if>
|
||||
<if test="jerseyNo != null">jersey_no = #{jerseyNo},</if>
|
||||
<if test="teamId != null">team_id = #{teamId},</if>
|
||||
</trim>
|
||||
where ID = #{id}
|
||||
</update>
|
||||
|
||||
Reference in New Issue
Block a user