Merge pull request 'unifiy_response for music/comment/friend/tag component' (#8) from unifiy_response into main

Reviewed-on: https://go.indie.cn/git/queyue-backend/luoo_parent/pulls/8
main
hechanggeng 1 year ago
commit 83bf6b065a

@ -3,9 +3,12 @@ package com.luoo.comment.controller;
import com.luoo.comment.pojo.Comment;
import com.luoo.comment.service.CommentService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
import api.StatusCode;
import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.redis.core.RedisTemplate;
@ -22,64 +25,62 @@ public class CommentController {
@Autowired
private RedisTemplate redisTemplate;
@RequestMapping(method = RequestMethod.GET)
public Result findAll(){
return new Result(true, StatusCode.OK,"",commentService.findAll());
@GetMapping
public Result<List<Comment>> findAll(){
return Result.success(commentService.findAll());
}
@RequestMapping(value = "/findByVolid/{volid}",method = RequestMethod.GET)
public Result findByVolid(@PathVariable String volid){
return new Result(true,StatusCode.OK,"查询成功",commentService.findByVolid(volid));
@GetMapping("/findByVolid/{volid}")
public Result<List<Comment>> findByVolid(@PathVariable String volid){
return Result.success(commentService.findByVolid(volid));
}
@RequestMapping(value = "/{commentId}",method = RequestMethod.GET)
public Result findById(@PathVariable String commentId) {
return new Result(true, StatusCode.OK,"",commentService.findById(commentId));
@GetMapping("/{commentId}")
public Result<Comment> findById(@PathVariable String commentId) {
return Result.success(commentService.findById(commentId));
}
@RequestMapping(method = RequestMethod.POST)
public Result save(@RequestBody Comment comment){
@PostMapping
public Result<Void> save(@RequestBody Comment comment){
commentService.save(comment);
return new Result(true,StatusCode.OK,"保存成功");
return Result.success();
}
@RequestMapping(value = "/{commentId}",method = RequestMethod.PUT)
public Result update(@PathVariable String commentId,@RequestBody Comment comment){
@PutMapping("/{commentId}")
public Result<Void> update(@PathVariable String commentId,@RequestBody Comment comment){
comment.set_id(commentId);
commentService.update(comment);
return new Result(true,StatusCode.OK,"修改成功");
return Result.success();
}
@RequestMapping(value = "/{commentId}",method = RequestMethod.DELETE)
public Result delete(@PathVariable String commentId){
@DeleteMapping("/{commentId}")
public Result<Void> delete(@PathVariable String commentId){
commentService.deleteById(commentId);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
@RequestMapping(value = "/{parentid}/{page}/{size}",method = RequestMethod.GET)
public Result findByParentid(@PathVariable String parentid,@PathVariable int page,@PathVariable int size){
@GetMapping("/{parentid}/{page}/{size}")
public Result<PageResult<Comment>> findByParentid(@PathVariable String parentid,@PathVariable int page,@PathVariable int size){
Page<Comment> pageData = commentService.findByParentId(parentid,page,size);
return new Result(true,StatusCode.OK,"查询成功",new PageResult<Comment>(pageData.getTotalElements(),pageData.getContent()));
return Result.success(new PageResult<Comment>(pageData.getTotalElements(),pageData.getContent()));
}
@RequestMapping(value = "/thumbup/{commentId}",method = RequestMethod.PUT)
@PutMapping("/thumbup/{commentId}")
public Result thumbup(@PathVariable String commentId){
String userid="111";
if (redisTemplate.opsForValue().get("thumbup_"+userid)!=null){
return new Result(true,StatusCode.REPERROR,"重复提交");
return Result.failed(StatusCode.COMMENT_REPEAT_SUBMIT);
}
commentService.thumbup(commentId);
redisTemplate.opsForValue().set("thumbup_"+userid,1);
return new Result(true,StatusCode.OK,"点赞成功");
return Result.success();
}
}

@ -9,22 +9,29 @@ public enum StatusCode implements IErrorCode {
FORBIDDEN(403, "没有相关权限"),
//user 模块错误码以10XXX不足5位补0;
USER_COMMON_FAILED(10000, "用户模块失败"),
USER_COMMON_FAILED(10000, "用户模块错误"),
USER_VERIFICATION_CODE_EXPIRED(10001, "验证码过期,请重新获取"),
USER_VERIFICATION_CODE_MISMATCH(10002, "验证码校验失败,请输入正确的验证码"),
USER_NAME_OR_PASSWORD_FAILED(10003, "用户名或密码错误"),
// music 模块错误码以20XXX不足5位补0;
MUSIC_COMMON_FAILED(20000, "歌曲模块错误"),
// comment 模块错误码以30XXX不足5位补0;
COMMENT_COMMON_FAILED(30000, "评论模块错误"),
COMMENT_REPEAT_SUBMIT(30001, "评论重复提交"),
// friend 模块错误码以40XXX不足5位补0;
FRIEND_COMMON_FAILED(40000, "交友模块错误"),
FRIEND_CAN_NOT_REPEAT_ADD_FRIEND(40001, "不能重复添加好友"),
FRIEND_CAN_NOT_REPEAT_ADD_NON_FRIEND(40002, "不能重复添加非好友"),
// tag 模块错误码以50XXX不足5位补0;
// music 模块错误码以60XXX不足5位补0;
// manage 模块错误码以70XXX不足5位补0;
MANAGE_COMMON_FAILED(70000, "管理模块失败");
TAG_COMMON_FAILED(50000, "标签模块错误"),
// recruit 模块错误码以50XXX不足5位补0;
RECRUIT_COMMON_FAILED(60000, "招聘模块错误");
private int code;
private String message;

@ -1,31 +0,0 @@
package entity;
import java.util.List;
public class PageResult<T> {
private Long total;
private List<T> rows;
public PageResult(Long total, List<T> rows) {
super();
this.total = total;
this.rows = rows;
}
public Long getTotal() {
return total;
}
public void setTotal(Long total) {
this.total = total;
}
public List<T> getRows() {
return rows;
}
public void setRows(List<T> rows) {
this.rows = rows;
}
}

@ -1,56 +0,0 @@
package entity;
public class Result {
private boolean flag;
private Integer code;
private String message;
private Object data;
public Result() {
}
public Result(boolean flag, Integer code, String message, Object data) {
super();
this.flag = flag;
this.code = code;
this.message = message;
this.data = data;
}
public Result(boolean flag, Integer code, String message) {
super();
this.flag = flag;
this.code = code;
this.message = message;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public Object getData() {
return data;
}
public void setData(Object data) {
this.data = data;
}
}

@ -1,62 +0,0 @@
package entity;
public class ResultVO<T>{
private boolean flag;
private Integer code;
private String message;
private T data;
public ResultVO() {
}
public ResultVO(boolean flag, Integer code, String message, T data) {
super();
this.flag = flag;
this.code = code;
this.message = message;
this.data = data;
}
public ResultVO(boolean flag, Integer code, String message) {
super();
this.flag = flag;
this.code = code;
this.message = message;
}
public boolean isFlag() {
return flag;
}
public void setFlag(boolean flag) {
this.flag = flag;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMessage() {
return message;
}
public void setMessage(String message) {
this.message = message;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
public static <T> ResultVO<T> success(T data){
return new ResultVO<>(true,200,"操作成功", data);
}
public static ResultVO<Void> success(String message){
return new ResultVO<>(true,200,message);
}
}

@ -1,16 +0,0 @@
package entity;
/**
*
*/
public class StatusCode {
public static final int OK=200;//成功
public static final int ERROR=20001;// 失败
public static final int LOGINERROR=20002;// 用户名或密码错误
public static final int ACCESSERROR=20003;// 无权访问
public static final int REPERROR=20009;// 重复提交
}

@ -3,12 +3,11 @@ package com.luoo.friend.client;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.PutMapping;
@FeignClient("luoo-user")
public interface UserClient {
@RequestMapping(value = "/user/{userid}/{friendid}/{x}",method = RequestMethod.PUT)
@PutMapping("/user/{userid}/{friendid}/{x}")
public void updatefanscountandfollowcount(@PathVariable String userid, @PathVariable String friendid, @PathVariable int x);
}

@ -3,14 +3,11 @@ package com.luoo.friend.controller;
import com.luoo.friend.client.UserClient;
import com.luoo.friend.service.FriendService;
import entity.Result;
import entity.StatusCode;
import api.Result;
import api.StatusCode;
import io.jsonwebtoken.Claims;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
@ -32,13 +29,13 @@ public class FriendController {
*
* @return
*/
@RequestMapping(value = "/like/{friendid}/{type}", method = RequestMethod.PUT)
public Result addFriend(@PathVariable String friendid, @PathVariable String type) {
@PutMapping("/like/{friendid}/{type}")
public Result<Void> addFriend(@PathVariable String friendid, @PathVariable String type) {
//验证是否登录并且拿到ID
Claims claims = (Claims) request.getAttribute("claims_user");
if (claims == null) {
return new Result(false, StatusCode.LOGINERROR, "权限不足");
return Result.unauthorized(null);
}
String userid = claims.getId();
//判断是添加好友还是非好友
@ -47,41 +44,41 @@ public class FriendController {
//添加好友
int flag = friendService.addFriend(userid,friendid);
if (flag == 0) {
return new Result(false, StatusCode.ERROR, "不能重复添加好友");
return Result.failed(StatusCode.FRIEND_CAN_NOT_REPEAT_ADD_FRIEND);
}
if (flag == 1) {
userClient.updatefanscountandfollowcount(userid,friendid,1);
return new Result(true, StatusCode.OK, "添加成功");
return Result.success();
}
} else if (type.equals("2")) {
//添加非好友
int flag = friendService.addNoFriend(userid,friendid);
if (flag == 0) {
return new Result(false, StatusCode.ERROR, "不能重复添加非好友");
return Result.failed(StatusCode.FRIEND_CAN_NOT_REPEAT_ADD_NON_FRIEND);
}
if (flag == 1) {
return new Result(true, StatusCode.OK, "添加成功");
return Result.success();
}
}
return new Result(false, StatusCode.ERROR, "参数异常");
return Result.failed(StatusCode.VALIDATE_FAILED);
} else {
return new Result(false, StatusCode.ERROR, "参数异常");
return Result.failed(StatusCode.VALIDATE_FAILED);
}
}
@RequestMapping(value = "/{friendid}", method = RequestMethod.DELETE)
public Result deleteFriend(@PathVariable String friendid){
@DeleteMapping("/{friendid}")
public Result<Void> deleteFriend(@PathVariable String friendid){
//验证是否登录并且拿到ID
Claims claims = (Claims) request.getAttribute("claims_user");
if (claims == null) {
return new Result(false, StatusCode.LOGINERROR, "权限不足");
return Result.unauthorized(null);
}
String userid = claims.getId();
friendService.deleteFriend(userid,friendid);
userClient.updatefanscountandfollowcount(userid,friendid,-1);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,12 +1,8 @@
package com.luoo.gathering.controller;
import entity.Result;
import entity.StatusCode;
import api.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*
*/
@ -15,8 +11,8 @@ public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
e.printStackTrace();
return new Result(false, StatusCode.ERROR, "执行出错");
public Result<Void> error(Exception e){
e.printStackTrace();
return Result.failed();
}
}

@ -1,4 +1,5 @@
package com.luoo.gathering.controller;
import java.util.List;
import java.util.Map;
@ -14,11 +15,12 @@ import org.springframework.web.bind.annotation.RestController;
import com.luoo.gathering.pojo.Gathering;
import com.luoo.gathering.service.GatheringService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
/**
*
*
* @author Administrator
*
*/
@ -29,80 +31,86 @@ public class GatheringController {
@Autowired
private GatheringService gatheringService;
/**
*
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",gatheringService.findAll());
@RequestMapping(method = RequestMethod.GET)
public Result<List<Gathering>> findAll() {
return Result.success(gatheringService.findAll());
}
/**
* ID
*
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",gatheringService.findById(id));
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Result<Gathering> findById(@PathVariable String id) {
return Result.success(gatheringService.findById(id));
}
/**
* +
*
* @param searchMap
* @param page
* @param size
* @param page
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
public Result<PageResult<Gathering>> findSearch(@RequestBody Map searchMap, @PathVariable int page,
@PathVariable int size) {
Page<Gathering> pageList = gatheringService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Gathering>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Gathering>(pageList.getTotalElements(), pageList.getContent()));
}
/**
*
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",gatheringService.findSearch(searchMap));
}
*
*
* @param searchMap
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap) {
return Result.success(gatheringService.findSearch(searchMap));
}
/**
*
*
* @param gathering
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Gathering gathering ){
@RequestMapping(method = RequestMethod.POST)
public Result<Void> add(@RequestBody Gathering gathering) {
gatheringService.add(gathering);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
*
* @param gathering
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Gathering gathering, @PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Result<Void> update(@RequestBody Gathering gathering, @PathVariable String id) {
gathering.setId(id);
gatheringService.update(gathering);
return new Result(true,StatusCode.OK,"修改成功");
gatheringService.update(gathering);
return Result.success();
}
/**
*
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public Result<Void> delete(@PathVariable String id) {
gatheringService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,6 +1,6 @@
package com.luoo.music.client;
import entity.Result;
import api.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@ -5,19 +5,13 @@ import java.util.Map;
import com.luoo.music.client.UserClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.luoo.music.pojo.Article;
import com.luoo.music.service.ArticleService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
/**
*
* @author Administrator
@ -34,33 +28,32 @@ public class ArticleController {
@Autowired
private UserClient userClient;
@RequestMapping(value = "/admin",method = RequestMethod.GET)
public Result findAdmin(){
Result result =userClient.findAll();
return result;
@GetMapping("/admin")
public Result findAdmin(){
return userClient.findAll();
}
@RequestMapping(value = "/examine/{articleId}",method = RequestMethod.PUT)
public Result examine (@PathVariable String articleId){
@PutMapping("/examine/{articleId}")
public Result<Void> examine (@PathVariable String articleId){
articleService.updateState(articleId);
return new Result(true,StatusCode.OK,"审核成功");
return Result.success();
}
@RequestMapping(value = "/thumbup/{articleId}",method = RequestMethod.PUT)
public Result thumbup (@PathVariable String articleId){
@PutMapping("/thumbup/{articleId}")
public Result<Void> thumbup (@PathVariable String articleId){
articleService.addThumbup(articleId);
return new Result(true,StatusCode.OK,"点赞成功");
return Result.success();
}
/**
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",articleService.findAll());
@GetMapping
public Result<List<Article>> findAll(){
return Result.success(articleService.findAll());
}
/**
@ -68,14 +61,14 @@ public class ArticleController {
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",articleService.findById(id));
@GetMapping("/{id}")
public Result<Article> findById(@PathVariable String id){
return Result.success(articleService.findById(id));
}
@RequestMapping(value = "/findByVolid/{volid}",method = RequestMethod.GET)
public Result findByVolid(@PathVariable String volid){
return new Result(true,StatusCode.OK,"查询成功",articleService.findByVolid(volid));
@GetMapping("/findByVolid/{volid}")
public Result<Article> findByVolid(@PathVariable String volid){
return Result.success(articleService.findByVolid(volid));
}
@ -86,10 +79,10 @@ public class ArticleController {
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@PostMapping("/search/{page}/{size}")
public Result<PageResult<Article>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Article> pageList = articleService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Article>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Article>(pageList.getTotalElements(), pageList.getContent()) );
}
/**
@ -97,40 +90,40 @@ public class ArticleController {
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",articleService.findSearch(searchMap));
@PostMapping("/search")
public Result<List<Article>> findSearch( @RequestBody Map searchMap){
return Result.success(articleService.findSearch(searchMap));
}
/**
*
* @param article
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Article article ){
@PostMapping
public Result<Void> add(@RequestBody Article article ){
articleService.add(article);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
* @param article
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Article article, @PathVariable String id ){
@PutMapping("/{id}")
public Result<Void> update(@RequestBody Article article, @PathVariable String id ){
article.setId(id);
articleService.update(article);
return new Result(true,StatusCode.OK,"修改成功");
return Result.success();
}
/**
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@DeleteMapping("/{id}")
public Result<Void> delete(@PathVariable String id ){
articleService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,12 +1,9 @@
package com.luoo.music.controller;
import entity.Result;
import entity.StatusCode;
import api.Result;
import api.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*
*/
@ -15,8 +12,8 @@ public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
e.printStackTrace();
return new Result(false, StatusCode.ERROR, "执行出错");
public Result<Void> error(Exception e){
e.printStackTrace();
return Result.failed(StatusCode.MUSIC_COMMON_FAILED);
}
}

@ -4,19 +4,14 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.luoo.music.pojo.Channel;
import com.luoo.music.service.ChannelService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
/**
*
* @author Administrator
@ -35,9 +30,9 @@ public class ChannelController {
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",channelService.findAll());
@GetMapping
public Result<List<Channel>> findAll(){
return Result.success(channelService.findAll());
}
/**
@ -45,9 +40,9 @@ public class ChannelController {
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",channelService.findById(id));
@GetMapping("/{id}")
public Result<Channel> findById(@PathVariable String id){
return Result.success(channelService.findById(id));
}
@ -58,10 +53,10 @@ public class ChannelController {
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@PostMapping("/search/{page}/{size}")
public Result<PageResult<Channel>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Channel> pageList = channelService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Channel>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Channel>(pageList.getTotalElements(), pageList.getContent()) );
}
/**
@ -69,40 +64,40 @@ public class ChannelController {
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",channelService.findSearch(searchMap));
@PostMapping("/search")
public Result<List<Channel>> findSearch( @RequestBody Map searchMap){
return Result.success(channelService.findSearch(searchMap));
}
/**
*
* @param channel
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Channel channel ){
@PostMapping
public Result<Void> add(@RequestBody Channel channel ){
channelService.add(channel);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
* @param channel
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Channel channel, @PathVariable String id ){
@PutMapping("/{id}")
public Result<Void> update(@RequestBody Channel channel, @PathVariable String id ){
channel.setId(id);
channelService.update(channel);
return new Result(true,StatusCode.OK,"修改成功");
return Result.success();
}
/**
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@DeleteMapping("/{id}")
public Result<Void> delete(@PathVariable String id ){
channelService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -4,19 +4,14 @@ import java.util.Map;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import com.luoo.music.pojo.Column;
import com.luoo.music.service.ColumnService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
/**
*
* @author Administrator
@ -35,9 +30,9 @@ public class ColumnController {
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",columnService.findAll());
@GetMapping
public Result<List<Column>> findAll(){
return Result.success(columnService.findAll());
}
/**
@ -45,9 +40,9 @@ public class ColumnController {
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",columnService.findById(id));
@GetMapping("/{id}")
public Result<Column> findById(@PathVariable String id){
return Result.success(columnService.findById(id));
}
@ -58,10 +53,10 @@ public class ColumnController {
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@PostMapping("/search/{page}/{size}")
public Result<PageResult<Column>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Column> pageList = columnService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Column>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Column>(pageList.getTotalElements(), pageList.getContent()) );
}
/**
@ -69,40 +64,40 @@ public class ColumnController {
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",columnService.findSearch(searchMap));
@PostMapping("/search")
public Result<List<Column>> findSearch( @RequestBody Map searchMap){
return Result.success(columnService.findSearch(searchMap));
}
/**
*
* @param column
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Column column ){
@PostMapping
public Result<Void> add(@RequestBody Column column ){
columnService.add(column);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
* @param column
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Column column, @PathVariable String id ){
@PutMapping("/{id}")
public Result<Void> update(@RequestBody Column column, @PathVariable String id ){
column.setId(id);
columnService.update(column);
return new Result(true,StatusCode.OK,"修改成功");
return Result.success();
}
/**
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@DeleteMapping("/{id}")
public Result<Void> delete(@PathVariable String id ){
columnService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -3,13 +3,11 @@ package com.luoo.music.controller;
import com.luoo.music.pojo.Article;
import com.luoo.music.pojo.Song;
import com.luoo.music.service.ArticleService;
import com.luoo.music.pojo.SongVO;
import com.luoo.music.service.SongService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.json.JsonParser;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
@ -26,23 +24,18 @@ public class SongController {
@Autowired
private SongService songService;
/**
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true, StatusCode.OK,"查询成功",songService.findAll());
@GetMapping
public Result<List<Song>> findAll(){
return Result.success(songService.findAll());
}
@RequestMapping(value = "/findByVolid/{volid}",method = RequestMethod.GET)
public Result findByVolid(@PathVariable String volid){
return new Result(true,StatusCode.OK,"查询成功",songService.findByVolid(volid));
@GetMapping("/findByVolid/{volid}")
public Result<List<SongVO>> findByVolid(@PathVariable String volid){
return Result.success(songService.findByVolid(volid));
}
/**
@ -50,9 +43,9 @@ public class SongController {
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",songService.findById(id));
@GetMapping("/{id}")
public Result<Song> findById(@PathVariable String id){
return Result.success(songService.findById(id));
}
@ -63,15 +56,15 @@ public class SongController {
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@PostMapping("/search/{page}/{size}")
public Result<PageResult<Song>> findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
Page<Song> pageList = songService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Song>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Song>(pageList.getTotalElements(), pageList.getContent()) );
}
@RequestMapping(value = "/init",method = RequestMethod.POST)
public Result init(@RequestBody Map map) {
@PostMapping("/init")
public Result<Void> init(@RequestBody Map map) {
List<Map> data = (List) map.get("data");
System.out.println(data.size());
Song song = new Song();
@ -112,7 +105,7 @@ public class SongController {
for (Article pojo : set) {
// articleService.add(pojo);
}
return new Result(true,StatusCode.OK,"init");
return Result.success();
}
/**
@ -120,9 +113,9 @@ public class SongController {
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",songService.findSearch(searchMap));
@PostMapping("/search")
public Result<List<Song>> findSearch( @RequestBody Map searchMap){
return Result.success(songService.findSearch(searchMap));
}
@ -130,30 +123,30 @@ public class SongController {
*
* @param song
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Song song){
@PostMapping
public Result<Void> add(@RequestBody Song song){
songService.add(song);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
* @param song
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Song song, @PathVariable String id ){
@PutMapping("/{id}")
public Result<Void> update(@RequestBody Song song, @PathVariable String id ){
song.setId(id);
songService.update(song);
return new Result(true,StatusCode.OK,"修改成功");
return Result.success();
}
/**
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@DeleteMapping("/{id}")
public Result<Void> delete(@PathVariable String id ){
songService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,12 +1,9 @@
package com.luoo.recruit.controller;
import entity.Result;
import entity.StatusCode;
import api.Result;
import api.StatusCode;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
*
*/
@ -15,8 +12,8 @@ public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
e.printStackTrace();
return new Result(false, StatusCode.ERROR, "执行出错");
public Result<Void> error(Exception e){
e.printStackTrace();
return Result.failed(StatusCode.RECRUIT_COMMON_FAILED);
}
}

@ -1,4 +1,5 @@
package com.luoo.recruit.controller;
import java.util.List;
import java.util.Map;
@ -14,10 +15,12 @@ import org.springframework.web.bind.annotation.RestController;
import com.luoo.recruit.pojo.Enterprise;
import com.luoo.recruit.service.EnterpriseService;
import entity.*;
import api.PageResult;
import api.Result;
/**
*
*
* @author Administrator
*
*/
@ -28,80 +31,86 @@ public class EnterpriseController {
@Autowired
private EnterpriseService enterpriseService;
/**
*
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",enterpriseService.findAll());
@RequestMapping(method = RequestMethod.GET)
public Result<List<Enterprise>> findAll() {
return Result.success(enterpriseService.findAll());
}
/**
* ID
*
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",enterpriseService.findById(id));
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Result<Enterprise> findById(@PathVariable String id) {
return Result.success(enterpriseService.findById(id));
}
/**
* +
*
* @param searchMap
* @param page
* @param size
* @param page
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
public Result<PageResult<Enterprise>> findSearch(@RequestBody Map searchMap, @PathVariable int page,
@PathVariable int size) {
Page<Enterprise> pageList = enterpriseService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Enterprise>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Enterprise>(pageList.getTotalElements(), pageList.getContent()));
}
/**
*
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",enterpriseService.findSearch(searchMap));
}
*
*
* @param searchMap
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
public Result<List<Enterprise>> findSearch(@RequestBody Map searchMap) {
return Result.success(enterpriseService.findSearch(searchMap));
}
/**
*
*
* @param enterprise
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Enterprise enterprise ){
@RequestMapping(method = RequestMethod.POST)
public Result<Void> add(@RequestBody Enterprise enterprise) {
enterpriseService.add(enterprise);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
*
* @param enterprise
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Enterprise enterprise, @PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Result<Void> update(@RequestBody Enterprise enterprise, @PathVariable String id) {
enterprise.setId(id);
enterpriseService.update(enterprise);
return new Result(true,StatusCode.OK,"修改成功");
enterpriseService.update(enterprise);
return Result.success();
}
/**
*
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public Result<Void> delete(@PathVariable String id) {
enterpriseService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,4 +1,5 @@
package com.luoo.recruit.controller;
import java.util.List;
import java.util.Map;
@ -14,11 +15,12 @@ import org.springframework.web.bind.annotation.RestController;
import com.luoo.recruit.pojo.Recruit;
import com.luoo.recruit.service.RecruitService;
import entity.PageResult;
import entity.Result;
import entity.StatusCode;
import api.PageResult;
import api.Result;
/**
*
*
* @author Administrator
*
*/
@ -29,80 +31,86 @@ public class RecruitController {
@Autowired
private RecruitService recruitService;
/**
*
*
* @return
*/
@RequestMapping(method= RequestMethod.GET)
public Result findAll(){
return new Result(true,StatusCode.OK,"查询成功",recruitService.findAll());
@RequestMapping(method = RequestMethod.GET)
public Result<List<Recruit>> findAll() {
return Result.success(recruitService.findAll());
}
/**
* ID
*
* @param id ID
* @return
*/
@RequestMapping(value="/{id}",method= RequestMethod.GET)
public Result findById(@PathVariable String id){
return new Result(true,StatusCode.OK,"查询成功",recruitService.findById(id));
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public Result<Recruit> findById(@PathVariable String id) {
return Result.success(recruitService.findById(id));
}
/**
* +
*
* @param searchMap
* @param page
* @param size
* @param page
* @param size
* @return
*/
@RequestMapping(value="/search/{page}/{size}",method=RequestMethod.POST)
public Result findSearch(@RequestBody Map searchMap , @PathVariable int page, @PathVariable int size){
@RequestMapping(value = "/search/{page}/{size}", method = RequestMethod.POST)
public Result<PageResult<Recruit>> findSearch(@RequestBody Map searchMap, @PathVariable int page,
@PathVariable int size) {
Page<Recruit> pageList = recruitService.findSearch(searchMap, page, size);
return new Result(true,StatusCode.OK,"查询成功", new PageResult<Recruit>(pageList.getTotalElements(), pageList.getContent()) );
return Result.success(new PageResult<Recruit>(pageList.getTotalElements(), pageList.getContent()));
}
/**
*
* @param searchMap
* @return
*/
@RequestMapping(value="/search",method = RequestMethod.POST)
public Result findSearch( @RequestBody Map searchMap){
return new Result(true,StatusCode.OK,"查询成功",recruitService.findSearch(searchMap));
}
*
*
* @param searchMap
* @return
*/
@RequestMapping(value = "/search", method = RequestMethod.POST)
public Result<List<Recruit>> findSearch(@RequestBody Map searchMap) {
return Result.success(recruitService.findSearch(searchMap));
}
/**
*
*
* @param recruit
*/
@RequestMapping(method=RequestMethod.POST)
public Result add(@RequestBody Recruit recruit ){
@RequestMapping(method = RequestMethod.POST)
public Result<Void> add(@RequestBody Recruit recruit) {
recruitService.add(recruit);
return new Result(true,StatusCode.OK,"增加成功");
return Result.success();
}
/**
*
*
* @param recruit
*/
@RequestMapping(value="/{id}",method= RequestMethod.PUT)
public Result update(@RequestBody Recruit recruit, @PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.PUT)
public Result<Void> update(@RequestBody Recruit recruit, @PathVariable String id) {
recruit.setId(id);
recruitService.update(recruit);
return new Result(true,StatusCode.OK,"修改成功");
recruitService.update(recruit);
return Result.success();
}
/**
*
*
* @param id
*/
@RequestMapping(value="/{id}",method= RequestMethod.DELETE)
public Result delete(@PathVariable String id ){
@RequestMapping(value = "/{id}", method = RequestMethod.DELETE)
public Result<Void> delete(@PathVariable String id) {
recruitService.deleteById(id);
return new Result(true,StatusCode.OK,"删除成功");
return Result.success();
}
}

@ -1,13 +1,12 @@
package com.luoo.tag.client;
import entity.Result;
import api.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.GetMapping;
@FeignClient("luoo-user")
public interface UserClient {
@RequestMapping(value = "/admin",method= RequestMethod.GET)
@GetMapping("/admin")
public Result findAll();
}

@ -1,8 +1,8 @@
package com.luoo.tag.controller;
import exception.BizException;
import entity.Result;
import entity.StatusCode;
import api.Result;
import api.StatusCode;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
@ -16,15 +16,15 @@ public class BaseExceptionHandler {
@ExceptionHandler(value = Exception.class)
@ResponseBody
public Result error(Exception e){
public Result<Void> error(Exception e){
log.error("执行出错", e);
return new Result(false, StatusCode.ERROR, "执行出错");
return Result.failed(StatusCode.TAG_COMMON_FAILED);
}
@ExceptionHandler(value = BizException.class)
@ResponseBody
public Result error(BizException e){
public Result<String> error(BizException e){
log.info("业务错误:{}", e.getMessage());
return new Result(false, StatusCode.ERROR, e.getMessage());
return Result.failed(StatusCode.TAG_COMMON_FAILED, e.getMessage());
}
}

@ -5,7 +5,7 @@ import com.luoo.tag.pojo.TagDTO;
import com.luoo.tag.pojo.TagQueryReq;
import com.luoo.tag.pojo.TagUpdateReq;
import com.luoo.tag.service.TagService;
import entity.ResultVO;
import api.Result;
import lombok.RequiredArgsConstructor;
import org.springframework.data.domain.Page;
import org.springframework.validation.annotation.Validated;
@ -32,23 +32,23 @@ public class TagController {
@ApiImplicitParam(name = "pageNum", value = "页码", required = true),
@ApiImplicitParam(name = "pageSize", value = "每页数", required = true) })
@GetMapping("/list")
public ResultVO<Page<TagDTO>> getById(@Validated TagQueryReq queryReq) {
return ResultVO.success(tagService.queryPage(queryReq));
public Result<Page<TagDTO>> getById(@Validated TagQueryReq queryReq) {
return Result.success(tagService.queryPage(queryReq));
}
@ApiOperation(value = "查询标签详情", notes = "查询标签详情")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@GetMapping("/{id}")
public ResultVO<TagDTO> getById(@PathVariable String id) {
return ResultVO.success(tagService.queryById(id));
public Result<TagDTO> getById(@PathVariable String id) {
return Result.success(tagService.queryById(id));
}
@ApiOperation(value = "新增标签信息", notes = "新增标签信息")
@ApiImplicitParams({ @ApiImplicitParam(name = "createReq", value = "创建参数", required = true) })
@PostMapping
public ResultVO<Void> create(@Validated @RequestBody TagCreateReq createReq) {
public Result<Void> create(@Validated @RequestBody TagCreateReq createReq) {
tagService.create(createReq);
return ResultVO.success("创建成功");
return Result.success();
}
@ApiOperation(value = "更新标签信息", notes = "更新标签信息")
@ -56,10 +56,10 @@ public class TagController {
@ApiImplicitParam(name = "updateReq", value = "更新参数", required = true),
@ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@PutMapping("/{id}")
public ResultVO<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
public Result<Void> update(@Validated @RequestBody TagUpdateReq updateReq, @PathVariable String id) {
updateReq.setId(id);
tagService.update(updateReq);
return ResultVO.success("更新成功");
return Result.success();
}
@ApiOperation(value = "更新标签状态", notes = "更新标签状态")
@ -67,16 +67,16 @@ public class TagController {
@ApiImplicitParam(name = "id", value = "标签ID", required = true),
@ApiImplicitParam(name = "state", value = "标签状态", required = true) })
@PutMapping("/status/{id}")
public ResultVO<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
public Result<Void> updateStatus(@PathVariable String id, @RequestParam Integer state) {
tagService.updateState(id, state);
return ResultVO.success("状态更新成功");
return Result.success();
}
@ApiOperation(value = "删除标签", notes = "删除标签")
@ApiImplicitParams({ @ApiImplicitParam(name = "id", value = "标签ID", required = true) })
@DeleteMapping("/{id}")
public ResultVO<Void> delete(@PathVariable String id) {
public Result<Void> delete(@PathVariable String id) {
tagService.delete(id);
return ResultVO.success("删除成功");
return Result.success();
}
}

@ -67,7 +67,7 @@ public class AdminController {
*
* @return
*/
@GetMapping("/list")
@GetMapping
public Result<List<Admin>> findAll(){
return Result.success(adminService.findAll());
}

@ -1,22 +1,18 @@
package com.luoo.user.service;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Selection;
import javax.servlet.http.HttpServletRequest;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.stereotype.Service;

@ -5,24 +5,16 @@ import java.util.concurrent.TimeUnit;
import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Expression;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;
import javax.persistence.criteria.Selection;
import javax.servlet.http.HttpServletRequest;
import entity.Result;
import entity.StatusCode;
import io.jsonwebtoken.Claims;
import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.amqp.rabbit.core.RabbitMessagingTemplate;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;

Loading…
Cancel
Save