重命名Controller返回数据类名为Result
This commit is contained in:
parent
ad2701bfe1
commit
f5f9604cb6
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.common.exception;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import org.apache.shiro.authz.AuthorizationException;
|
||||
import org.slf4j.Logger;
|
||||
|
@ -23,47 +23,47 @@ public class RRExceptionHandler {
|
|||
* 处理自定义异常
|
||||
*/
|
||||
@ExceptionHandler(RRException.class)
|
||||
public R handleRrException(RRException e) {
|
||||
R r = new R();
|
||||
r.put("code", e.getCode());
|
||||
r.put("msg", e.getMessage());
|
||||
public Result handleRrException(RRException e) {
|
||||
Result result = new Result();
|
||||
result.put("code", e.getCode());
|
||||
result.put("msg", e.getMessage());
|
||||
|
||||
return r;
|
||||
return result;
|
||||
}
|
||||
|
||||
@ExceptionHandler(NoHandlerFoundException.class)
|
||||
public R handlerNoFoundException(Exception e) {
|
||||
public Result handlerNoFoundException(Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error(404, "路径不存在,请检查路径是否正确");
|
||||
return Result.error(404, "路径不存在,请检查路径是否正确");
|
||||
}
|
||||
|
||||
@ExceptionHandler(DuplicateKeyException.class)
|
||||
public R handleDuplicateKeyException(DuplicateKeyException e) {
|
||||
public Result handleDuplicateKeyException(DuplicateKeyException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("此ID已被使用,请重新确认!");
|
||||
return Result.error("此ID已被使用,请重新确认!");
|
||||
}
|
||||
|
||||
@ExceptionHandler(AuthorizationException.class)
|
||||
public R handleAuthorizationException(AuthorizationException e) {
|
||||
public Result handleAuthorizationException(AuthorizationException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("没有权限,请联系管理员授权");
|
||||
return Result.error("没有权限,请联系管理员授权");
|
||||
}
|
||||
|
||||
@ExceptionHandler(MissingRequestCookieException.class)
|
||||
public R handleMissingRequestCookieException(MissingRequestCookieException e) {
|
||||
public Result handleMissingRequestCookieException(MissingRequestCookieException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("请先添加公众号");
|
||||
return Result.error("请先添加公众号");
|
||||
}
|
||||
|
||||
@ExceptionHandler({WxErrorException.class})
|
||||
public R handleWxErrorException(WxErrorException e) {
|
||||
public Result handleWxErrorException(WxErrorException e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error("微信公众平台接口错误:" + e.getError().getErrorMsg());
|
||||
return Result.error("微信公众平台接口错误:" + e.getError().getErrorMsg());
|
||||
}
|
||||
|
||||
@ExceptionHandler(Exception.class)
|
||||
public R handleException(Exception e) {
|
||||
public Result handleException(Exception e) {
|
||||
logger.error(e.getMessage(), e);
|
||||
return R.error();
|
||||
return Result.error();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,61 +0,0 @@
|
|||
package com.github.niefy.common.utils;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
public class R extends HashMap<String, Object> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public R() {
|
||||
put("code", 200);
|
||||
put("msg", "success");
|
||||
}
|
||||
|
||||
public static R error() {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static R error(String msg) {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
||||
}
|
||||
|
||||
public static R error(int code, String msg) {
|
||||
R r = new R();
|
||||
r.put("code", code);
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(String msg) {
|
||||
R r = new R();
|
||||
r.put("msg", msg);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok(Map<String, Object> map) {
|
||||
R r = new R();
|
||||
r.putAll(map);
|
||||
return r;
|
||||
}
|
||||
|
||||
public static R ok() {
|
||||
return new R();
|
||||
}
|
||||
|
||||
@Override
|
||||
public R put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public R put(Object value) {
|
||||
super.put("data", value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.github.niefy.common.utils;
|
||||
|
||||
import org.apache.http.HttpStatus;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 返回数据
|
||||
* @author Mark sunlightcs@gmail.com
|
||||
*/
|
||||
public class Result extends HashMap<String, Object> {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public Result() {
|
||||
put("code", 200);
|
||||
put("msg", "success");
|
||||
}
|
||||
|
||||
public static Result error() {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, "未知异常,请联系管理员");
|
||||
}
|
||||
|
||||
public static Result error(String msg) {
|
||||
return error(HttpStatus.SC_INTERNAL_SERVER_ERROR, msg);
|
||||
}
|
||||
|
||||
public static Result error(int code, String msg) {
|
||||
Result result = new Result();
|
||||
result.put("code", code);
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result ok(String msg) {
|
||||
Result result = new Result();
|
||||
result.put("msg", msg);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result ok(Map<String, Object> map) {
|
||||
Result result = new Result();
|
||||
result.putAll(map);
|
||||
return result;
|
||||
}
|
||||
|
||||
public static Result ok() {
|
||||
return new Result();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result put(String key, Object value) {
|
||||
super.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
public Result put(Object value) {
|
||||
super.put("data", value);
|
||||
return this;
|
||||
}
|
||||
}
|
|
@ -1,17 +1,14 @@
|
|||
package com.github.niefy.modules.h5.controller;
|
||||
|
||||
import com.alibaba.excel.EasyExcel;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
import com.github.niefy.modules.h5.entity.H5DormitoryInfo;
|
||||
import com.github.niefy.modules.h5.entity.H5Student;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
|
||||
import com.github.niefy.modules.h5.excel.DormitoryInfo;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
|
||||
|
@ -19,17 +16,13 @@ import com.github.niefy.modules.h5.service.H5DormitoryInfoService;
|
|||
import com.github.niefy.modules.h5.service.H5WaiTeacherService;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
@ -84,13 +77,13 @@ public class ExcelController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
// @RequiresPermissions("adm:user:list")
|
||||
@ApiOperation(value = "列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
PageUtils page = h5DormitoryInfoService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -98,9 +91,9 @@ public class ExcelController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
// @RequiresPermissions("stu:user:delete")
|
||||
@ApiOperation(value = "删除",notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
|
||||
return R.error("系统管理员不能删除");
|
||||
return Result.error("系统管理员不能删除");
|
||||
}
|
||||
// if (Arrays.stream(id).anyMatch(byid->getUserId().equals(byid))) {
|
||||
// return R.error("当前用户不能删除");
|
||||
|
@ -110,15 +103,15 @@ public class ExcelController extends AbstractController {
|
|||
// h5UserService.remove(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5Student.getUserId()));
|
||||
// });
|
||||
h5DormitoryInfoService.deleteBatch(id);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/info/{userId}")
|
||||
// @RequiresPermissions("stu:user:info")
|
||||
@ApiOperation(value = "用户信息",notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5DormitoryInfo user = h5DormitoryInfoService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +121,7 @@ public class ExcelController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
// @RequiresPermissions("stu:user:update")
|
||||
@ApiOperation(value = "修改用户",notes = "")
|
||||
public R update(@RequestBody H5DormitoryInfo info) {
|
||||
public Result update(@RequestBody H5DormitoryInfo info) {
|
||||
ValidatorUtils.validateEntity(info, UpdateGroup.class);
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
// LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -139,29 +132,29 @@ public class ExcelController extends AbstractController {
|
|||
// one.setUserId(user.getUserId());
|
||||
// h5UserService.updateById(one);
|
||||
h5DormitoryInfoService.updateById(info);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
// @SysLog("保存")
|
||||
@PostMapping("/backsave")
|
||||
// @RequiresPermissions("stu:user:save")
|
||||
@ApiOperation(value = "保存用户",notes = "")
|
||||
public R backSave(@RequestBody H5DormitoryInfo info) {
|
||||
public Result backSave(@RequestBody H5DormitoryInfo info) {
|
||||
ValidatorUtils.validateEntity(info, AddGroup.class);
|
||||
info.setUpdateTime(LocalDateTime.now());
|
||||
// user.setCreateUserId(getUserId());
|
||||
h5DormitoryInfoService.save(info);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@GetMapping("/dist")
|
||||
public R distribute() {
|
||||
public Result distribute() {
|
||||
LambdaQueryWrapper<H5WaiTeacher> hwaiWrapper = new LambdaQueryWrapper<>();
|
||||
hwaiWrapper.eq(H5WaiTeacher::getDormitoryStatus, 1).eq(H5WaiTeacher::getDormitory, "");
|
||||
List<H5WaiTeacher> list = h5WaiTeacherService.list(hwaiWrapper);
|
||||
list.forEach(item -> {
|
||||
item.setDormitory("");
|
||||
});
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
import com.github.niefy.modules.h5.entity.H5AdminInfo;
|
||||
import com.github.niefy.modules.h5.entity.H5Invitation;
|
||||
import com.github.niefy.modules.h5.entity.H5Student;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.entity.excel_entiry.H5AdminExcelExclEntity;
|
||||
import com.github.niefy.modules.h5.entity.excel_entiry.H5UserExcelEntity;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
|
||||
import com.github.niefy.modules.h5.service.H5AdminInfoService;
|
||||
import com.github.niefy.modules.h5.service.H5UserService;
|
||||
|
@ -45,13 +42,13 @@ public class H5AdminController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("adm:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
PageUtils page = h5AdminInfoService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,7 +56,7 @@ public class H5AdminController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("stu:user:delete")
|
||||
@ApiOperation(value = "删除用户",notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
// if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
|
||||
// return R.error("系统管理员不能删除");
|
||||
// }
|
||||
|
@ -71,7 +68,7 @@ public class H5AdminController extends AbstractController {
|
|||
h5UserService.remove(new LambdaQueryWrapper<H5User>().eq(H5User::getUserId,h5AdminInfo.getUserId()));
|
||||
});
|
||||
h5AdminInfoService.deleteBatch(id);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -80,9 +77,9 @@ public class H5AdminController extends AbstractController {
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("stu:user:info")
|
||||
@ApiOperation(value = "用户信息",notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5AdminInfo user = h5AdminInfoService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
|
||||
|
@ -93,7 +90,7 @@ public class H5AdminController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys:user:update")
|
||||
@ApiOperation(value = "修改用户",notes = "")
|
||||
public R update(@RequestBody H5AdminInfo user) {
|
||||
public Result update(@RequestBody H5AdminInfo user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -105,12 +102,12 @@ public class H5AdminController extends AbstractController {
|
|||
one.setUserId(user.getWorkNumber());
|
||||
h5UserService.updateById(one);
|
||||
h5AdminInfoService.updateById(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
// 保存管理员用户
|
||||
@PostMapping("/save")
|
||||
@RequiresPermissions("stu:user:save")
|
||||
public R save(@RequestBody H5AdminInfo user) {
|
||||
public Result save(@RequestBody H5AdminInfo user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
// LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -124,7 +121,7 @@ public R save(@RequestBody H5AdminInfo user) {
|
|||
h5User.setIdentity(2);
|
||||
h5UserService.save(h5User);
|
||||
h5AdminInfoService.save(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
public static String getRandomNum(int length) {
|
||||
|
|
|
@ -1,17 +1,13 @@
|
|||
package com.github.niefy.modules.h5.controller;
|
||||
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.H5DormitoryInfo;
|
||||
import com.github.niefy.modules.h5.service.H5DormitoryInfoService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/dor")
|
||||
|
@ -31,9 +27,9 @@ public class H5DormitoryInfoController {
|
|||
@GetMapping("/listm")
|
||||
//@RequiresPermissions("h5:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R listM(@RequestParam("sex") String sex) {
|
||||
public Result listM(@RequestParam("sex") String sex) {
|
||||
List<H5DormitoryInfo> data = h5DormitoryInfoService.getManList(sex);
|
||||
return R.ok().put("dorinfo", data);
|
||||
return Result.ok().put("dorinfo", data);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,18 +3,16 @@ package com.github.niefy.modules.h5.controller;
|
|||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.*;
|
||||
import com.github.niefy.modules.h5.entity.dto.GroupDTO;
|
||||
import com.github.niefy.modules.h5.service.*;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.models.auth.In;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -51,23 +49,23 @@ public class H5GroupController extends AbstractController {
|
|||
@GetMapping("/pagelist")
|
||||
@RequiresPermissions("h5:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
params.put("PUserId", getUserId());
|
||||
PageUtils page = h5GroupService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
// @RequiresPermissions("group:lt:list")
|
||||
public R getGroupList() {
|
||||
public Result getGroupList() {
|
||||
List<H5Group> list = h5GroupService.Grouplist(getUserId());
|
||||
return R.ok().put("list", list);
|
||||
return Result.ok().put("list", list);
|
||||
}
|
||||
|
||||
@GetMapping("/id")
|
||||
|
@ -78,7 +76,7 @@ public class H5GroupController extends AbstractController {
|
|||
|
||||
// 分组
|
||||
@PostMapping("/add")
|
||||
public R addGroup(@RequestBody GroupDTO groupDTO) {
|
||||
public Result addGroup(@RequestBody GroupDTO groupDTO) {
|
||||
for (H5User h5User : userService.listByIds(Arrays.asList(groupDTO.getIds()))) {
|
||||
h5User.setGroupId(groupDTO.getGroupId());
|
||||
userService.updateById(h5User);
|
||||
|
@ -112,11 +110,11 @@ public class H5GroupController extends AbstractController {
|
|||
h5WaiTeacherService.updateById(teacher);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
// 取消分组
|
||||
@PostMapping("/remove")
|
||||
public R removeGroup(@RequestBody GroupDTO groupDTO) {
|
||||
public Result removeGroup(@RequestBody GroupDTO groupDTO) {
|
||||
for (H5User h5User : userService.listByIds(Arrays.asList(groupDTO.getIds()))) {
|
||||
h5User.setGroupId(0);
|
||||
userService.updateById(h5User);
|
||||
|
@ -150,7 +148,7 @@ public class H5GroupController extends AbstractController {
|
|||
h5WaiTeacherService.updateById(teacher);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,25 +156,25 @@ public class H5GroupController extends AbstractController {
|
|||
*/
|
||||
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody H5Group h5Group) {
|
||||
public Result save(@RequestBody H5Group h5Group) {
|
||||
h5GroupService.saveGroup(h5Group,getUserId());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
// 删除组
|
||||
@PostMapping("/delete")
|
||||
public R delete(@RequestBody Long[] ids) {
|
||||
public Result delete(@RequestBody Long[] ids) {
|
||||
// 先id来判断该组用户表中是否已分配,如果分配提示用户先从这组里移除已存在的用户否则直接删除
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
for (Long id : ids) {
|
||||
h5UserLambdaQueryWrapper.eq(H5User::getGroupId,id);
|
||||
if (userService.count(h5UserLambdaQueryWrapper) > 0) {
|
||||
return R.error("该组存在用户,请先从这组里移除已存在的用户");
|
||||
return Result.error("该组存在用户,请先从这组里移除已存在的用户");
|
||||
}
|
||||
}
|
||||
|
||||
h5GroupService.removeByIds(Arrays.asList(ids));
|
||||
return R.ok("删除成功");
|
||||
return Result.ok("删除成功");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,14 +1,9 @@
|
|||
package com.github.niefy.modules.h5.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.H5Invitation;
|
||||
import com.github.niefy.modules.h5.entity.H5LocalTeacher;
|
||||
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelWriterFactory;
|
||||
import com.github.niefy.modules.h5.service.H5InvitationService;
|
||||
import com.github.niefy.modules.h5.service.H5WaiTeacherService;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
|
@ -22,16 +17,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import javax.naming.ldap.BasicControl;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/inv")
|
||||
@Api(tags = {"评卷管理-邀请函管理"})
|
||||
|
@ -60,14 +47,14 @@ public class H5InvitationController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("inv:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
params.put("PUserId", getUserId());
|
||||
PageUtils page = h5InvitationService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
// @GetMapping("/listy")
|
||||
// @RequiresPermissions("inv:user:list")
|
||||
|
@ -121,11 +108,11 @@ public class H5InvitationController extends AbstractController {
|
|||
@GetMapping("/update")
|
||||
// @RequiresPermissions("inv:user:update")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R update(@RequestParam("id") String id,@RequestParam("workNameQr") String workNameQr) {
|
||||
public Result update(@RequestParam("id") String id, @RequestParam("workNameQr") String workNameQr) {
|
||||
H5Invitation byId = h5InvitationService.getById(id);
|
||||
byId.setWorkNameQr(workNameQr);
|
||||
h5InvitationService.updateById(byId);
|
||||
return R.ok().put("page",null);
|
||||
return Result.ok().put("page",null);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,12 +4,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
import com.github.niefy.modules.h5.entity.H5LocalTeacher;
|
||||
import com.github.niefy.modules.h5.entity.H5Student;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.service.H5LocalTeacherService;
|
||||
import com.github.niefy.modules.h5.service.H5UserService;
|
||||
|
@ -43,7 +42,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
|
||||
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody H5LocalTeacher teacher) {
|
||||
public Result save(@RequestBody H5LocalTeacher teacher) {
|
||||
LambdaQueryWrapper<H5User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(H5User::getOpenId, teacher.getOpenId());
|
||||
H5User oneUser = h5UserService.getOne(queryWrapper);
|
||||
|
@ -57,7 +56,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("user", teacher);
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
}
|
||||
/**
|
||||
* 管理端获取学生列表
|
||||
|
@ -68,14 +67,14 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("teach:user:list")
|
||||
@ApiOperation(value = "用户列表",notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
params.put("PUserId", getUserId());
|
||||
PageUtils page = teacherService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -87,7 +86,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("teach:user:delete")
|
||||
@ApiOperation(value = "删除用户",notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
// if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
|
||||
// return R.error("系统管理员不能删除");
|
||||
// }
|
||||
|
@ -105,7 +104,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
// h5UserService.remove();
|
||||
});
|
||||
teacherService.deleteBatch(id);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 更新时候获取用户信息
|
||||
|
@ -113,9 +112,9 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("teach:user:info")
|
||||
@ApiOperation(value = "用户信息",notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5LocalTeacher user = teacherService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -126,13 +125,13 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
@PostMapping("/backsave")
|
||||
@RequiresPermissions("teach:user:save")
|
||||
@ApiOperation(value = "保存用户",notes = "")
|
||||
public R backSave(@RequestBody H5LocalTeacher user) {
|
||||
public Result backSave(@RequestBody H5LocalTeacher user) {
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
// user.setCreateUserId(getUserId());
|
||||
teacherService.save(user);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("teach:user:update")
|
||||
@ApiOperation(value = "修改用户",notes = "")
|
||||
public R update(@RequestBody H5LocalTeacher user) {
|
||||
public Result update(@RequestBody H5LocalTeacher user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -154,7 +153,7 @@ public class H5LocalTeacherController extends AbstractController{
|
|||
one.setUserId(user.getUserId());
|
||||
h5UserService.updateById(one);
|
||||
teacherService.updateById(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -4,15 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
import com.github.niefy.modules.h5.entity.H5LocalTeacher;
|
||||
import com.github.niefy.modules.h5.entity.H5Student;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
|
||||
import com.github.niefy.modules.h5.service.H5InvitationService;
|
||||
import com.github.niefy.modules.h5.service.H5StudentService;
|
||||
import com.github.niefy.modules.h5.service.H5UserService;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
|
@ -45,7 +42,7 @@ public class H5StudentController extends AbstractController{
|
|||
}
|
||||
|
||||
@PostMapping("/save")
|
||||
public R save(@RequestBody H5Student student) {
|
||||
public Result save(@RequestBody H5Student student) {
|
||||
LambdaQueryWrapper<H5User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(H5User::getOpenId, student.getOpenId());
|
||||
H5User oneUser = h5UserService.getOne(queryWrapper);
|
||||
|
@ -59,7 +56,7 @@ public class H5StudentController extends AbstractController{
|
|||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("user",student);
|
||||
map.put("router","/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
}
|
||||
/**
|
||||
* 管理端获取学生列表
|
||||
|
@ -70,14 +67,14 @@ public class H5StudentController extends AbstractController{
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("stu:user:list")
|
||||
@ApiOperation(value = "用户列表",notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
params.put("PUserId", getUserId());
|
||||
PageUtils page = studentService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -89,9 +86,9 @@ public class H5StudentController extends AbstractController{
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("stu:user:delete")
|
||||
@ApiOperation(value = "删除用户",notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
|
||||
return R.error("系统管理员不能删除");
|
||||
return Result.error("系统管理员不能删除");
|
||||
}
|
||||
// if (Arrays.stream(id).anyMatch(byid->getUserId().equals(byid))) {
|
||||
// return R.error("当前用户不能删除");
|
||||
|
@ -107,7 +104,7 @@ public class H5StudentController extends AbstractController{
|
|||
// h5UserService.remove();
|
||||
});
|
||||
studentService.deleteBatch(id);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 更新时候获取用户信息
|
||||
|
@ -115,9 +112,9 @@ public class H5StudentController extends AbstractController{
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("stu:user:info")
|
||||
@ApiOperation(value = "用户信息",notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5Student user = studentService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,13 +125,13 @@ public class H5StudentController extends AbstractController{
|
|||
@PostMapping("/backsave")
|
||||
@RequiresPermissions("stu:user:save")
|
||||
@ApiOperation(value = "保存用户",notes = "")
|
||||
public R backSave(@RequestBody H5Student user) {
|
||||
public Result backSave(@RequestBody H5Student user) {
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
// user.setCreateUserId(getUserId());
|
||||
studentService.save(user);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -145,7 +142,7 @@ public class H5StudentController extends AbstractController{
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("stu:user:update")
|
||||
@ApiOperation(value = "修改用户",notes = "")
|
||||
public R update(@RequestBody H5Student user) {
|
||||
public Result update(@RequestBody H5Student user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -156,7 +153,7 @@ public class H5StudentController extends AbstractController{
|
|||
one.setUserId(user.getUserId());
|
||||
h5UserService.updateById(one);
|
||||
studentService.updateById(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,19 +4,16 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
import com.github.niefy.modules.h5.entity.*;
|
||||
import com.github.niefy.modules.h5.entity.dto.H5UserDTO;
|
||||
import com.github.niefy.modules.h5.entity.excel_entiry.H5UserExcelEntity;
|
||||
import com.github.niefy.modules.h5.excel.DormitoryInfo;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
|
||||
import com.github.niefy.modules.h5.service.*;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
import com.github.niefy.modules.sys.entity.SysUserEntity;
|
||||
import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
|
@ -25,7 +22,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
|
@ -73,7 +69,7 @@ public class H5UserController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("h5:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
|
@ -81,7 +77,7 @@ public class H5UserController extends AbstractController {
|
|||
params.put("PUserId", getUserId());
|
||||
PageUtils page = h5UserService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,12 +88,12 @@ public class H5UserController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("h5:user:delete")
|
||||
@ApiOperation(value = "删除用户", notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
if (Arrays.stream(id).anyMatch(byid -> byid.intValue() == Constant.SUPER_ADMIN)) {
|
||||
return R.error("系统管理员不能删除");
|
||||
return Result.error("系统管理员不能删除");
|
||||
}
|
||||
if (Arrays.stream(id).anyMatch(byid -> getUserId().equals(byid))) {
|
||||
return R.error("当前用户不能删除");
|
||||
return Result.error("当前用户不能删除");
|
||||
}
|
||||
List<Long> list = Arrays.asList(id);
|
||||
List<H5User> h5Users = h5UserService.listByIds(list);
|
||||
|
@ -114,7 +110,7 @@ public class H5UserController extends AbstractController {
|
|||
});
|
||||
h5UserService.deleteBatch(id);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,7 +120,7 @@ public class H5UserController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("h5:user:save")
|
||||
@ApiOperation(value = "保存用户", notes = "")
|
||||
public R save(@RequestBody H5User user) {
|
||||
public Result save(@RequestBody H5User user) {
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
// user.setCreateUserId(getUserId());
|
||||
|
@ -140,7 +136,7 @@ public class H5UserController extends AbstractController {
|
|||
// h5UserService.CreateNewUser(user,getUserId());
|
||||
h5UserService.save(user);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -149,9 +145,9 @@ public class H5UserController extends AbstractController {
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("h5:user:info")
|
||||
@ApiOperation(value = "用户信息", notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5User user = h5UserService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
|
||||
|
@ -162,13 +158,13 @@ public class H5UserController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("h5:user:update")
|
||||
@ApiOperation(value = "修改用户", notes = "")
|
||||
public R update(@RequestBody H5User user) {
|
||||
public Result update(@RequestBody H5User user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
Integer identity = h5UserService.getById(user.getId()).getIdentity();
|
||||
// Integer identity = user.getIdentity();
|
||||
if (identity == null) {
|
||||
return R.error("身份不能为空");
|
||||
return Result.error("身份不能为空");
|
||||
}
|
||||
|
||||
switch (identity) {
|
||||
|
@ -237,10 +233,10 @@ public class H5UserController extends AbstractController {
|
|||
}
|
||||
break;
|
||||
default:
|
||||
return R.error("身份错误");
|
||||
return Result.error("身份错误");
|
||||
}
|
||||
h5UserService.updateById(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -250,10 +246,10 @@ public class H5UserController extends AbstractController {
|
|||
@GetMapping("/autoId")
|
||||
@RequiresPermissions("h5:user:list")
|
||||
@ApiOperation(value = "自动生成账号", notes = "")
|
||||
public R autoGenerateUserId(Integer groupType,Integer num,Integer majorId) {
|
||||
public Result autoGenerateUserId(Integer groupType, Integer num, Integer majorId) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
h5UserService.createAccount(groupType,num,majorId);
|
||||
return R.ok().put("success");
|
||||
return Result.ok().put("success");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -263,7 +259,7 @@ public class H5UserController extends AbstractController {
|
|||
*/
|
||||
@GetMapping("/qall")
|
||||
@ApiOperation(value = "查询用户分组列表", notes = "")
|
||||
public R queryUserAllUser(@RequestParam Integer groupId) {
|
||||
public Result queryUserAllUser(@RequestParam Integer groupId) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
// List<H5User> groupUser = h5UserService.getGroupUser(1);
|
||||
List<H5User> all = h5UserService.queryUserAllUser();
|
||||
|
@ -271,7 +267,7 @@ public class H5UserController extends AbstractController {
|
|||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("all", all);
|
||||
map.put("groupUser", groupUser);
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
}
|
||||
|
||||
|
||||
|
@ -322,7 +318,7 @@ public class H5UserController extends AbstractController {
|
|||
@GetMapping("/workload")
|
||||
// @RequiresPermissions("inv:user:update")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R update(@RequestParam("id") String id,@RequestParam("workload") Integer workload) {
|
||||
public Result update(@RequestParam("id") String id, @RequestParam("workload") Integer workload) {
|
||||
// 判断workload的值是否空如果空则填写0
|
||||
if (workload==null){
|
||||
workload=0;
|
||||
|
@ -330,7 +326,7 @@ public class H5UserController extends AbstractController {
|
|||
H5User byId = h5UserService.getById(id);
|
||||
byId.setWorkload(workload);
|
||||
h5UserService.updateById(byId);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -345,10 +341,10 @@ public class H5UserController extends AbstractController {
|
|||
}
|
||||
|
||||
@GetMapping("/grp")
|
||||
public R queryGroupUser() {
|
||||
public Result queryGroupUser() {
|
||||
List<H5UserDTO> h5Users = h5UserService.queryGroupUser(getUserId());
|
||||
|
||||
return R.ok().put("user", h5Users);
|
||||
return Result.ok().put("user", h5Users);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
|
@ -14,7 +14,6 @@ import com.github.niefy.modules.h5.entity.H5User;
|
|||
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
|
||||
|
||||
import com.github.niefy.modules.h5.entity.excel_entiry.H5WaiTeacherExcel;
|
||||
import com.github.niefy.modules.h5.entity.excel_entiry.MealCardExcel;
|
||||
import com.github.niefy.modules.h5.excel.EasyExcelUtil;
|
||||
import com.github.niefy.modules.h5.service.H5InvitationService;
|
||||
import com.github.niefy.modules.h5.service.H5UserService;
|
||||
|
@ -54,7 +53,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
}
|
||||
|
||||
@RequestMapping("/save")
|
||||
public R save(@RequestBody H5WaiTeacher waiTeacher) {
|
||||
public Result save(@RequestBody H5WaiTeacher waiTeacher) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
LambdaQueryWrapper<H5User> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(H5User::getOpenId, waiTeacher.getOpenId());
|
||||
|
@ -72,7 +71,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
h5InvitationService.update(qw);
|
||||
map.put("user", waiTeacher);
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -84,14 +83,14 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wai:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
params.put("PUserId", getUserId());
|
||||
PageUtils page = h5WaiTeacherService.queryPage(params);
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -103,7 +102,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wai:user:delete")
|
||||
@ApiOperation(value = "删除用户", notes = "")
|
||||
public R delete(@RequestBody Long[] id) {
|
||||
public Result delete(@RequestBody Long[] id) {
|
||||
// if (Arrays.stream(id).anyMatch(byid->byid.intValue()==Constant.SUPER_ADMIN)) {
|
||||
// return R.error("系统管理员不能删除");
|
||||
// }
|
||||
|
@ -121,7 +120,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
// h5UserService.remove();
|
||||
});
|
||||
h5WaiTeacherService.deleteBatch(id);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -132,7 +131,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@GetMapping("/confirm")
|
||||
// @RequiresPermissions("wai:user:delete")
|
||||
@ApiOperation(value = "确认外校老师信息", notes = "")
|
||||
public R confirm(@RequestParam(value = "id") Integer id,@RequestParam(value = "un", required = false) String un) {
|
||||
public Result confirm(@RequestParam(value = "id") Integer id, @RequestParam(value = "un", required = false) String un) {
|
||||
if (StringUtils.isEmpty(un)){
|
||||
LambdaUpdateWrapper<H5WaiTeacher> waiUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
waiUpdateWrapper.eq(H5WaiTeacher::getId, id).set(H5WaiTeacher::getStatus, 0);
|
||||
|
@ -142,7 +141,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
waiUpdateWrapper.eq(H5WaiTeacher::getId, id).set(H5WaiTeacher::getStatus, 1);
|
||||
h5WaiTeacherService.update(waiUpdateWrapper);
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -153,9 +152,9 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("wai:user:info")
|
||||
@ApiOperation(value = "用户信息", notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
H5WaiTeacher user = h5WaiTeacherService.getById(userId);
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -166,16 +165,16 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@PostMapping("/backsave")
|
||||
@RequiresPermissions("wai:user:save")
|
||||
@ApiOperation(value = "保存用户", notes = "")
|
||||
public R backSave(@RequestBody H5WaiTeacher user) {
|
||||
public Result backSave(@RequestBody H5WaiTeacher user) {
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
user.setCreateTime(LocalDateTime.now());
|
||||
|
||||
boolean save= h5WaiTeacherService.saveWaiTeacher(user,getUserId());
|
||||
|
||||
if (!save){
|
||||
return R.error("操作失败");
|
||||
return Result.error("操作失败");
|
||||
}
|
||||
return R.ok("操作成功");
|
||||
return Result.ok("操作成功");
|
||||
}
|
||||
|
||||
|
||||
|
@ -186,7 +185,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("wai:user:update")
|
||||
@ApiOperation(value = "修改用户", notes = "")
|
||||
public R update(@RequestBody H5WaiTeacher user) {
|
||||
public Result update(@RequestBody H5WaiTeacher user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
user.setUpdateTime(LocalDateTime.now());
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -197,7 +196,7 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
one.setUserId(user.getUserId());
|
||||
h5UserService.updateById(one);
|
||||
h5WaiTeacherService.updateById(user);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -210,9 +209,9 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@SysLog("修改用户")
|
||||
@GetMapping("/start")
|
||||
@RequiresPermissions("wai:user:start")
|
||||
public R startTask() {
|
||||
public Result startTask() {
|
||||
h5WaiTeacherService.startTask();
|
||||
return R.ok("分配成功");
|
||||
return Result.ok("分配成功");
|
||||
}
|
||||
|
||||
// @GetMapping("count")
|
||||
|
@ -228,9 +227,9 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/count")
|
||||
public R queryCount(@RequestParam(value = "major",required = false) Integer major) {
|
||||
public Result queryCount(@RequestParam(value = "major",required = false) Integer major) {
|
||||
Map<String, Long> stringLongMap = h5WaiTeacherService.queryCount(getUserId(), major);
|
||||
return R.ok().put(stringLongMap);
|
||||
return Result.ok().put(stringLongMap);
|
||||
}
|
||||
|
||||
@GetMapping("/export")
|
||||
|
@ -249,9 +248,9 @@ public class H5WaiTeacherController extends AbstractController {
|
|||
@GetMapping("/saved")
|
||||
//@RequiresPermissions("h5:user:list")
|
||||
@ApiOperation(value = "用户列表", notes = "")
|
||||
public R listDor(@RequestParam Map<String, Object> params) {
|
||||
public Result listDor(@RequestParam Map<String, Object> params) {
|
||||
h5WaiTeacherService.getWoManList(params);
|
||||
return R.ok().put("page", "");
|
||||
return Result.ok().put("page", "");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,19 +1,15 @@
|
|||
package com.github.niefy.modules.h5.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.service.*;
|
||||
import com.github.niefy.modules.wx.config.RedisTemplateConfig;
|
||||
import com.github.niefy.modules.wx.form.WxH5OuthrizeForm;
|
||||
import me.chanjar.weixin.common.api.WxConsts;
|
||||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
@ -124,7 +120,7 @@ public class wxLoginController {
|
|||
// }
|
||||
|
||||
@PostMapping("/check")
|
||||
public R checkH5User(@RequestBody H5User h5User) {
|
||||
public Result checkH5User(@RequestBody H5User h5User) {
|
||||
/**第一次登录逻辑
|
||||
* 0.查询表opneid不存在则一定时第一次登录
|
||||
* 1.输入账号以后查询数据库如果存在则保存openid到h5_user当中
|
||||
|
@ -141,7 +137,7 @@ public class wxLoginController {
|
|||
return h5UserService.checkUser(h5User);
|
||||
}
|
||||
@GetMapping("/autologin")
|
||||
public R getUserByOpenId(String openId) {
|
||||
public Result getUserByOpenId(String openId) {
|
||||
return h5UserService.AutocheckUser(openId);
|
||||
}
|
||||
|
||||
|
@ -152,17 +148,17 @@ public class wxLoginController {
|
|||
* @return
|
||||
*/
|
||||
@GetMapping("/major")
|
||||
public R getMajor(String userId){
|
||||
public Result getMajor(String userId){
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
h5UserLambdaQueryWrapper.eq(H5User::getUserId,userId);
|
||||
H5User one = h5UserService.getOne(h5UserLambdaQueryWrapper);
|
||||
if (one != null) {
|
||||
return R.ok().put("major", one);
|
||||
return Result.ok().put("major", one);
|
||||
}
|
||||
return R.error(500,"账号不存在");
|
||||
return Result.error(500,"账号不存在");
|
||||
}
|
||||
@GetMapping("/getUser")
|
||||
public R getUser(String openId) {
|
||||
public Result getUser(String openId) {
|
||||
LambdaQueryWrapper<H5User> h5UserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
h5UserLambdaQueryWrapper.eq(H5User::getOpenId, openId);
|
||||
H5User h5User = h5UserService.getOne(h5UserLambdaQueryWrapper);
|
||||
|
@ -201,8 +197,8 @@ public class wxLoginController {
|
|||
map.put("show7", true);
|
||||
map.put("show8", true);
|
||||
}
|
||||
return R.ok().put(map);
|
||||
return Result.ok().put(map);
|
||||
}
|
||||
return R.error("未知错误");
|
||||
return Result.error("未知错误");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +1,10 @@
|
|||
package com.github.niefy.modules.h5.service;
|
||||
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.modules.h5.entity.H5AdminInfo;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.niefy.modules.h5.entity.dto.H5UserDTO;
|
||||
import com.github.niefy.modules.sys.entity.SysUserEntity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -18,9 +16,9 @@ import java.util.Map;
|
|||
*/
|
||||
public interface H5UserService extends IService<H5User> {
|
||||
|
||||
R checkUser(H5User h5User);
|
||||
Result checkUser(H5User h5User);
|
||||
|
||||
public R AutocheckUser(String openid);
|
||||
public Result AutocheckUser(String openid);
|
||||
public PageUtils queryPage(Map<String, Object> params);
|
||||
public void deleteBatch(Long[] userId);
|
||||
|
||||
|
|
|
@ -6,38 +6,33 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.Query;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.modules.h5.entity.H5LocalTeacher;
|
||||
import com.github.niefy.modules.h5.entity.H5Student;
|
||||
import com.github.niefy.modules.h5.entity.H5User;
|
||||
import com.github.niefy.modules.h5.entity.H5WaiTeacher;
|
||||
import com.github.niefy.modules.h5.service.H5LocalTeacherService;
|
||||
import com.github.niefy.modules.h5.mapper.H5LocalTeacherMapper;
|
||||
import com.github.niefy.modules.h5.service.H5LocalTeacherService;
|
||||
import com.github.niefy.modules.h5.service.H5UserService;
|
||||
import com.github.niefy.modules.h5.util.H5Util;
|
||||
import com.github.niefy.modules.sys.service.impl.ShiroServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author 27428
|
||||
* @description 针对表【h5_local_teacher】的数据库操作Service实现
|
||||
* @createDate 2024-04-09 00:52:17
|
||||
*/
|
||||
* @author 27428
|
||||
* @description 针对表【h5_local_teacher】的数据库操作Service实现
|
||||
* @createDate 2024-04-09 00:52:17
|
||||
*/
|
||||
@Service
|
||||
public class H5LocalTeacherServiceImpl extends ServiceImpl<H5LocalTeacherMapper, H5LocalTeacher>
|
||||
implements H5LocalTeacherService{
|
||||
implements H5LocalTeacherService {
|
||||
private final ShiroServiceImpl shiroServiceImpl;
|
||||
private final H5LocalTeacherMapper localTeacherMapper;
|
||||
private final H5UserService h5UserService;
|
||||
|
||||
@Autowired
|
||||
public H5LocalTeacherServiceImpl( H5UserService h5UserService,H5LocalTeacherMapper localTeacherMapper, ShiroServiceImpl shiroServiceImpl) {
|
||||
public H5LocalTeacherServiceImpl(H5UserService h5UserService, H5LocalTeacherMapper localTeacherMapper, ShiroServiceImpl shiroServiceImpl) {
|
||||
this.shiroServiceImpl = shiroServiceImpl;
|
||||
this.localTeacherMapper = localTeacherMapper;
|
||||
this.h5UserService = h5UserService;
|
||||
|
@ -57,20 +52,20 @@ public class H5LocalTeacherServiceImpl extends ServiceImpl<H5LocalTeacherMapper,
|
|||
boolean containsl = userPermissions.contains("wai:user:listl");
|
||||
boolean containsz = userPermissions.contains("wai:user:listz");
|
||||
// 如果是管理员看到所有人
|
||||
if (userPermissions.size()>30){
|
||||
return queryPageUser(params, userName,0,sortOrder,sortField);
|
||||
}else if(containsy){
|
||||
// 查看语文学科人
|
||||
return queryPageUser(params, userName,1,sortOrder,sortField);
|
||||
// 地理学科
|
||||
}else if (containsd){
|
||||
return queryPageUser(params, userName,4,sortOrder,sortField);
|
||||
// 历史
|
||||
}else if (containsl){
|
||||
return queryPageUser(params, userName,7,sortOrder,sortField);
|
||||
// 政治
|
||||
}else if (containsz){
|
||||
return queryPageUser(params, userName,8,sortOrder,sortField);
|
||||
if (userPermissions.size() > 30) {
|
||||
return queryPageUser(params, userName, 0, sortOrder, sortField);
|
||||
} else if (containsy) {
|
||||
//查看语文学科人
|
||||
return queryPageUser(params, userName, 1, sortOrder, sortField);
|
||||
} else if (containsd) {
|
||||
//地理学科
|
||||
return queryPageUser(params, userName, 4, sortOrder, sortField);
|
||||
} else if (containsl) {
|
||||
//历史
|
||||
return queryPageUser(params, userName, 7, sortOrder, sortField);
|
||||
} else if (containsz) {
|
||||
//政治
|
||||
return queryPageUser(params, userName, 8, sortOrder, sortField);
|
||||
}
|
||||
return null;
|
||||
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
package com.github.niefy.modules.h5.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.Query;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.h5.entity.*;
|
||||
import com.github.niefy.modules.h5.entity.dto.H5UserDTO;
|
||||
import com.github.niefy.modules.h5.mapper.*;
|
||||
|
@ -59,7 +58,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
|
||||
|
||||
@Override
|
||||
public R checkUser(H5User h5User) {
|
||||
public Result checkUser(H5User h5User) {
|
||||
/**
|
||||
* * 0.查询表opneid不存在则一定时第一次登录
|
||||
* * 1.输入账号以后查询数据库如果存在则保存openid到h5_user当中
|
||||
|
@ -73,12 +72,12 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
if (h5User1 == null) {
|
||||
// 该账号不存在
|
||||
// 直接返回错误信息,账号错误
|
||||
return R.error("账号错误");
|
||||
return Result.error("账号错误");
|
||||
}
|
||||
if ("0".equals(h5User1.getStatus().toString())) {
|
||||
// 该账号不存在
|
||||
// 直接返回错误信息,账号错误
|
||||
return R.error("账号被禁用,请联系管理员");
|
||||
return Result.error("账号被禁用,请联系管理员");
|
||||
}
|
||||
|
||||
// 检查四个身份
|
||||
|
@ -93,7 +92,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
h5User1.setOpenId(h5User.getOpenId());
|
||||
h5UserMapper.updateById(h5User1);
|
||||
} else {
|
||||
return R.error("微信已经和其他账号关联");
|
||||
return Result.error("微信已经和其他账号关联");
|
||||
}
|
||||
|
||||
if (h5AdminInfo != null) {
|
||||
|
@ -102,16 +101,16 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5AdminInfo);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/leaderShip");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.error("管理员账号还未申请通过!");
|
||||
return Result.error("管理员账号还未申请通过!");
|
||||
}
|
||||
//学生2
|
||||
case 3:
|
||||
// 如果openid空
|
||||
if (checker(h5User1.getOpenId())) {
|
||||
if (checkAcc(h5User)) {
|
||||
return R.error("微信已经和其他账号关联");
|
||||
return Result.error("微信已经和其他账号关联");
|
||||
}
|
||||
//设置openid
|
||||
h5User1.setOpenId(h5User.getOpenId());
|
||||
|
@ -123,7 +122,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("router", "/localStudent");
|
||||
map.put("status", "1"); //1是填写信息
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
LambdaQueryWrapper<H5Student> stuWrapper = new LambdaQueryWrapper<>();
|
||||
stuWrapper.eq(H5Student::getOpenId, h5User1.getOpenId());
|
||||
|
@ -136,10 +135,10 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5Student);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else if (h5Student != null && !(h5Student.getOpenId().equals(h5User.getOpenId()))) {
|
||||
// 如果openid和账号不对应
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
// 直接跳到信息填写的页面
|
||||
//返回openid和userid进去填写信息的页面
|
||||
|
@ -149,9 +148,9 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("status", "1"); //1是填写信息
|
||||
map.put("router", "/localStudent");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,7 +158,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
case 6:
|
||||
if (checker(h5User1.getOpenId())) {
|
||||
if (checkAcc(h5User)) {
|
||||
return R.error("微信已经和其他账号关联");
|
||||
return Result.error("微信已经和其他账号关联");
|
||||
}
|
||||
//设置openid
|
||||
h5User1.setOpenId(h5User.getOpenId());
|
||||
|
@ -171,7 +170,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("router", "/localTeacher");
|
||||
map.put("status", "1"); //1是填写信息
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
LambdaQueryWrapper<H5LocalTeacher> teachWrapper = new LambdaQueryWrapper<>();
|
||||
teachWrapper.eq(H5LocalTeacher::getOpenId, h5User1.getOpenId());
|
||||
|
@ -184,10 +183,10 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5LocalTeacher);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else if (h5LocalTeacher != null && !(h5LocalTeacher.getOpenId().equals(h5User.getOpenId()))) {
|
||||
// 如果openid和账号不对应
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
//TODO 有bug,如果已存在的用户当用户输错了账号以后该账号存在则直接条了该账号的填写信息的页面
|
||||
// 直接跳到信息填写的页面
|
||||
|
@ -198,9 +197,9 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("status", "1"); //1是填写信息
|
||||
map.put("router", "/localTeacher");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -209,7 +208,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
case 9:
|
||||
if (checker(h5User1.getOpenId())) {
|
||||
if (checkAcc(h5User)) {
|
||||
return R.error("微信已经和其他账号关联");
|
||||
return Result.error("微信已经和其他账号关联");
|
||||
}
|
||||
// 如果已经存在该用户
|
||||
LambdaQueryWrapper<H5WaiTeacher> h5WaiTeacherWrapper = new LambdaQueryWrapper<>();
|
||||
|
@ -228,7 +227,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5WaiTeacher);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
}
|
||||
//设置openid
|
||||
h5User1.setOpenId(h5User.getOpenId());
|
||||
|
@ -240,7 +239,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("router", "/notLocalTeacher");
|
||||
map.put("status", "1"); //1是填写信息
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
LambdaQueryWrapper<H5WaiTeacher> h5WaiTeacherWrapper = new LambdaQueryWrapper<>();
|
||||
h5WaiTeacherWrapper.eq(H5WaiTeacher::getOpenId, h5User1.getOpenId());
|
||||
|
@ -253,10 +252,10 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5WaiTeacher);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else if (h5WaiTeacher != null && !(h5WaiTeacher.getOpenId().equals(h5User.getOpenId()))) {
|
||||
// 如果openid和账号不对应
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
// h5WaiTeacher空的时候
|
||||
// 两种情况1.用户进入过页面但是没填写信息(正常放走),2.用户已经存在的情况下输入了别人的账号(有问题)
|
||||
|
@ -270,19 +269,19 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("userId", h5User1.getUserId());
|
||||
map.put("status", "1"); //1是填写信息
|
||||
map.put("router", "/notLocalTeacher");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.error("该账号已经被注册过");
|
||||
return Result.error("该账号已经被注册过");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return R.error("未知错误");
|
||||
return Result.error("未知错误");
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R AutocheckUser(String openid) {
|
||||
public Result AutocheckUser(String openid) {
|
||||
/**
|
||||
* 1.按照openid来查询当前用户的账号和身份
|
||||
* 2.如果账号存在则直接进入到主页面,如果不存在让用户输入信息
|
||||
|
@ -292,7 +291,7 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
H5User user = h5UserMapper.selectOne(h5UserQuery);
|
||||
if (user == null) {
|
||||
// 说明还没注册过-》把他引导去填写身份识别码
|
||||
return R.ok().put("router", "myIndex");
|
||||
return Result.ok().put("router", "myIndex");
|
||||
|
||||
}
|
||||
String userId = user.getUserId();
|
||||
|
@ -312,9 +311,9 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("user", h5AdminInfo);
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/leaderShip");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.ok().put("router", "myIndex");
|
||||
return Result.ok().put("router", "myIndex");
|
||||
}
|
||||
//学生2
|
||||
case 3:
|
||||
|
@ -329,9 +328,9 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("major", user.getMajorId());
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.ok().put("router", "myIndex");
|
||||
return Result.ok().put("router", "myIndex");
|
||||
}
|
||||
|
||||
|
||||
|
@ -349,9 +348,9 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("major", user.getMajorId());
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.ok().put("router", "myIndex");
|
||||
return Result.ok().put("router", "myIndex");
|
||||
}
|
||||
|
||||
|
||||
|
@ -370,12 +369,12 @@ public class H5UserServiceImpl extends ServiceImpl<H5UserMapper, H5User>
|
|||
map.put("major", user.getMajorId());
|
||||
map.put("status", "2"); //填写过信息
|
||||
map.put("router", "/mainPage");
|
||||
return R.ok(map);
|
||||
return Result.ok(map);
|
||||
} else {
|
||||
return R.ok().put("router", "myIndex");
|
||||
return Result.ok().put("router", "myIndex");
|
||||
}
|
||||
}
|
||||
return R.error("未知错误");
|
||||
return Result.error("未知错误");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@ import com.github.niefy.common.exception.RRException;
|
|||
import com.github.niefy.common.utils.ConfigConstant;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AliyunGroup;
|
||||
import com.github.niefy.common.validator.group.QcloudGroup;
|
||||
|
@ -48,10 +48,10 @@ public class SysOssController {
|
|||
@ApiOperation(value = "文件列表",notes = "对象存储管理的文件")
|
||||
@GetMapping("/list")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = sysOssService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -61,10 +61,10 @@ public class SysOssController {
|
|||
@GetMapping("/config")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
@ApiOperation(value = "云存储配置信息",notes = "首次使用前先管理后台新增配置")
|
||||
public R config() {
|
||||
public Result config() {
|
||||
CloudStorageConfig config = sysConfigService.getConfigObject(KEY, CloudStorageConfig.class);
|
||||
|
||||
return R.ok().put("config", config);
|
||||
return Result.ok().put("config", config);
|
||||
}
|
||||
|
||||
|
||||
|
@ -74,7 +74,7 @@ public class SysOssController {
|
|||
@PostMapping("/saveConfig")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
@ApiOperation(value = "保存云存储配置信息")
|
||||
public R saveConfig(@RequestBody CloudStorageConfig config) {
|
||||
public Result saveConfig(@RequestBody CloudStorageConfig config) {
|
||||
//校验类型
|
||||
ValidatorUtils.validateEntity(config);
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class SysOssController {
|
|||
|
||||
sysConfigService.updateValueByKey(KEY, JSON.toJSONString(config));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,7 +101,7 @@ public class SysOssController {
|
|||
@PostMapping("/upload")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
@ApiOperation(value = "上传文件到OSS")
|
||||
public R upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
public Result upload(@RequestParam("file") MultipartFile file) throws Exception {
|
||||
if (file.isEmpty()) {
|
||||
throw new RRException("上传文件不能为空");
|
||||
}
|
||||
|
@ -116,7 +116,7 @@ public class SysOssController {
|
|||
ossEntity.setCreateDate(new Date());
|
||||
sysOssService.save(ossEntity);
|
||||
|
||||
return R.ok().put("url", url);
|
||||
return Result.ok().put("url", url);
|
||||
}
|
||||
|
||||
|
||||
|
@ -126,10 +126,10 @@ public class SysOssController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys:oss:all")
|
||||
@ApiOperation(value = "删除文件",notes = "只删除记录,云端文件不会删除")
|
||||
public R delete(@RequestBody Long[] ids) {
|
||||
public Result delete(@RequestBody Long[] ids) {
|
||||
sysOssService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -2,10 +2,10 @@ package com.github.niefy.modules.sys.controller;
|
|||
|
||||
|
||||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.entity.SysConfigEntity;
|
||||
import com.github.niefy.modules.sys.service.SysConfigService;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -32,10 +32,10 @@ public class SysConfigController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("sys:config:list")
|
||||
@ApiOperation(value = "配置项列表",notes = "配置项需专业人员修改")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = sysConfigService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -45,10 +45,10 @@ public class SysConfigController extends AbstractController {
|
|||
@GetMapping("/info/{id}")
|
||||
@RequiresPermissions("sys:config:info")
|
||||
@ApiOperation(value = "配置详情",notes = "")
|
||||
public R info(@PathVariable("id") Long id) {
|
||||
public Result info(@PathVariable("id") Long id) {
|
||||
SysConfigEntity config = sysConfigService.getById(id);
|
||||
|
||||
return R.ok().put("config", config);
|
||||
return Result.ok().put("config", config);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,12 +58,12 @@ public class SysConfigController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("sys:config:save")
|
||||
@ApiOperation(value = "保存配置",notes = "")
|
||||
public R save(@RequestBody SysConfigEntity config) {
|
||||
public Result save(@RequestBody SysConfigEntity config) {
|
||||
ValidatorUtils.validateEntity(config);
|
||||
|
||||
sysConfigService.saveConfig(config);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,12 +73,12 @@ public class SysConfigController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys:config:update")
|
||||
@ApiOperation(value = "修改配置",notes = "")
|
||||
public R update(@RequestBody SysConfigEntity config) {
|
||||
public Result update(@RequestBody SysConfigEntity config) {
|
||||
ValidatorUtils.validateEntity(config);
|
||||
|
||||
sysConfigService.update(config);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,10 +88,10 @@ public class SysConfigController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys:config:delete")
|
||||
@ApiOperation(value = "删除配置",notes = "")
|
||||
public R delete(@RequestBody Long[] ids) {
|
||||
public Result delete(@RequestBody Long[] ids) {
|
||||
sysConfigService.deleteBatch(ids);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.github.niefy.modules.sys.controller;
|
||||
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.service.SysLogService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -34,10 +34,10 @@ public class SysLogController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("sys:log:list")
|
||||
@ApiOperation(value = "日志列表",notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = sysLogService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,26 +1,18 @@
|
|||
package com.github.niefy.modules.sys.controller;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.entity.SysUserEntity;
|
||||
import com.github.niefy.modules.sys.form.SysLoginForm;
|
||||
import com.github.niefy.modules.sys.service.SysCaptchaService;
|
||||
import com.github.niefy.modules.sys.service.SysUserService;
|
||||
import com.github.niefy.modules.sys.service.SysUserTokenService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import io.swagger.annotations.ApiParam;
|
||||
import org.apache.shiro.crypto.hash.Sha256Hash;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.imageio.ImageIO;
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
|
@ -72,12 +64,12 @@ public class SysLoginController extends AbstractController {
|
|||
|
||||
//账号不存在、密码错误
|
||||
if (user == null || !user.getPassword().equals(new Sha256Hash(form.getPassword(), user.getSalt()).toHex())) {
|
||||
return R.error("账号或密码不正确");
|
||||
return Result.error("账号或密码不正确");
|
||||
}
|
||||
|
||||
//账号锁定
|
||||
if (user.getStatus() == 0) {
|
||||
return R.error("账号已被锁定,请联系管理员");
|
||||
return Result.error("账号已被锁定,请联系管理员");
|
||||
}
|
||||
|
||||
//生成token,并保存到数据库
|
||||
|
@ -90,9 +82,9 @@ public class SysLoginController extends AbstractController {
|
|||
*/
|
||||
@PostMapping("/sys/logout")
|
||||
@ApiOperation(value = "退出登录",notes = "")
|
||||
public R logout() {
|
||||
public Result logout() {
|
||||
sysUserTokenService.logout(getUserId());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.github.niefy.modules.sys.controller;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.exception.RRException;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.entity.SysMenuEntity;
|
||||
import com.github.niefy.modules.sys.service.ShiroService;
|
||||
import com.github.niefy.modules.sys.service.SysMenuService;
|
||||
|
@ -36,10 +36,10 @@ public class SysMenuController extends AbstractController {
|
|||
*/
|
||||
@GetMapping("/nav")
|
||||
@ApiOperation(value = "管理后台导航菜单",notes = "不同登录用户结果不同")
|
||||
public R nav() {
|
||||
public Result nav() {
|
||||
List<SysMenuEntity> menuList = sysMenuService.getUserMenuList(getUserId());
|
||||
Set<String> permissions = shiroService.getUserPermissions(getUserId());
|
||||
return Objects.requireNonNull(R.ok().put("menuList", menuList)).put("permissions", permissions);
|
||||
return Objects.requireNonNull(Result.ok().put("menuList", menuList)).put("permissions", permissions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,7 +72,7 @@ public class SysMenuController extends AbstractController {
|
|||
@GetMapping("/select")
|
||||
@RequiresPermissions("sys:menu:select")
|
||||
@ApiOperation(value = "选择菜单",notes = "")
|
||||
public R select() {
|
||||
public Result select() {
|
||||
//查询列表数据
|
||||
List<SysMenuEntity> menuList = sysMenuService.queryNotButtonList();
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class SysMenuController extends AbstractController {
|
|||
root.setOpen(true);
|
||||
menuList.add(root);
|
||||
|
||||
return R.ok().put("menuList", menuList);
|
||||
return Result.ok().put("menuList", menuList);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,9 +93,9 @@ public class SysMenuController extends AbstractController {
|
|||
@GetMapping("/info/{menuId}")
|
||||
@RequiresPermissions("sys:menu:info")
|
||||
@ApiOperation(value = "菜单详情",notes = "")
|
||||
public R info(@PathVariable("menuId") Long menuId) {
|
||||
public Result info(@PathVariable("menuId") Long menuId) {
|
||||
SysMenuEntity menu = sysMenuService.getById(menuId);
|
||||
return R.ok().put("menu", menu);
|
||||
return Result.ok().put("menu", menu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,13 +105,13 @@ public class SysMenuController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("sys:menu:save")
|
||||
@ApiOperation(value = "保存菜单",notes = "")
|
||||
public R save(@RequestBody SysMenuEntity menu) {
|
||||
public Result save(@RequestBody SysMenuEntity menu) {
|
||||
//数据校验
|
||||
verifyForm(menu);
|
||||
|
||||
sysMenuService.save(menu);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,13 +121,13 @@ public class SysMenuController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys:menu:update")
|
||||
@ApiOperation(value = "修改菜单",notes = "")
|
||||
public R update(@RequestBody SysMenuEntity menu) {
|
||||
public Result update(@RequestBody SysMenuEntity menu) {
|
||||
//数据校验
|
||||
verifyForm(menu);
|
||||
|
||||
sysMenuService.updateById(menu);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -137,20 +137,20 @@ public class SysMenuController extends AbstractController {
|
|||
@PostMapping("/delete/{menuId}")
|
||||
@RequiresPermissions("sys:menu:delete")
|
||||
@ApiOperation(value = "删除菜单",notes = "")
|
||||
public R delete(@PathVariable("menuId") long menuId) {
|
||||
public Result delete(@PathVariable("menuId") long menuId) {
|
||||
if (menuId <= 31) {
|
||||
return R.error("系统菜单,不能删除");
|
||||
return Result.error("系统菜单,不能删除");
|
||||
}
|
||||
|
||||
//判断是否有子菜单或按钮
|
||||
List<SysMenuEntity> menuList = sysMenuService.queryListParentId(menuId);
|
||||
if (menuList.size() > 0) {
|
||||
return R.error("请先删除子菜单或按钮");
|
||||
return Result.error("请先删除子菜单或按钮");
|
||||
}
|
||||
|
||||
sysMenuService.delete(menuId);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.github.niefy.modules.sys.controller;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.modules.sys.entity.SysRoleEntity;
|
||||
import com.github.niefy.modules.sys.service.SysRoleMenuService;
|
||||
|
@ -37,7 +37,7 @@ public class SysRoleController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("sys:role:list")
|
||||
@ApiOperation(value = "角色列表",notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//如果不是超级管理员,则只查询自己创建的角色列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
|
@ -45,7 +45,7 @@ public class SysRoleController extends AbstractController {
|
|||
|
||||
PageUtils page = sysRoleService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -54,7 +54,7 @@ public class SysRoleController extends AbstractController {
|
|||
@GetMapping("/select")
|
||||
@RequiresPermissions("sys:role:select")
|
||||
@ApiOperation(value = "拥有的角色列表",notes = "")
|
||||
public R select() {
|
||||
public Result select() {
|
||||
Map<String, Object> map = new HashMap<>(4);
|
||||
|
||||
//如果不是超级管理员,则只查询自己所拥有的角色列表
|
||||
|
@ -63,7 +63,7 @@ public class SysRoleController extends AbstractController {
|
|||
}
|
||||
List<SysRoleEntity> list = sysRoleService.listByMap(map);
|
||||
|
||||
return R.ok().put("list", list);
|
||||
return Result.ok().put("list", list);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,14 +72,14 @@ public class SysRoleController extends AbstractController {
|
|||
@GetMapping("/info/{roleId}")
|
||||
@RequiresPermissions("sys:role:info")
|
||||
@ApiOperation(value = "角色详情",notes = "")
|
||||
public R info(@PathVariable("roleId") Long roleId) {
|
||||
public Result info(@PathVariable("roleId") Long roleId) {
|
||||
SysRoleEntity role = sysRoleService.getById(roleId);
|
||||
|
||||
//查询角色对应的菜单
|
||||
List<Long> menuIdList = sysRoleMenuService.queryMenuIdList(roleId);
|
||||
role.setMenuIdList(menuIdList);
|
||||
|
||||
return R.ok().put("role", role);
|
||||
return Result.ok().put("role", role);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -89,13 +89,13 @@ public class SysRoleController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("sys:role:save")
|
||||
@ApiOperation(value = "保存角色",notes = "")
|
||||
public R save(@RequestBody SysRoleEntity role) {
|
||||
public Result save(@RequestBody SysRoleEntity role) {
|
||||
ValidatorUtils.validateEntity(role);
|
||||
|
||||
role.setCreateUserId(getUserId());
|
||||
sysRoleService.saveRole(role);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -105,13 +105,13 @@ public class SysRoleController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys:role:update")
|
||||
@ApiOperation(value = "修改角色",notes = "")
|
||||
public R update(@RequestBody SysRoleEntity role) {
|
||||
public Result update(@RequestBody SysRoleEntity role) {
|
||||
ValidatorUtils.validateEntity(role);
|
||||
|
||||
role.setCreateUserId(getUserId());
|
||||
sysRoleService.update(role);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,9 +121,9 @@ public class SysRoleController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys:role:delete")
|
||||
@ApiOperation(value = "删除角色",notes = "")
|
||||
public R delete(@RequestBody Long[] roleIds) {
|
||||
public Result delete(@RequestBody Long[] roleIds) {
|
||||
sysRoleService.deleteBatch(roleIds);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.github.niefy.modules.sys.controller;
|
|||
import com.github.niefy.common.annotation.SysLog;
|
||||
import com.github.niefy.common.utils.Constant;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.validator.ValidatorUtils;
|
||||
import com.github.niefy.common.validator.group.AddGroup;
|
||||
import com.github.niefy.common.validator.group.UpdateGroup;
|
||||
|
@ -43,14 +43,14 @@ public class SysUserController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("sys:user:list")
|
||||
@ApiOperation(value = "用户列表",notes = "")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
//只有超级管理员,才能查看所有管理员列表
|
||||
if (getUserId() != Constant.SUPER_ADMIN) {
|
||||
params.put("createUserId", getUserId());
|
||||
}
|
||||
PageUtils page = sysUserService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -58,8 +58,8 @@ public class SysUserController extends AbstractController {
|
|||
*/
|
||||
@GetMapping("/info")
|
||||
@ApiOperation(value = "登录用户信息",notes = "")
|
||||
public R info() {
|
||||
return R.ok().put("user", getUser());
|
||||
public Result info() {
|
||||
return Result.ok().put("user", getUser());
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -68,7 +68,7 @@ public class SysUserController extends AbstractController {
|
|||
@SysLog("修改密码")
|
||||
@PostMapping("/password")
|
||||
@ApiOperation(value = "修改密码",notes = "")
|
||||
public R password(@RequestBody PasswordForm form) {
|
||||
public Result password(@RequestBody PasswordForm form) {
|
||||
Assert.hasText(form.getNewPassword(), "新密码不为能空");
|
||||
|
||||
//sha256加密
|
||||
|
@ -79,10 +79,10 @@ public class SysUserController extends AbstractController {
|
|||
//更新密码
|
||||
boolean flag = sysUserService.updatePassword(getUserId(), password, newPassword);
|
||||
if (!flag) {
|
||||
return R.error("原密码不正确");
|
||||
return Result.error("原密码不正确");
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -91,14 +91,14 @@ public class SysUserController extends AbstractController {
|
|||
@GetMapping("/info/{userId}")
|
||||
@RequiresPermissions("sys:user:info")
|
||||
@ApiOperation(value = "用户信息",notes = "")
|
||||
public R info(@PathVariable("userId") Long userId) {
|
||||
public Result info(@PathVariable("userId") Long userId) {
|
||||
SysUserEntity user = sysUserService.getById(userId);
|
||||
|
||||
//获取用户所属的角色列表
|
||||
List<Long> roleIdList = sysUserRoleService.queryRoleIdList(userId);
|
||||
user.setRoleIdList(roleIdList);
|
||||
|
||||
return R.ok().put("user", user);
|
||||
return Result.ok().put("user", user);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -108,13 +108,13 @@ public class SysUserController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("sys:user:save")
|
||||
@ApiOperation(value = "保存用户",notes = "")
|
||||
public R save(@RequestBody SysUserEntity user) {
|
||||
public Result save(@RequestBody SysUserEntity user) {
|
||||
ValidatorUtils.validateEntity(user, AddGroup.class);
|
||||
|
||||
user.setCreateUserId(getUserId());
|
||||
sysUserService.saveUser(user);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -124,13 +124,13 @@ public class SysUserController extends AbstractController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("sys:user:update")
|
||||
@ApiOperation(value = "修改用户",notes = "")
|
||||
public R update(@RequestBody SysUserEntity user) {
|
||||
public Result update(@RequestBody SysUserEntity user) {
|
||||
ValidatorUtils.validateEntity(user, UpdateGroup.class);
|
||||
|
||||
user.setCreateUserId(getUserId());
|
||||
sysUserService.update(user);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -140,16 +140,16 @@ public class SysUserController extends AbstractController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("sys:user:delete")
|
||||
@ApiOperation(value = "删除用户",notes = "")
|
||||
public R delete(@RequestBody Long[] userIds) {
|
||||
public Result delete(@RequestBody Long[] userIds) {
|
||||
if (Arrays.stream(userIds).anyMatch(id->id.intValue()==Constant.SUPER_ADMIN)) {
|
||||
return R.error("系统管理员不能删除");
|
||||
return Result.error("系统管理员不能删除");
|
||||
}
|
||||
if (Arrays.stream(userIds).anyMatch(id->getUserId().equals(id))) {
|
||||
return R.error("当前用户不能删除");
|
||||
return Result.error("当前用户不能删除");
|
||||
}
|
||||
|
||||
sysUserService.deleteBatch(userIds);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.github.niefy.modules.sys.oauth2;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.common.utils.HttpContextUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.http.HttpStatus;
|
||||
|
@ -51,7 +51,7 @@ public class OAuth2Filter extends AuthenticatingFilter {
|
|||
httpResponse.setHeader("Access-Control-Allow-Credentials", "true");
|
||||
httpResponse.setHeader("Access-Control-Allow-Origin", HttpContextUtils.getOrigin());
|
||||
|
||||
String json = JSON.toJSONString(R.error(HttpStatus.SC_UNAUTHORIZED, "invalid token"));
|
||||
String json = JSON.toJSONString(Result.error(HttpStatus.SC_UNAUTHORIZED, "invalid token"));
|
||||
|
||||
httpResponse.getWriter().print(json);
|
||||
|
||||
|
@ -70,9 +70,9 @@ public class OAuth2Filter extends AuthenticatingFilter {
|
|||
try {
|
||||
//处理登录失败的异常
|
||||
Throwable throwable = e.getCause() == null ? e : e.getCause();
|
||||
R r = R.error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage());
|
||||
Result result = Result.error(HttpStatus.SC_UNAUTHORIZED, throwable.getMessage());
|
||||
|
||||
String json = JSON.toJSONString(r);
|
||||
String json = JSON.toJSONString(result);
|
||||
httpResponse.getWriter().print(json);
|
||||
} catch (IOException e1) {
|
||||
logger.error("onLoginFailure", e1);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.github.niefy.modules.sys.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.entity.SysUserTokenEntity;
|
||||
|
||||
/**
|
||||
|
@ -14,7 +14,7 @@ public interface SysUserTokenService extends IService<SysUserTokenEntity> {
|
|||
* 生成token
|
||||
* @param userId 用户ID
|
||||
*/
|
||||
R createToken(long userId);
|
||||
Result createToken(long userId);
|
||||
|
||||
/**
|
||||
* 退出,修改token值
|
||||
|
|
|
@ -3,7 +3,7 @@ package com.github.niefy.modules.sys.service.impl;
|
|||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.niefy.modules.sys.oauth2.TokenGenerator;
|
||||
import com.github.niefy.modules.sys.service.SysUserTokenService;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.dao.SysUserTokenDao;
|
||||
import com.github.niefy.modules.sys.entity.SysUserTokenEntity;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
@ -19,7 +19,7 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
|
|||
|
||||
|
||||
@Override
|
||||
public R createToken(long userId) {
|
||||
public Result createToken(long userId) {
|
||||
//生成一个token
|
||||
String token = TokenGenerator.generateValue();
|
||||
|
||||
|
@ -48,7 +48,7 @@ public class SysUserTokenServiceImpl extends ServiceImpl<SysUserTokenDao, SysUse
|
|||
this.updateById(tokenEntity);
|
||||
}
|
||||
|
||||
return Objects.requireNonNull(R.ok().put("token", token)).put("expire", EXPIRE);
|
||||
return Objects.requireNonNull(Result.ok().put("token", token)).put("expire", EXPIRE);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.controller;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.Article;
|
||||
import com.github.niefy.modules.wx.enums.ArticleTypeEnum;
|
||||
import com.github.niefy.modules.wx.service.ArticleService;
|
||||
|
@ -33,9 +33,9 @@ public class ArticleController {
|
|||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperation(value = "文章详情",notes = "")
|
||||
public R getArticle(int articleId) {
|
||||
public Result getArticle(int articleId) {
|
||||
Article article = articleService.findById(articleId);
|
||||
return R.ok().put(article);
|
||||
return Result.ok().put(article);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -46,13 +46,13 @@ public class ArticleController {
|
|||
*/
|
||||
@GetMapping("/category")
|
||||
@ApiOperation(value = "目录信息",notes = "")
|
||||
public R getQuestions(String type, String category) {
|
||||
public Result getQuestions(String type, String category) {
|
||||
ArticleTypeEnum articleType = ArticleTypeEnum.of(type);
|
||||
if (articleType == null) {
|
||||
return R.error("文章类型有误");
|
||||
return Result.error("文章类型有误");
|
||||
}
|
||||
List<Article> articles = articleService.selectCategory(articleType, category);
|
||||
return R.ok().put(articles);
|
||||
return Result.ok().put(articles);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,18 +64,18 @@ public class ArticleController {
|
|||
*/
|
||||
@GetMapping("/search")
|
||||
@ApiOperation(value = "文章搜索",notes = "")
|
||||
public R getQuestions(String type,
|
||||
@RequestParam(required = false) String category,
|
||||
@RequestParam(required = false) String keywords) {
|
||||
public Result getQuestions(String type,
|
||||
@RequestParam(required = false) String category,
|
||||
@RequestParam(required = false) String keywords) {
|
||||
ArticleTypeEnum articleType = ArticleTypeEnum.of(type);
|
||||
if (articleType == null) {
|
||||
return R.error("文章类型有误");
|
||||
return Result.error("文章类型有误");
|
||||
}
|
||||
if (!StringUtils.hasText(keywords)) {
|
||||
return R.error("关键词不得为空");
|
||||
return Result.error("关键词不得为空");
|
||||
}
|
||||
List<Article> articles = articleService.search(articleType, category, keywords);
|
||||
return R.ok().put(articles);
|
||||
return Result.ok().put(articles);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@ import me.chanjar.weixin.common.bean.WxOAuth2UserInfo;
|
|||
import me.chanjar.weixin.common.bean.oauth2.WxOAuth2AccessToken;
|
||||
import me.chanjar.weixin.common.error.WxErrorException;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
import me.chanjar.weixin.mp.bean.result.WxMpUser;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -48,8 +47,8 @@ public class WxAuthController {
|
|||
@PostMapping("/codeToOpenid")
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "网页登录-code换取openid",notes = "scope为snsapi_base")
|
||||
public R codeToOpenid(HttpServletRequest request, HttpServletResponse response,
|
||||
@CookieValue String appid, @RequestBody WxH5OuthrizeForm form) {
|
||||
public Result codeToOpenid(HttpServletRequest request, HttpServletResponse response,
|
||||
@CookieValue String appid, @RequestBody WxH5OuthrizeForm form) {
|
||||
try {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
WxOAuth2AccessToken token = wxMpService.getOAuth2Service().getAccessToken(form.getCode());
|
||||
|
@ -57,10 +56,10 @@ public class WxAuthController {
|
|||
CookieUtil.setCookie(response, "openid", openid, 365 * 24 * 60 * 60);
|
||||
String openidToken = MD5Util.getMd5AndSalt(openid);
|
||||
CookieUtil.setCookie(response, "openidToken", openidToken, 365 * 24 * 60 * 60);
|
||||
return R.ok().put(openid);
|
||||
return Result.ok().put(openid);
|
||||
} catch (WxErrorException e) {
|
||||
logger.error("code换取openid失败", e);
|
||||
return R.error(e.getError().getErrorMsg());
|
||||
return Result.error(e.getError().getErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,8 +74,8 @@ public class WxAuthController {
|
|||
@PostMapping("/codeToUserInfo")
|
||||
@CrossOrigin
|
||||
@ApiOperation(value = "网页登录-code换取用户信息",notes = "需scope为 snsapi_userinfo")
|
||||
public R codeToUserInfo(HttpServletRequest request, HttpServletResponse response,
|
||||
@CookieValue String appid, @RequestBody WxH5OuthrizeForm form) {
|
||||
public Result codeToUserInfo(HttpServletRequest request, HttpServletResponse response,
|
||||
@CookieValue String appid, @RequestBody WxH5OuthrizeForm form) {
|
||||
try {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
WxOAuth2AccessToken token = wxMpService.getOAuth2Service().getAccessToken(form.getCode());
|
||||
|
@ -85,10 +84,10 @@ public class WxAuthController {
|
|||
CookieUtil.setCookie(response, "openid", openid, 365 * 24 * 60 * 60);
|
||||
String openidToken = MD5Util.getMd5AndSalt(openid);
|
||||
CookieUtil.setCookie(response, "openidToken", openidToken, 365 * 24 * 60 * 60);
|
||||
return R.ok().put(new WxUser(userInfo,appid));
|
||||
return Result.ok().put(new WxUser(userInfo,appid));
|
||||
} catch (WxErrorException e) {
|
||||
logger.error("code换取用户信息失败", e);
|
||||
return R.error(e.getError().getErrorMsg());
|
||||
return Result.error(e.getError().getErrorMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,12 +101,12 @@ public class WxAuthController {
|
|||
*/
|
||||
@GetMapping("/getShareSignature")
|
||||
@ApiOperation(value = "获取微信分享的签名配置",notes = "微信公众号添加了js安全域名的网站才能加载微信分享")
|
||||
public R getShareSignature(HttpServletRequest request, HttpServletResponse response,@CookieValue String appid) throws WxErrorException {
|
||||
public Result getShareSignature(HttpServletRequest request, HttpServletResponse response, @CookieValue String appid) throws WxErrorException {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
// 1.拼接url(当前网页的URL,不包含#及其后面部分)
|
||||
String wxShareUrl = request.getHeader(Constant.WX_CLIENT_HREF_HEADER);
|
||||
if (!StringUtils.hasText(wxShareUrl)) {
|
||||
return R.error("header中缺少"+Constant.WX_CLIENT_HREF_HEADER+"参数,微信分享加载失败");
|
||||
return Result.error("header中缺少"+Constant.WX_CLIENT_HREF_HEADER+"参数,微信分享加载失败");
|
||||
}
|
||||
wxShareUrl = wxShareUrl.split("#")[0];
|
||||
Map<String, String> wxMap = new TreeMap<>();
|
||||
|
@ -129,6 +128,6 @@ public class WxAuthController {
|
|||
resMap.put("wxTimestamp", wxTimestamp);
|
||||
resMap.put("wxNoncestr", wxNoncestr);
|
||||
resMap.put("wxSignature", wxSignature);
|
||||
return R.ok().put(resMap);
|
||||
return Result.ok().put(resMap);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.controller;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.WxUser;
|
||||
import com.github.niefy.modules.wx.service.WxUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -30,9 +30,9 @@ public class WxUserController {
|
|||
|
||||
@GetMapping("/getUserInfo")
|
||||
@ApiOperation(value = "获取粉丝信息")
|
||||
public R getUserInfo(@CookieValue String appid,@CookieValue String openid){
|
||||
public Result getUserInfo(@CookieValue String appid, @CookieValue String openid){
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
WxUser wxUser = wxUserService.getById(openid);
|
||||
return R.ok().put(wxUser);
|
||||
return Result.ok().put(wxUser);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.controller;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.WxUser;
|
||||
import com.github.niefy.modules.wx.form.WxUserTaggingForm;
|
||||
import com.github.niefy.modules.wx.service.WxUserService;
|
||||
|
@ -30,44 +30,44 @@ public class WxUserTagsController {
|
|||
|
||||
@GetMapping("/userTags")
|
||||
@ApiOperation(value = "当前用户的标签")
|
||||
public R userTags(@CookieValue String appid,@CookieValue String openid){
|
||||
public Result userTags(@CookieValue String appid, @CookieValue String openid){
|
||||
if(openid==null){
|
||||
return R.error("none_openid");
|
||||
return Result.error("none_openid");
|
||||
}
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
WxUser wxUser = wxUserService.getById(openid);
|
||||
if(wxUser==null){
|
||||
wxUser=wxUserService.refreshUserInfo(openid,appid);
|
||||
if(wxUser==null) {
|
||||
return R.error("not_subscribed");
|
||||
return Result.error("not_subscribed");
|
||||
}
|
||||
}
|
||||
return R.ok().put(wxUser.getTagidList());
|
||||
return Result.ok().put(wxUser.getTagidList());
|
||||
}
|
||||
|
||||
@PostMapping("/tagging")
|
||||
@ApiOperation(value = "给用户绑定标签")
|
||||
public R tagging(@CookieValue String appid,@CookieValue String openid , @RequestBody WxUserTaggingForm form) {
|
||||
public Result tagging(@CookieValue String appid, @CookieValue String openid , @RequestBody WxUserTaggingForm form) {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
try {
|
||||
wxUserTagsService.tagging(form.getTagid(),openid);
|
||||
}catch (WxErrorException e){
|
||||
WxError error = e.getError();
|
||||
if(50005==error.getErrorCode()){//未关注公众号
|
||||
return R.error("not_subscribed");
|
||||
return Result.error("not_subscribed");
|
||||
}else {
|
||||
return R.error(error.getErrorMsg());
|
||||
return Result.error(error.getErrorMsg());
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/untagging")
|
||||
@ApiOperation(value = "解绑标签")
|
||||
public R untagging(@CookieValue String appid,@CookieValue String openid , @RequestBody WxUserTaggingForm form) throws WxErrorException {
|
||||
public Result untagging(@CookieValue String appid, @CookieValue String openid , @RequestBody WxUserTaggingForm form) throws WxErrorException {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
wxUserTagsService.untagging(form.getTagid(),openid);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.niefy.modules.wx.manage;
|
|||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.Article;
|
||||
import com.github.niefy.modules.wx.service.ArticleService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -12,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -35,10 +35,10 @@ public class ArticleManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:article:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@RequestParam Map<String, Object> params) {
|
||||
public Result list(@RequestParam Map<String, Object> params) {
|
||||
PageUtils page = articleService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -48,10 +48,10 @@ public class ArticleManageController {
|
|||
@GetMapping("/info/{id}")
|
||||
@RequiresPermissions("wx:article:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@PathVariable("id") Integer id) {
|
||||
public Result info(@PathVariable("id") Integer id) {
|
||||
Article article = articleService.getById(id);
|
||||
|
||||
return R.ok().put("article", article);
|
||||
return Result.ok().put("article", article);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,10 +60,10 @@ public class ArticleManageController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:article:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody Article article) {
|
||||
public Result save(@RequestBody Article article) {
|
||||
articleService.saveArticle(article);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,10 +72,10 @@ public class ArticleManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:article:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody Integer[] ids) {
|
||||
public Result delete(@RequestBody Integer[] ids) {
|
||||
articleService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.niefy.modules.wx.manage;
|
|||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.service.MsgReplyRuleService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
|
||||
import com.github.niefy.modules.wx.entity.MsgReplyRule;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,11 +38,11 @@ public class MsgReplyRuleManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:msgreplyrule:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params) {
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params) {
|
||||
params.put("appid",appid);
|
||||
PageUtils page = msgReplyRuleService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,10 +52,10 @@ public class MsgReplyRuleManageController {
|
|||
@GetMapping("/info/{ruleId}")
|
||||
@RequiresPermissions("wx:msgreplyrule:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@PathVariable("ruleId") Integer ruleId) {
|
||||
public Result info(@PathVariable("ruleId") Integer ruleId) {
|
||||
MsgReplyRule msgReplyRule = msgReplyRuleService.getById(ruleId);
|
||||
|
||||
return R.ok().put("msgReplyRule", msgReplyRule);
|
||||
return Result.ok().put("msgReplyRule", msgReplyRule);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,10 +64,10 @@ public class MsgReplyRuleManageController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:msgreplyrule:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody MsgReplyRule msgReplyRule) {
|
||||
public Result save(@RequestBody MsgReplyRule msgReplyRule) {
|
||||
msgReplyRuleService.save(msgReplyRule);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,10 +76,10 @@ public class MsgReplyRuleManageController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("wx:msgreplyrule:update")
|
||||
@ApiOperation(value = "修改")
|
||||
public R update(@RequestBody MsgReplyRule msgReplyRule) {
|
||||
public Result update(@RequestBody MsgReplyRule msgReplyRule) {
|
||||
msgReplyRuleService.updateById(msgReplyRule);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,10 +88,10 @@ public class MsgReplyRuleManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:msgreplyrule:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody Integer[] ruleIds) {
|
||||
public Result delete(@RequestBody Integer[] ruleIds) {
|
||||
msgReplyRuleService.removeByIds(Arrays.asList(ruleIds));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.niefy.modules.wx.manage;
|
|||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.MsgTemplate;
|
||||
import com.github.niefy.modules.wx.form.TemplateMsgBatchForm;
|
||||
|
||||
|
@ -18,7 +19,6 @@ import me.chanjar.weixin.common.error.WxErrorException;
|
|||
import com.github.niefy.modules.wx.service.MsgTemplateService;
|
||||
import com.github.niefy.modules.wx.service.TemplateMsgService;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -45,11 +45,11 @@ public class MsgTemplateManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:msgtemplate:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params) {
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params) {
|
||||
params.put("appid",appid);
|
||||
PageUtils page = msgTemplateService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -59,10 +59,10 @@ public class MsgTemplateManageController {
|
|||
@GetMapping("/info/{id}")
|
||||
@RequiresPermissions("wx:msgtemplate:info")
|
||||
@ApiOperation(value = "详情-通过ID")
|
||||
public R info(@PathVariable("id") Long id) {
|
||||
public Result info(@PathVariable("id") Long id) {
|
||||
MsgTemplate msgTemplate = msgTemplateService.getById(id);
|
||||
|
||||
return R.ok().put("msgTemplate", msgTemplate);
|
||||
return Result.ok().put("msgTemplate", msgTemplate);
|
||||
}
|
||||
/**
|
||||
* 信息
|
||||
|
@ -70,10 +70,10 @@ public class MsgTemplateManageController {
|
|||
@GetMapping("/getByName")
|
||||
@RequiresPermissions("wx:msgtemplate:info")
|
||||
@ApiOperation(value = "详情-通过名称")
|
||||
public R getByName( String name){
|
||||
public Result getByName(String name){
|
||||
MsgTemplate msgTemplate = msgTemplateService.selectByName(name);
|
||||
|
||||
return R.ok().put("msgTemplate", msgTemplate);
|
||||
return Result.ok().put("msgTemplate", msgTemplate);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -82,10 +82,10 @@ public class MsgTemplateManageController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:msgtemplate:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody MsgTemplate msgTemplate) {
|
||||
public Result save(@RequestBody MsgTemplate msgTemplate) {
|
||||
msgTemplateService.save(msgTemplate);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -94,10 +94,10 @@ public class MsgTemplateManageController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("wx:msgtemplate:update")
|
||||
@ApiOperation(value = "修改")
|
||||
public R update(@RequestBody MsgTemplate msgTemplate) {
|
||||
public Result update(@RequestBody MsgTemplate msgTemplate) {
|
||||
msgTemplateService.updateById(msgTemplate);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -106,10 +106,10 @@ public class MsgTemplateManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:msgtemplate:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody String[] ids) {
|
||||
public Result delete(@RequestBody String[] ids) {
|
||||
msgTemplateService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,10 +118,10 @@ public class MsgTemplateManageController {
|
|||
@PostMapping("/syncWxTemplate")
|
||||
@RequiresPermissions("wx:msgtemplate:save")
|
||||
@ApiOperation(value = "同步公众号模板")
|
||||
public R syncWxTemplate(@CookieValue String appid) throws WxErrorException {
|
||||
public Result syncWxTemplate(@CookieValue String appid) throws WxErrorException {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
msgTemplateService.syncWxTemplate(appid, wxMpService.getTemplateMsgService().getAllPrivateTemplate());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -131,10 +131,10 @@ public class MsgTemplateManageController {
|
|||
@PostMapping("/sendMsgBatch")
|
||||
@RequiresPermissions("wx:msgtemplate:save")
|
||||
@ApiOperation(value = "批量向用户发送模板消息",notes = "将消息发送给数据库中所有符合筛选条件的用户")
|
||||
public R sendMsgBatch(@CookieValue String appid,@RequestBody TemplateMsgBatchForm form) {
|
||||
public Result sendMsgBatch(@CookieValue String appid, @RequestBody TemplateMsgBatchForm form) {
|
||||
this.wxMpService.switchoverTo(appid);
|
||||
templateMsgService.sendMsgBatch(form, appid);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@ package com.github.niefy.modules.wx.manage;
|
|||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import me.chanjar.weixin.mp.api.WxMpService;
|
||||
|
@ -13,7 +14,6 @@ import org.springframework.web.bind.annotation.*;
|
|||
import com.github.niefy.modules.wx.entity.TemplateMsgLog;
|
||||
import com.github.niefy.modules.wx.service.TemplateMsgLogService;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -38,11 +38,11 @@ public class TemplateMsgLogManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:templatemsglog:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params) {
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params) {
|
||||
params.put("appid",appid);
|
||||
PageUtils page = templateMsgLogService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,10 +52,10 @@ public class TemplateMsgLogManageController {
|
|||
@GetMapping("/info/{logId}")
|
||||
@RequiresPermissions("wx:templatemsglog:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@CookieValue String appid,@PathVariable("logId") Integer logId) {
|
||||
public Result info(@CookieValue String appid, @PathVariable("logId") Integer logId) {
|
||||
TemplateMsgLog templateMsgLog = templateMsgLogService.getById(logId);
|
||||
|
||||
return R.ok().put("templateMsgLog", templateMsgLog);
|
||||
return Result.ok().put("templateMsgLog", templateMsgLog);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -64,10 +64,10 @@ public class TemplateMsgLogManageController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:templatemsglog:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@CookieValue String appid,@RequestBody TemplateMsgLog templateMsgLog) {
|
||||
public Result save(@CookieValue String appid, @RequestBody TemplateMsgLog templateMsgLog) {
|
||||
templateMsgLogService.save(templateMsgLog);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -76,10 +76,10 @@ public class TemplateMsgLogManageController {
|
|||
@PostMapping("/update")
|
||||
@RequiresPermissions("wx:templatemsglog:update")
|
||||
@ApiOperation(value = "修改")
|
||||
public R update(@CookieValue String appid,@RequestBody TemplateMsgLog templateMsgLog) {
|
||||
public Result update(@CookieValue String appid, @RequestBody TemplateMsgLog templateMsgLog) {
|
||||
templateMsgLogService.updateById(templateMsgLog);
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -88,10 +88,10 @@ public class TemplateMsgLogManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:templatemsglog:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@CookieValue String appid,@RequestBody Integer[] logIds) {
|
||||
public Result delete(@CookieValue String appid, @RequestBody Integer[] logIds) {
|
||||
templateMsgLogService.removeByIds(Arrays.asList(logIds));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.config.EventMessageListenerContainerConfig;
|
||||
import com.github.niefy.modules.wx.entity.WxAccount;
|
||||
import com.github.niefy.modules.wx.service.WxAccountService;
|
||||
|
@ -39,10 +39,10 @@ public class WxAccountManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:wxaccount:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(){
|
||||
public Result list(){
|
||||
List<WxAccount> list = wxAccountService.list();
|
||||
|
||||
return R.ok().put("list", list);
|
||||
return Result.ok().put("list", list);
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,9 +52,9 @@ public class WxAccountManageController {
|
|||
@GetMapping("/info/{appid}")
|
||||
@RequiresPermissions("wx:wxaccount:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@PathVariable("appid") String appid){
|
||||
public Result info(@PathVariable("appid") String appid){
|
||||
WxAccount wxAccount = wxAccountService.getById(appid);
|
||||
return R.ok().put("wxAccount", wxAccount);
|
||||
return Result.ok().put("wxAccount", wxAccount);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,10 +63,10 @@ public class WxAccountManageController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:wxaccount:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@RequestBody WxAccount wxAccount){
|
||||
public Result save(@RequestBody WxAccount wxAccount){
|
||||
wxAccountService.saveOrUpdateWxAccount(wxAccount);
|
||||
redisTemplate.convertAndSend(EventMessageListenerContainerConfig.WX_ACCOUNT_UPDATE, wxAccount.getAppid());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,10 +75,10 @@ public class WxAccountManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:wxaccount:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@RequestBody String[] appids){
|
||||
public Result delete(@RequestBody String[] appids){
|
||||
wxAccountService.removeByIds(Arrays.asList(appids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.form.MaterialFileDeleteForm;
|
||||
import com.github.niefy.modules.wx.service.WxAssetsService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -39,9 +39,9 @@ public class WxAssetsManageController {
|
|||
*/
|
||||
@GetMapping("/materialCount")
|
||||
@ApiOperation(value = "文件素材总数")
|
||||
public R materialCount(@CookieValue String appid) throws WxErrorException {
|
||||
public Result materialCount(@CookieValue String appid) throws WxErrorException {
|
||||
WxMpMaterialCountResult res = wxAssetsService.materialCount(appid);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,9 +52,9 @@ public class WxAssetsManageController {
|
|||
*/
|
||||
@GetMapping("/materialNewsInfo")
|
||||
@ApiOperation(value = "图文素材总数")
|
||||
public R materialNewsInfo(@CookieValue String appid,String mediaId) throws WxErrorException {
|
||||
public Result materialNewsInfo(@CookieValue String appid, String mediaId) throws WxErrorException {
|
||||
WxMpMaterialNews res = wxAssetsService.materialNewsInfo(appid,mediaId);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,10 +69,10 @@ public class WxAssetsManageController {
|
|||
@GetMapping("/materialFileBatchGet")
|
||||
@RequiresPermissions("wx:wxassets:list")
|
||||
@ApiOperation(value = "根据类别分页获取非图文素材列表")
|
||||
public R materialFileBatchGet(@CookieValue String appid,@RequestParam(defaultValue = "image") String type,
|
||||
@RequestParam(defaultValue = "1") int page) throws WxErrorException {
|
||||
public Result materialFileBatchGet(@CookieValue String appid, @RequestParam(defaultValue = "image") String type,
|
||||
@RequestParam(defaultValue = "1") int page) throws WxErrorException {
|
||||
WxMpMaterialFileBatchGetResult res = wxAssetsService.materialFileBatchGet(appid,type,page);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -85,9 +85,9 @@ public class WxAssetsManageController {
|
|||
@GetMapping("/materialNewsBatchGet")
|
||||
@RequiresPermissions("wx:wxassets:list")
|
||||
@ApiOperation(value = "分页获取图文素材列表")
|
||||
public R materialNewsBatchGet(@CookieValue String appid,@RequestParam(defaultValue = "1") int page) throws WxErrorException {
|
||||
public Result materialNewsBatchGet(@CookieValue String appid, @RequestParam(defaultValue = "1") int page) throws WxErrorException {
|
||||
WxMpMaterialNewsBatchGetResult res = wxAssetsService.materialNewsBatchGet(appid,page);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -100,12 +100,12 @@ public class WxAssetsManageController {
|
|||
@PostMapping("/materialNewsUpload")
|
||||
@RequiresPermissions("wx:wxassets:save")
|
||||
@ApiOperation(value = "添加图文永久素材")
|
||||
public R materialNewsUpload(@CookieValue String appid,@RequestBody List<WxMpDraftArticles> articles) throws WxErrorException {
|
||||
public Result materialNewsUpload(@CookieValue String appid, @RequestBody List<WxMpDraftArticles> articles) throws WxErrorException {
|
||||
if(articles.isEmpty()) {
|
||||
return R.error("图文列表不得为空");
|
||||
return Result.error("图文列表不得为空");
|
||||
}
|
||||
WxMpMaterialUploadResult res = wxAssetsService.materialNewsUpload(appid,articles);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -118,12 +118,12 @@ public class WxAssetsManageController {
|
|||
@PostMapping("/materialArticleUpdate")
|
||||
@RequiresPermissions("wx:wxassets:save")
|
||||
@ApiOperation(value = "修改图文素材文章")
|
||||
public R materialArticleUpdate(@CookieValue String appid,@RequestBody WxMpUpdateDraft form) throws WxErrorException {
|
||||
public Result materialArticleUpdate(@CookieValue String appid, @RequestBody WxMpUpdateDraft form) throws WxErrorException {
|
||||
if(form.getArticles()==null) {
|
||||
return R.error("文章不得为空");
|
||||
return Result.error("文章不得为空");
|
||||
}
|
||||
wxAssetsService.materialArticleUpdate(appid,form);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -139,13 +139,13 @@ public class WxAssetsManageController {
|
|||
@PostMapping("/materialFileUpload")
|
||||
@RequiresPermissions("wx:wxassets:save")
|
||||
@ApiOperation(value = "添加多媒体永久素材")
|
||||
public R materialFileUpload(@CookieValue String appid,MultipartFile file, String fileName, String mediaType) throws WxErrorException, IOException {
|
||||
public Result materialFileUpload(@CookieValue String appid, MultipartFile file, String fileName, String mediaType) throws WxErrorException, IOException {
|
||||
if (file == null) {
|
||||
return R.error("文件不得为空");
|
||||
return Result.error("文件不得为空");
|
||||
}
|
||||
|
||||
WxMpMaterialUploadResult res = wxAssetsService.materialFileUpload(appid,mediaType,fileName,file);
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -158,9 +158,9 @@ public class WxAssetsManageController {
|
|||
@PostMapping("/materialDelete")
|
||||
@RequiresPermissions("wx:wxassets:delete")
|
||||
@ApiOperation(value = "删除素材")
|
||||
public R materialDelete(@CookieValue String appid,@RequestBody MaterialFileDeleteForm form) throws WxErrorException {
|
||||
public Result materialDelete(@CookieValue String appid, @RequestBody MaterialFileDeleteForm form) throws WxErrorException {
|
||||
boolean res = wxAssetsService.materialDelete(appid,form.getMediaId());
|
||||
return R.ok().put(res);
|
||||
return Result.ok().put(res);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
@ -35,10 +35,10 @@ public class WxMenuManageController {
|
|||
*/
|
||||
@GetMapping("/getMenu")
|
||||
@ApiOperation(value = "获取公众号菜单")
|
||||
public R getMenu(@CookieValue String appid) throws WxErrorException {
|
||||
public Result getMenu(@CookieValue String appid) throws WxErrorException {
|
||||
wxMpService.switchoverTo(appid);
|
||||
WxMpMenu wxMpMenu = wxService.getMenuService().menuGet();
|
||||
return R.ok().put(wxMpMenu);
|
||||
return Result.ok().put(wxMpMenu);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -47,14 +47,14 @@ public class WxMenuManageController {
|
|||
@PostMapping("/updateMenu")
|
||||
@RequiresPermissions("wx:menu:save")
|
||||
@ApiOperation(value = "创建、更新菜单")
|
||||
public R updateMenu(@CookieValue String appid, @RequestBody WxMenu wxMenu) throws WxErrorException {
|
||||
public Result updateMenu(@CookieValue String appid, @RequestBody WxMenu wxMenu) throws WxErrorException {
|
||||
wxMpService.switchoverTo(appid);
|
||||
if (CollectionUtils.isNotEmpty(wxMenu.getButtons())) {
|
||||
wxService.getMenuService().menuCreate(wxMenu);
|
||||
} else {
|
||||
wxService.getMenuService().menuDelete();
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.WxMsg;
|
||||
import com.github.niefy.modules.wx.form.WxMsgReplyForm;
|
||||
import com.github.niefy.modules.wx.service.MsgReplyService;
|
||||
|
@ -37,11 +37,11 @@ public class WxMsgManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:wxmsg:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params){
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params){
|
||||
params.put("appid",appid);
|
||||
PageUtils page = wxMsgService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -51,10 +51,10 @@ public class WxMsgManageController {
|
|||
@GetMapping("/info/{id}")
|
||||
@RequiresPermissions("wx:wxmsg:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@CookieValue String appid,@PathVariable("id") Long id){
|
||||
public Result info(@CookieValue String appid, @PathVariable("id") Long id){
|
||||
WxMsg wxMsg = wxMsgService.getById(id);
|
||||
|
||||
return R.ok().put("wxMsg", wxMsg);
|
||||
return Result.ok().put("wxMsg", wxMsg);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,10 +63,10 @@ public class WxMsgManageController {
|
|||
@PostMapping("/reply")
|
||||
@RequiresPermissions("wx:wxmsg:save")
|
||||
@ApiOperation(value = "回复")
|
||||
public R reply(@CookieValue String appid,@RequestBody WxMsgReplyForm form){
|
||||
public Result reply(@CookieValue String appid, @RequestBody WxMsgReplyForm form){
|
||||
|
||||
msgReplyService.reply(form.getOpenid(),form.getReplyType(),form.getReplyContent());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -75,10 +75,10 @@ public class WxMsgManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:wxmsg:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@CookieValue String appid,@RequestBody Long[] ids){
|
||||
public Result delete(@CookieValue String appid, @RequestBody Long[] ids){
|
||||
wxMsgService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.form.WxQrCodeForm;
|
||||
import com.github.niefy.modules.wx.service.WxQrCodeService;
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.modules.wx.entity.WxQrCode;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
|
@ -40,10 +40,10 @@ public class WxQrCodeManageController {
|
|||
@PostMapping("/createTicket")
|
||||
@RequiresPermissions("wx:wxqrcode:save")
|
||||
@ApiOperation(value = "创建带参二维码ticket",notes = "ticket可以换取二维码图片")
|
||||
public R createTicket(@CookieValue String appid,@RequestBody WxQrCodeForm form) throws WxErrorException {
|
||||
public Result createTicket(@CookieValue String appid, @RequestBody WxQrCodeForm form) throws WxErrorException {
|
||||
wxMpService.switchoverTo(appid);
|
||||
WxMpQrCodeTicket ticket = wxQrCodeService.createQrCode(appid,form);
|
||||
return R.ok().put(ticket);
|
||||
return Result.ok().put(ticket);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -52,11 +52,11 @@ public class WxQrCodeManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:wxqrcode:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params) {
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params) {
|
||||
params.put("appid",appid);
|
||||
PageUtils page = wxQrCodeService.queryPage(params);
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
|
||||
|
@ -66,10 +66,10 @@ public class WxQrCodeManageController {
|
|||
@GetMapping("/info/{id}")
|
||||
@RequiresPermissions("wx:wxqrcode:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@CookieValue String appid,@PathVariable("id") Long id) {
|
||||
public Result info(@CookieValue String appid, @PathVariable("id") Long id) {
|
||||
WxQrCode wxQrCode = wxQrCodeService.getById(id);
|
||||
|
||||
return R.ok().put("wxQrCode", wxQrCode);
|
||||
return Result.ok().put("wxQrCode", wxQrCode);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -78,9 +78,9 @@ public class WxQrCodeManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:wxqrcode:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@CookieValue String appid,@RequestBody Long[] ids) {
|
||||
public Result delete(@CookieValue String appid, @RequestBody Long[] ids) {
|
||||
wxQrCodeService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.PageUtils;
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.wx.entity.WxUser;
|
||||
import com.github.niefy.modules.wx.service.WxUserService;
|
||||
import io.swagger.annotations.Api;
|
||||
|
@ -35,11 +35,11 @@ public class WxUserManageController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:wxuser:list")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid,@RequestParam Map<String, Object> params) {
|
||||
public Result list(@CookieValue String appid, @RequestParam Map<String, Object> params) {
|
||||
params.put("appid",appid);
|
||||
PageUtils page = new PageUtils(userService.queryPage(params));
|
||||
|
||||
return R.ok().put("page", page);
|
||||
return Result.ok().put("page", page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,9 +48,9 @@ public class WxUserManageController {
|
|||
@PostMapping("/listByIds")
|
||||
@RequiresPermissions("wx:wxuser:list")
|
||||
@ApiOperation(value = "列表-ID查询")
|
||||
public R listByIds(@CookieValue String appid,@RequestBody String[] openids){
|
||||
public Result listByIds(@CookieValue String appid, @RequestBody String[] openids){
|
||||
List<WxUser> users = userService.listByIds(Arrays.asList(openids));
|
||||
return R.ok().put(users);
|
||||
return Result.ok().put(users);
|
||||
}
|
||||
|
||||
|
||||
|
@ -60,10 +60,10 @@ public class WxUserManageController {
|
|||
@GetMapping("/info/{openid}")
|
||||
@RequiresPermissions("wx:wxuser:info")
|
||||
@ApiOperation(value = "详情")
|
||||
public R info(@CookieValue String appid,@PathVariable("openid") String openid) {
|
||||
public Result info(@CookieValue String appid, @PathVariable("openid") String openid) {
|
||||
WxUser wxUser = userService.getById(openid);
|
||||
|
||||
return R.ok().put("wxUser", wxUser);
|
||||
return Result.ok().put("wxUser", wxUser);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -72,10 +72,10 @@ public class WxUserManageController {
|
|||
@PostMapping("/syncWxUsers")
|
||||
@RequiresPermissions("wx:wxuser:save")
|
||||
@ApiOperation(value = "同步用户列表到数据库")
|
||||
public R syncWxUsers(@CookieValue String appid) {
|
||||
public Result syncWxUsers(@CookieValue String appid) {
|
||||
userService.syncWxUsers(appid);
|
||||
|
||||
return R.ok("任务已建立");
|
||||
return Result.ok("任务已建立");
|
||||
}
|
||||
|
||||
|
||||
|
@ -86,10 +86,10 @@ public class WxUserManageController {
|
|||
@PostMapping("/delete")
|
||||
@RequiresPermissions("wx:wxuser:delete")
|
||||
@ApiOperation(value = "删除")
|
||||
public R delete(@CookieValue String appid,@RequestBody String[] ids) {
|
||||
public Result delete(@CookieValue String appid, @RequestBody String[] ids) {
|
||||
userService.removeByIds(Arrays.asList(ids));
|
||||
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
package com.github.niefy.modules.wx.manage;
|
||||
|
||||
import com.github.niefy.common.utils.R;
|
||||
import com.github.niefy.common.utils.Result;
|
||||
import com.github.niefy.modules.sys.controller.AbstractController;
|
||||
import com.github.niefy.modules.wx.form.WxUserBatchTaggingForm;
|
||||
import com.github.niefy.modules.wx.form.WxUserTagForm;
|
||||
|
@ -32,9 +32,9 @@ public class WxUserTagsManageController extends AbstractController {
|
|||
@GetMapping("/list")
|
||||
@RequiresPermissions("wx:wxuser:info")
|
||||
@ApiOperation(value = "列表")
|
||||
public R list(@CookieValue String appid) throws WxErrorException {
|
||||
public Result list(@CookieValue String appid) throws WxErrorException {
|
||||
List<WxUserTag> wxUserTags = wxUserTagsService.getWxTags(appid);
|
||||
return R.ok().put("list",wxUserTags);
|
||||
return Result.ok().put("list",wxUserTags);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -43,14 +43,14 @@ public class WxUserTagsManageController extends AbstractController {
|
|||
@PostMapping("/save")
|
||||
@RequiresPermissions("wx:wxuser:save")
|
||||
@ApiOperation(value = "保存")
|
||||
public R save(@CookieValue String appid,@RequestBody WxUserTagForm form) throws WxErrorException{
|
||||
public Result save(@CookieValue String appid, @RequestBody WxUserTagForm form) throws WxErrorException{
|
||||
Long tagid = form.getId();
|
||||
if(tagid==null || tagid<=0){
|
||||
wxUserTagsService.creatTag(appid,form.getName());
|
||||
}else {
|
||||
wxUserTagsService.updateTag(appid,tagid,form.getName());
|
||||
}
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -59,12 +59,12 @@ public class WxUserTagsManageController extends AbstractController {
|
|||
@PostMapping("/delete/{tagid}")
|
||||
@RequiresPermissions("wx:wxuser:save")
|
||||
@ApiOperation(value = "删除标签")
|
||||
public R delete(@CookieValue String appid,@PathVariable("tagid") Long tagid) throws WxErrorException{
|
||||
public Result delete(@CookieValue String appid, @PathVariable("tagid") Long tagid) throws WxErrorException{
|
||||
if(tagid==null || tagid<=0){
|
||||
return R.error("标签ID不得为空");
|
||||
return Result.error("标签ID不得为空");
|
||||
}
|
||||
wxUserTagsService.deleteTag(appid,tagid);
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,10 +73,10 @@ public class WxUserTagsManageController extends AbstractController {
|
|||
@PostMapping("/batchTagging")
|
||||
@RequiresPermissions("wx:wxuser:save")
|
||||
@ApiOperation(value = "批量给用户打标签")
|
||||
public R batchTagging(@CookieValue String appid,@RequestBody WxUserBatchTaggingForm form) throws WxErrorException{
|
||||
public Result batchTagging(@CookieValue String appid, @RequestBody WxUserBatchTaggingForm form) throws WxErrorException{
|
||||
|
||||
wxUserTagsService.batchTagging(appid,form.getTagid(),form.getOpenidList());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
/**
|
||||
* 批量移除用户标签
|
||||
|
@ -84,18 +84,18 @@ public class WxUserTagsManageController extends AbstractController {
|
|||
@PostMapping("/batchUnTagging")
|
||||
@RequiresPermissions("wx:wxuser:save")
|
||||
@ApiOperation(value = "批量移除用户标签")
|
||||
public R batchUnTagging(@CookieValue String appid,@RequestBody WxUserBatchTaggingForm form) throws WxErrorException{
|
||||
public Result batchUnTagging(@CookieValue String appid, @RequestBody WxUserBatchTaggingForm form) throws WxErrorException{
|
||||
wxUserTagsService.batchUnTagging(appid,form.getTagid(),form.getOpenidList());
|
||||
return R.ok();
|
||||
return Result.ok();
|
||||
}
|
||||
|
||||
@DeleteMapping("/refresh")
|
||||
@RequiresPermissions("wx:wxuser:info")
|
||||
@ApiOperation(value = "刷新Tag【在本系统外更新了tag时使用】")
|
||||
public R refreshTagCache(@CookieValue String appid) throws WxErrorException {
|
||||
public Result refreshTagCache(@CookieValue String appid) throws WxErrorException {
|
||||
wxUserTagsService.refreshTagCache(appid, getUser());
|
||||
List<WxUserTag> wxUserTags = wxUserTagsService.getWxTags(appid);
|
||||
return R.ok().put("list", wxUserTags);
|
||||
return Result.ok().put("list", wxUserTags);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -110,4 +110,4 @@ public class WxAccountServiceImpl extends ServiceImpl<WxAccountMapper, WxAccount
|
|||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue