代码规范处理
This commit is contained in:
parent
b6bb103a39
commit
b081b6f23d
Binary file not shown.
Before Width: | Height: | Size: 154 KiB After Width: | Height: | Size: 196 KiB |
@ -35,8 +35,6 @@ public interface CommentService extends IService<CommentEntity> {
|
||||
|
||||
Integer getCountByTopicId(Integer id);
|
||||
|
||||
List<CommentEntity> getByPid(Long pid);
|
||||
|
||||
void deleteByAdmin(List<Long> longs);
|
||||
|
||||
Integer getCountByPostId(Integer id);
|
||||
|
@ -32,7 +32,9 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@ -171,6 +173,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
||||
|
||||
@Override
|
||||
public AppUserResponse getUserInfo(AppUserEntity user) {
|
||||
|
||||
AppUserResponse response = new AppUserResponse();
|
||||
BeanUtils.copyProperties(user, response);
|
||||
Integer follow = followService.getFollowCount(user.getUid());
|
||||
@ -212,6 +215,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
||||
public void cancelFollow(AddFollowForm request, AppUserEntity user) {
|
||||
followDao.cancelFollow(user.getUid(), request.getId());
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppPageUtils userFans(Integer currPage, Integer uid) {
|
||||
List<Integer> uidList = followService.getFansList(uid);
|
||||
@ -283,8 +287,7 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
||||
//授权(必填)
|
||||
String grant_type = "authorization_code";
|
||||
//https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&grant_type=authorization_code
|
||||
//1、向微信服务器 使用登录凭证 code 获取 session_key 和 openid
|
||||
//请求参数
|
||||
//向微信服务器 使用登录凭证 code 获取 session_key 和 openid
|
||||
String params = "appid=" + appId + "&secret=" + secret + "&js_code=" + form.getCode() + "&grant_type=" + grant_type;
|
||||
//发送请求
|
||||
String sr = HttpRequest.sendGet("https://api.weixin.qq.com/sns/jscode2session", params);
|
||||
@ -299,10 +302,10 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
|
||||
if (user.getStatus() == 1) {
|
||||
throw new LinfengException("该账户已被禁用");
|
||||
}
|
||||
//其他业务todo
|
||||
return user.getUid();
|
||||
} else {
|
||||
//新注册用户
|
||||
//注册
|
||||
AppUserEntity appUser = new AppUserEntity();
|
||||
appUser.setGender(0);
|
||||
appUser.setAvatar(form.getAvatar());
|
||||
|
@ -66,13 +66,6 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
|
||||
.eq(CommentEntity::getPostId, id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommentEntity> getByPid(Long pid) {
|
||||
return baseMapper.selectList(
|
||||
new LambdaQueryWrapper<CommentEntity>()
|
||||
.eq(CommentEntity::getPid, pid));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 管理端批量删除评论
|
||||
|
@ -13,25 +13,18 @@
|
||||
package io.linfeng.modules.admin.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.linfeng.common.exception.LinfengException;
|
||||
import io.linfeng.common.response.PostDetailResponse;
|
||||
import io.linfeng.common.response.PostListResponse;
|
||||
import io.linfeng.common.response.TopicDetailResponse;
|
||||
import io.linfeng.common.utils.*;
|
||||
import io.linfeng.modules.admin.entity.*;
|
||||
import io.linfeng.modules.admin.service.*;
|
||||
import io.linfeng.modules.app.entity.PostCollectionEntity;
|
||||
import io.linfeng.modules.app.entity.TopicAdminEntity;
|
||||
import io.linfeng.modules.app.entity.UserTopicEntity;
|
||||
import io.linfeng.modules.app.form.*;
|
||||
import io.linfeng.modules.app.service.*;
|
||||
import io.linfeng.modules.app.utils.LocalUser;
|
||||
import javafx.geometry.Pos;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -39,8 +32,6 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@ -63,8 +54,6 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
|
||||
@Autowired
|
||||
private DiscussService discussService;
|
||||
@Autowired
|
||||
private MessageService messageService;
|
||||
@Autowired
|
||||
private LocalUser localUser;
|
||||
@Autowired
|
||||
private FollowService followService;
|
||||
@ -116,7 +105,7 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void deleteByAdmin(List<Integer> ids) {
|
||||
|
||||
boolean remove = this.removeByIds(ids);
|
||||
@ -240,6 +229,7 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer addPost(AddPostForm request, AppUserEntity user) {
|
||||
if(user.getStatus()!=0){
|
||||
throw new LinfengException("您的账号已被禁用");
|
||||
|
@ -33,6 +33,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* APP登录接口
|
||||
*
|
||||
* @author linfeng
|
||||
* @date 2022/6/9 22:40
|
||||
*/
|
||||
@ -57,8 +58,6 @@ public class AppLoginController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 手机验证码登录
|
||||
*/
|
||||
@ -100,8 +99,6 @@ public class AppLoginController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Login
|
||||
@GetMapping("/userInfo")
|
||||
@ApiOperation("获取用户信息")
|
||||
@ -121,7 +118,6 @@ public class AppLoginController {
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Login
|
||||
@PostMapping("/addFollow")
|
||||
@ApiOperation("关注用户")
|
||||
@ -138,6 +134,7 @@ public class AppLoginController {
|
||||
appUserService.cancelFollow(request, user);
|
||||
return R.ok("取消关注用户成功");
|
||||
}
|
||||
|
||||
@Login
|
||||
@GetMapping("/userFans")
|
||||
@ApiOperation("我的粉丝分页列表")
|
||||
|
@ -41,9 +41,6 @@ public class AppOssController {
|
||||
@Value("${qiniu.max-size}")
|
||||
private Long maxSize;
|
||||
|
||||
@Autowired
|
||||
private SysOssService sysOssService;
|
||||
|
||||
|
||||
@ApiOperation("上传文件")
|
||||
@PostMapping("/upload")
|
||||
@ -56,12 +53,6 @@ public class AppOssController {
|
||||
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
|
||||
String url = OSSFactory.build().uploadSuffix(file.getBytes(), suffix);
|
||||
|
||||
//保存文件信息
|
||||
SysOssEntity ossEntity = new SysOssEntity();
|
||||
ossEntity.setUrl(url);
|
||||
ossEntity.setCreateDate(new Date());
|
||||
sysOssService.save(ossEntity);
|
||||
|
||||
return R.ok().put("result", url);
|
||||
}
|
||||
|
||||
|
@ -138,7 +138,7 @@ public class AppPostController {
|
||||
ValidatorUtils.validateEntity(request);
|
||||
Integer id=postService.addPost(request,user);
|
||||
if(id==0){
|
||||
return R.error();
|
||||
return R.error("发帖失败");
|
||||
}
|
||||
return R.ok().put("result",id);
|
||||
}
|
||||
|
@ -14,7 +14,6 @@ package io.linfeng.modules.app.controller;
|
||||
import io.linfeng.common.utils.R;
|
||||
import io.linfeng.modules.admin.entity.SystemEntity;
|
||||
import io.linfeng.modules.admin.service.SystemService;
|
||||
import io.linfeng.modules.sys.service.SysConfigService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -34,7 +33,9 @@ public class AppSystemConfigController {
|
||||
|
||||
@GetMapping("/miniConfig")
|
||||
public R miniConfig(){
|
||||
SystemEntity system = systemService.lambdaQuery().eq(SystemEntity::getConfig, "miniapp").one();
|
||||
SystemEntity system = systemService.lambdaQuery()
|
||||
.eq(SystemEntity::getConfig, "miniapp")
|
||||
.one();
|
||||
return R.ok().put("logo",system.getIntro());
|
||||
}
|
||||
|
||||
|
@ -55,8 +55,9 @@ public class CommentThumbsServiceImpl extends ServiceImpl<CommentThumbsDao, Comm
|
||||
|
||||
@Override
|
||||
public Integer getThumbsCount(Long id) {
|
||||
Integer count = this.lambdaQuery().eq(CommentThumbsEntity::getCId, id).count();
|
||||
return count;
|
||||
return this.lambdaQuery()
|
||||
.eq(CommentThumbsEntity::getCId, id)
|
||||
.count();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user