新增微信二维码代码

pull/371/head
wuyibo 3 years ago
parent fbefdd0d53
commit 4b5624dfa6

@ -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 20221020 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>

@ -16,7 +16,13 @@ export function getCode(id) {
method: 'get'
})
}
// 查询微信用户和球队列表
export function getUserAndTeams(){
return request({
url: '/system/code/getUserAndTeams',
method: 'get'
})
}
// 新增微信用户小程序二维码
export function addCode(data) {
return request({

@ -9,16 +9,32 @@
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-form-item label="绑定用户" prop="userName">
<el-input
v-model="queryParams.userId"
placeholder="请输入用户ID"
v-model="queryParams.userName"
placeholder="请输入用户"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="业务分类枚举" prop="busType">
<el-select v-model="queryParams.busType" placeholder="请选择业务分类枚举" clearable>
<el-form-item label="球衣号" prop="jerseyNo">
<el-input
v-model="queryParams.jerseyNo"
placeholder="请输入球衣号"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="绑定球队" prop="teamName">
<el-input
v-model="queryParams.teamName"
placeholder="请输入球队"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="业务分类" prop="busType">
<el-select v-model="queryParams.busType" placeholder="请选择业务分类" clearable>
<el-option
v-for="dict in dict.type.wx_aqr_type"
:key="dict.value"
@ -99,16 +115,27 @@
<el-table v-loading="loading" :data="codeList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<el-table-column label="主键ID" align="center" prop="id" />
<el-table-column label="用途说明" align="center" prop="useDesc" />
<el-table-column label="ID" align="center" prop="id" />
<el-table-column label="二维码" align="center" prop="contactTel" >
<template slot-scope="scope">
<el-image
style="width: 200px; height: 100px"
:src="scope.row.codeImgUrl"
:preview-src-list="[scope.row.codeImgUrl]"
:fit="imgfit"></el-image>
</template>
</el-table-column>
<el-table-column label="用途说明" align="center" prop="useDesc" show-overflow-tooltip="true" />
<el-table-column label="参数" align="center" prop="scene" />
<el-table-column label="用户ID" align="center" prop="userId" />
<el-table-column label="业务分类枚举" align="center" prop="busType">
<el-table-column label="绑定用户" align="center" prop="userName" />
<el-table-column label="绑定球队" align="center" prop="teamName" />
<el-table-column label="球衣号" align="center" prop="jerseyNo" />
<el-table-column label="业务分类" align="center" prop="busType">
<template slot-scope="scope">
<dict-tag :options="dict.type.wx_aqr_type" :value="scope.row.busType"/>
</template>
</el-table-column>
<el-table-column label="页面路径" align="center" prop="page" />
<el-table-column label="页面路径" align="center" prop="page" show-overflow-tooltip="true"/>
<el-table-column label="宽度" align="center" prop="width" />
<el-table-column label="创建时间" align="center" prop="createdTime" width="180">
<template slot-scope="scope">
@ -156,8 +183,8 @@
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
</el-form-item>
<el-form-item label="业务分类枚举" prop="busType">
<el-select v-model="form.busType" placeholder="请选择业务分类枚举">
<el-form-item label="业务分类" prop="busType">
<el-select v-model="form.busType" placeholder="请选择业务分类">
<el-option
v-for="dict in dict.type.wx_aqr_type"
:key="dict.value"
@ -205,10 +232,30 @@
<el-form-item label="参数" prop="scene">
<el-input v-model="form.scene" placeholder="请输入参数" />
</el-form-item>
<el-form-item label="用户ID" prop="userId">
<el-input v-model="form.userId" placeholder="请输入用户ID" />
<el-form-item label="用户">
<el-select v-model="form.userId" filterable placeholder="请选择用户">
<el-option
v-for="item in userOptions"
:key="item.id"
:label="item.userName"
:value="item.id"
:disabled="item.enabled == 0"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="球队">
<el-select v-model="form.teamId" filterable placeholder="请选择球队">
<el-option
v-for="item in teamOptions"
:key="item.id"
:label="item.teamName"
:value="item.id"
></el-option>
</el-select>
</el-form-item>
<el-form-item label="球衣号" prop="jerseyNo">
<el-input v-model="form.jerseyNo" placeholder="请输入球衣号" />
</el-form-item>
<el-form-item label="宽度" prop="width">
<el-input v-model="form.width" placeholder="请输入宽度" />
</el-form-item>
@ -222,8 +269,7 @@
</template>
<script>
import {listCode, getCode, delCode, addCode, updateCode, genAqrCode} from "@/api/system/code";
import {listCode, getCode, delCode, addCode, updateCode, genAqrCode, getUserAndTeams} from "@/api/system/code";
export default {
name: "Code",
dicts: ['wx_aqr_type'],
@ -233,6 +279,7 @@ export default {
loading: true,
//
ids: [],
imgfit:"fill",
//
single: true,
//
@ -243,6 +290,10 @@ export default {
total: 0,
//
codeList: [],
//
userOptions: [],
//
teamOptions: [],
//
title: "",
//
@ -284,6 +335,7 @@ export default {
},
created() {
this.getList();
//this.getuserAndteamsList();
},
methods: {
/** 查询微信用户小程序二维码列表 */
@ -295,6 +347,14 @@ export default {
this.loading = false;
});
},
getuserAndteamsList() {
this.loading = true;
getUserAndTeams().then(response => {
this.userOptions = response.users;
this.teamOptions = response.teams;
this.loading = false;
});
},
//
cancel() {
this.open = false;
@ -351,6 +411,12 @@ export default {
this.reset();
this.aqrOpen = true;
this.aqrTitle = "生成微信用户小程序二维码";
getUserAndTeams().then(response => {
this.userOptions = response.users;
this.teamOptions = response.teams;
this.aqrOpen = true;
this.aqrTitle = "生成微信用户小程序二维码";
});
},
/** 修改按钮操作 */
handleUpdate(row) {

Loading…
Cancel
Save