代码规范处理

This commit is contained in:
linfeng 2022-08-26 16:23:55 +08:00
parent b6bb103a39
commit b081b6f23d
10 changed files with 106 additions and 132 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

After

Width:  |  Height:  |  Size: 196 KiB

View File

@ -35,8 +35,6 @@ public interface CommentService extends IService<CommentEntity> {
Integer getCountByTopicId(Integer id); Integer getCountByTopicId(Integer id);
List<CommentEntity> getByPid(Long pid);
void deleteByAdmin(List<Long> longs); void deleteByAdmin(List<Long> longs);
Integer getCountByPostId(Integer id); Integer getCountByPostId(Integer id);

View File

@ -32,7 +32,9 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.*; import java.util.*;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@ -68,12 +70,12 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public PageUtils queryPage(Map<String, Object> params) { public PageUtils queryPage(Map<String, Object> params) {
QueryWrapper<AppUserEntity> queryWrapper=new QueryWrapper<>(); QueryWrapper<AppUserEntity> queryWrapper = new QueryWrapper<>();
//模糊查询 //模糊查询
String key = (String)params.get("key"); String key = (String) params.get("key");
if(!WechatUtil.isEmpty(key)){ if (!WechatUtil.isEmpty(key)) {
params.put("page","1");//如果是查询分页重置为第一页 params.put("page", "1");//如果是查询分页重置为第一页
queryWrapper.like("username", key).or().like("mobile",key); queryWrapper.like("username", key).or().like("mobile", key);
} }
queryWrapper.lambda().orderByDesc(AppUserEntity::getUid); queryWrapper.lambda().orderByDesc(AppUserEntity::getUid);
IPage<AppUserEntity> page = this.page( IPage<AppUserEntity> page = this.page(
@ -87,24 +89,24 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void ban(Integer id) { public void ban(Integer id) {
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus(); Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
if(status.equals(Constant.USER_BANNER)){ if (status.equals(Constant.USER_BANNER)) {
throw new LinfengException("该用户已被禁用"); throw new LinfengException("该用户已被禁用");
} }
this.lambdaUpdate() this.lambdaUpdate()
.set(AppUserEntity::getStatus,1) .set(AppUserEntity::getStatus, 1)
.eq(AppUserEntity::getUid,id) .eq(AppUserEntity::getUid, id)
.update(); .update();
} }
@Override @Override
public void openBan(Integer id) { public void openBan(Integer id) {
Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus(); Integer status = this.lambdaQuery().eq(AppUserEntity::getUid, id).one().getStatus();
if(status.equals(Constant.USER_NORMAL)){ if (status.equals(Constant.USER_NORMAL)) {
throw new LinfengException("该用户已解除禁用"); throw new LinfengException("该用户已解除禁用");
} }
this.lambdaUpdate() this.lambdaUpdate()
.set(AppUserEntity::getStatus,0) .set(AppUserEntity::getStatus, 0)
.eq(AppUserEntity::getUid,id) .eq(AppUserEntity::getUid, id)
.update(); .update();
} }
@ -126,31 +128,31 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public Integer smsLogin(SmsLoginForm form, HttpServletRequest request) { public Integer smsLogin(SmsLoginForm form, HttpServletRequest request) {
AppUserEntity appUserEntity = this.lambdaQuery().eq(AppUserEntity::getMobile, form.getMobile()).one(); AppUserEntity appUserEntity = this.lambdaQuery().eq(AppUserEntity::getMobile, form.getMobile()).one();
String codeKey="code_"+form.getMobile(); String codeKey = "code_" + form.getMobile();
String s = redisUtils.get(codeKey); String s = redisUtils.get(codeKey);
if(!s.equals(form.getCode())){ if (!s.equals(form.getCode())) {
throw new LinfengException("验证码错误"); throw new LinfengException("验证码错误");
} }
if(ObjectUtil.isNotNull(appUserEntity)){ if (ObjectUtil.isNotNull(appUserEntity)) {
//登录 //登录
if(appUserEntity.getStatus()==1){ if (appUserEntity.getStatus() == 1) {
throw new LinfengException("该账户已被禁用"); throw new LinfengException("该账户已被禁用");
} }
return appUserEntity.getUid(); return appUserEntity.getUid();
}else{ } else {
//注册 //注册
AppUserEntity appUser=new AppUserEntity(); AppUserEntity appUser = new AppUserEntity();
appUser.setMobile(form.getMobile()); appUser.setMobile(form.getMobile());
appUser.setGender(0); appUser.setGender(0);
appUser.setAvatar(Constant.DEAULT_HEAD); appUser.setAvatar(Constant.DEAULT_HEAD);
appUser.setUsername("LF_"+RandomUtil.randomNumbers(8)); appUser.setUsername("LF_" + RandomUtil.randomNumbers(8));
appUser.setCreateTime(DateUtil.nowDateTime()); appUser.setCreateTime(DateUtil.nowDateTime());
appUser.setUpdateTime(DateUtil.nowDateTime()); appUser.setUpdateTime(DateUtil.nowDateTime());
List<String> list=new ArrayList<>(); List<String> list = new ArrayList<>();
list.add("新人"); list.add("新人");
appUser.setTagStr(JSON.toJSONString(list)); appUser.setTagStr(JSON.toJSONString(list));
baseMapper.insert(appUser); baseMapper.insert(appUser);
AppUserEntity user=this.lambdaQuery().eq(AppUserEntity::getMobile,form.getMobile()).one(); AppUserEntity user = this.lambdaQuery().eq(AppUserEntity::getMobile, form.getMobile()).one();
return user.getUid(); return user.getUid();
} }
@ -160,22 +162,23 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public String sendSmsCode(SendCodeForm param) { public String sendSmsCode(SendCodeForm param) {
String code = RandomUtil.randomNumbers(6); String code = RandomUtil.randomNumbers(6);
String codeKey="code_"+param.getMobile(); String codeKey = "code_" + param.getMobile();
String s = redisUtils.get(codeKey); String s = redisUtils.get(codeKey);
if(ObjectUtil.isNotNull(s)){ if (ObjectUtil.isNotNull(s)) {
return s; return s;
} }
redisUtils.set(codeKey,code,60*5); redisUtils.set(codeKey, code, 60 * 5);
return code; return code;
} }
@Override @Override
public AppUserResponse getUserInfo(AppUserEntity user) { public AppUserResponse getUserInfo(AppUserEntity user) {
AppUserResponse response=new AppUserResponse();
BeanUtils.copyProperties(user,response); AppUserResponse response = new AppUserResponse();
Integer follow=followService.getFollowCount(user.getUid()); BeanUtils.copyProperties(user, response);
Integer fans=followService.getFans(user.getUid()); Integer follow = followService.getFollowCount(user.getUid());
Integer postNum=postService.getPostNumByUid(user.getUid()); Integer fans = followService.getFans(user.getUid());
Integer postNum = postService.getPostNumByUid(user.getUid());
response.setFans(fans); response.setFans(fans);
response.setPostNum(postNum); response.setPostNum(postNum);
response.setFollow(follow); response.setFollow(follow);
@ -184,23 +187,23 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void updateAppUserInfo(AppUserUpdateForm appUserUpdateForm, AppUserEntity user) { public void updateAppUserInfo(AppUserUpdateForm appUserUpdateForm, AppUserEntity user) {
if(!WechatUtil.isEmpty(appUserUpdateForm.getAvatar())){ if (!WechatUtil.isEmpty(appUserUpdateForm.getAvatar())) {
user.setAvatar(appUserUpdateForm.getAvatar()); user.setAvatar(appUserUpdateForm.getAvatar());
} }
baseMapper.updateById(user); baseMapper.updateById(user);
redisUtils.delete("userId:"+user.getUid()); redisUtils.delete("userId:" + user.getUid());
} }
@Override @Override
public void addFollow(AddFollowForm request, AppUserEntity user) { public void addFollow(AddFollowForm request, AppUserEntity user) {
if(request.getId().equals(user.getUid())){ if (request.getId().equals(user.getUid())) {
throw new LinfengException("不能关注自己哦"); throw new LinfengException("不能关注自己哦");
} }
boolean isFollow=followService.isFollowOrNot(user.getUid(),request.getId()); boolean isFollow = followService.isFollowOrNot(user.getUid(), request.getId());
if(isFollow){ if (isFollow) {
throw new LinfengException("不要重复关注哦"); throw new LinfengException("不要重复关注哦");
} }
FollowEntity followEntity=new FollowEntity(); FollowEntity followEntity = new FollowEntity();
followEntity.setUid(user.getUid()); followEntity.setUid(user.getUid());
followEntity.setFollowUid(request.getId()); followEntity.setFollowUid(request.getId());
followEntity.setCreateTime(DateUtil.nowDateTime()); followEntity.setCreateTime(DateUtil.nowDateTime());
@ -210,11 +213,12 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public void cancelFollow(AddFollowForm request, AppUserEntity user) { public void cancelFollow(AddFollowForm request, AppUserEntity user) {
followDao.cancelFollow(user.getUid(),request.getId()); followDao.cancelFollow(user.getUid(), request.getId());
} }
@Override @Override
public AppPageUtils userFans(Integer currPage, Integer uid) { public AppPageUtils userFans(Integer currPage, Integer uid) {
List<Integer> uidList=followService.getFansList(uid); List<Integer> uidList = followService.getFansList(uid);
if (uidList.isEmpty()) { if (uidList.isEmpty()) {
return new AppPageUtils(null, 0, 10, currPage); return new AppPageUtils(null, 0, 10, currPage);
} }
@ -266,8 +270,8 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
@Override @Override
public AppUserInfoResponse findUserInfoById(Integer uid, AppUserEntity user) { public AppUserInfoResponse findUserInfoById(Integer uid, AppUserEntity user) {
AppUserEntity userEntity = this.getById(uid); AppUserEntity userEntity = this.getById(uid);
AppUserInfoResponse response=new AppUserInfoResponse(); AppUserInfoResponse response = new AppUserInfoResponse();
BeanUtils.copyProperties(userEntity,response); BeanUtils.copyProperties(userEntity, response);
return response; return response;
} }
@ -283,38 +287,37 @@ public class AppUserServiceImpl extends ServiceImpl<AppUserDao, AppUserEntity> i
//授权必填 //授权必填
String grant_type = "authorization_code"; String grant_type = "authorization_code";
//https://api.weixin.qq.com/sns/jscode2session?appid=APPID&secret=SECRET&js_code=JSCODE&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 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); String sr = HttpRequest.sendGet("https://api.weixin.qq.com/sns/jscode2session", params);
//解析相应内容转换成json对象 //解析相应内容转换成json对象
JSONObject json =JSON.parseObject(sr); JSONObject json = JSON.parseObject(sr);
//用户的唯一标识openId //用户的唯一标识openId
String openId = (String) json.get("openid"); String openId = (String) json.get("openid");
//根据openId获取数据库信息 判断用户是否登录 //根据openId获取数据库信息 判断用户是否登录
AppUserEntity user = this.lambdaQuery().eq(AppUserEntity::getOpenid, openId).one(); AppUserEntity user = this.lambdaQuery().eq(AppUserEntity::getOpenid, openId).one();
if(ObjectUtil.isNotNull(user)){ if (ObjectUtil.isNotNull(user)) {
//已登录用户 //已登录用户
if(user.getStatus()==1){ if (user.getStatus() == 1) {
throw new LinfengException("该账户已被禁用"); throw new LinfengException("该账户已被禁用");
} }
//其他业务todo
return user.getUid(); return user.getUid();
}else{ } else {
//新注册用户 //新注册用户
//注册 AppUserEntity appUser = new AppUserEntity();
AppUserEntity appUser=new AppUserEntity();
appUser.setGender(0); appUser.setGender(0);
appUser.setAvatar(form.getAvatar()); appUser.setAvatar(form.getAvatar());
appUser.setUsername(form.getUsername()); appUser.setUsername(form.getUsername());
appUser.setCreateTime(DateUtil.nowDateTime()); appUser.setCreateTime(DateUtil.nowDateTime());
appUser.setUpdateTime(DateUtil.nowDateTime()); appUser.setUpdateTime(DateUtil.nowDateTime());
appUser.setOpenid(openId); appUser.setOpenid(openId);
List<String> list=new ArrayList<>(); List<String> list = new ArrayList<>();
list.add("新人"); list.add("新人");
appUser.setTagStr(JSON.toJSONString(list)); appUser.setTagStr(JSON.toJSONString(list));
baseMapper.insert(appUser); baseMapper.insert(appUser);
AppUserEntity users=this.lambdaQuery().eq(AppUserEntity::getOpenid,openId).one(); AppUserEntity users = this.lambdaQuery().eq(AppUserEntity::getOpenid, openId).one();
return users.getUid(); return users.getUid();
} }
} }

View File

@ -66,13 +66,6 @@ public class CommentServiceImpl extends ServiceImpl<CommentDao, CommentEntity> i
.eq(CommentEntity::getPostId, id)); .eq(CommentEntity::getPostId, id));
} }
@Override
public List<CommentEntity> getByPid(Long pid) {
return baseMapper.selectList(
new LambdaQueryWrapper<CommentEntity>()
.eq(CommentEntity::getPid, pid));
}
/** /**
* 管理端批量删除评论 * 管理端批量删除评论

View File

@ -13,25 +13,18 @@
package io.linfeng.modules.admin.service.impl; package io.linfeng.modules.admin.service.impl;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON; 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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.linfeng.common.exception.LinfengException; import io.linfeng.common.exception.LinfengException;
import io.linfeng.common.response.PostDetailResponse; import io.linfeng.common.response.PostDetailResponse;
import io.linfeng.common.response.PostListResponse; import io.linfeng.common.response.PostListResponse;
import io.linfeng.common.response.TopicDetailResponse;
import io.linfeng.common.utils.*; import io.linfeng.common.utils.*;
import io.linfeng.modules.admin.entity.*; import io.linfeng.modules.admin.entity.*;
import io.linfeng.modules.admin.service.*; import io.linfeng.modules.admin.service.*;
import io.linfeng.modules.app.entity.PostCollectionEntity; 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.form.*;
import io.linfeng.modules.app.service.*; import io.linfeng.modules.app.service.*;
import io.linfeng.modules.app.utils.LocalUser; import io.linfeng.modules.app.utils.LocalUser;
import javafx.geometry.Pos;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -39,8 +32,6 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; 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.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
@ -63,8 +54,6 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
@Autowired @Autowired
private DiscussService discussService; private DiscussService discussService;
@Autowired @Autowired
private MessageService messageService;
@Autowired
private LocalUser localUser; private LocalUser localUser;
@Autowired @Autowired
private FollowService followService; private FollowService followService;
@ -116,7 +105,7 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
@Override @Override
@Transactional @Transactional(rollbackFor = Exception.class)
public void deleteByAdmin(List<Integer> ids) { public void deleteByAdmin(List<Integer> ids) {
boolean remove = this.removeByIds(ids); boolean remove = this.removeByIds(ids);
@ -240,6 +229,7 @@ public class PostServiceImpl extends ServiceImpl<PostDao, PostEntity> implements
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public Integer addPost(AddPostForm request, AppUserEntity user) { public Integer addPost(AddPostForm request, AppUserEntity user) {
if(user.getStatus()!=0){ if(user.getStatus()!=0){
throw new LinfengException("您的账号已被禁用"); throw new LinfengException("您的账号已被禁用");

View File

@ -33,6 +33,7 @@ import java.util.Map;
/** /**
* APP登录接口 * APP登录接口
*
* @author linfeng * @author linfeng
* @date 2022/6/9 22:40 * @date 2022/6/9 22:40
*/ */
@ -51,23 +52,21 @@ public class AppLoginController {
@PostMapping("/sendSmsCode") @PostMapping("/sendSmsCode")
@ApiOperation("发送验证码") @ApiOperation("发送验证码")
public R sendSmsCode(@RequestBody SendCodeForm param){ public R sendSmsCode(@RequestBody SendCodeForm param) {
String code=appUserService.sendSmsCode(param); String code = appUserService.sendSmsCode(param);
return R.ok("测试阶段验证码:"+code); return R.ok("测试阶段验证码:" + code);
} }
/** /**
* 手机验证码登录 * 手机验证码登录
*/ */
@PostMapping("/smsLogin") @PostMapping("/smsLogin")
@ApiOperation("手机验证码登录") @ApiOperation("手机验证码登录")
public R smsLogin(@RequestBody SmsLoginForm form, HttpServletRequest request){ public R smsLogin(@RequestBody SmsLoginForm form, HttpServletRequest request) {
//用户登录 //用户登录
Integer userId = appUserService.smsLogin(form,request); Integer userId = appUserService.smsLogin(form, request);
//生成token //生成token
String token = jwtUtils.generateToken(userId); String token = jwtUtils.generateToken(userId);
@ -84,7 +83,7 @@ public class AppLoginController {
*/ */
@PostMapping("/miniWxlogin") @PostMapping("/miniWxlogin")
@ApiOperation("手机验证码登录") @ApiOperation("手机验证码登录")
public R miniWxLogin(@RequestBody WxLoginForm form){ public R miniWxLogin(@RequestBody WxLoginForm form) {
//用户登录 //用户登录
Integer userId = appUserService.miniWxLogin(form); Integer userId = appUserService.miniWxLogin(form);
@ -100,14 +99,12 @@ public class AppLoginController {
} }
@Login @Login
@GetMapping("/userInfo") @GetMapping("/userInfo")
@ApiOperation("获取用户信息") @ApiOperation("获取用户信息")
public R userInfo(@LoginUser AppUserEntity user){ public R userInfo(@LoginUser AppUserEntity user) {
AppUserResponse response=appUserService.getUserInfo(user); AppUserResponse response = appUserService.getUserInfo(user);
return R.ok().put("result", response); return R.ok().put("result", response);
} }
@ -115,18 +112,17 @@ public class AppLoginController {
@Login @Login
@PostMapping("/userInfoEdit") @PostMapping("/userInfoEdit")
@ApiOperation("用户修改个人信息") @ApiOperation("用户修改个人信息")
public R userInfoEdit(@LoginUser AppUserEntity user, @RequestBody AppUserUpdateForm appUserUpdateForm){ public R userInfoEdit(@LoginUser AppUserEntity user, @RequestBody AppUserUpdateForm appUserUpdateForm) {
appUserService.updateAppUserInfo(appUserUpdateForm,user); appUserService.updateAppUserInfo(appUserUpdateForm, user);
return R.ok("修改成功"); return R.ok("修改成功");
} }
@Login @Login
@PostMapping("/addFollow") @PostMapping("/addFollow")
@ApiOperation("关注用户") @ApiOperation("关注用户")
public R addFollow(@LoginUser AppUserEntity user, @RequestBody AddFollowForm request){ public R addFollow(@LoginUser AppUserEntity user, @RequestBody AddFollowForm request) {
appUserService.addFollow(request,user); appUserService.addFollow(request, user);
return R.ok("关注用户成功"); return R.ok("关注用户成功");
} }
@ -134,25 +130,26 @@ public class AppLoginController {
@Login @Login
@PostMapping("/cancelFollow") @PostMapping("/cancelFollow")
@ApiOperation("取消关注用户") @ApiOperation("取消关注用户")
public R cancelFollow(@LoginUser AppUserEntity user, @RequestBody AddFollowForm request){ public R cancelFollow(@LoginUser AppUserEntity user, @RequestBody AddFollowForm request) {
appUserService.cancelFollow(request,user); appUserService.cancelFollow(request, user);
return R.ok("取消关注用户成功"); return R.ok("取消关注用户成功");
} }
@Login @Login
@GetMapping("/userFans") @GetMapping("/userFans")
@ApiOperation("我的粉丝分页列表") @ApiOperation("我的粉丝分页列表")
public R userFans(@RequestParam("page") Integer page,@LoginUser AppUserEntity user){ public R userFans(@RequestParam("page") Integer page, @LoginUser AppUserEntity user) {
AppPageUtils pages =appUserService.userFans(page,user.getUid()); AppPageUtils pages = appUserService.userFans(page, user.getUid());
return R.ok().put("result", pages); return R.ok().put("result", pages);
} }
@Login @Login
@GetMapping("/follow") @GetMapping("/follow")
@ApiOperation("我的关注分页列表") @ApiOperation("我的关注分页列表")
public R follow(@RequestParam("page") Integer page,@LoginUser AppUserEntity user){ public R follow(@RequestParam("page") Integer page, @LoginUser AppUserEntity user) {
AppPageUtils pages =appUserService.follow(page,user); AppPageUtils pages = appUserService.follow(page, user);
return R.ok().put("result", pages); return R.ok().put("result", pages);
} }
@ -160,9 +157,9 @@ public class AppLoginController {
@Login @Login
@PostMapping("/userInfoById") @PostMapping("/userInfoById")
@ApiOperation("用户个人主页信息") @ApiOperation("用户个人主页信息")
public R userInfoById(@RequestBody AppUserInfoForm request, @LoginUser AppUserEntity user){ public R userInfoById(@RequestBody AppUserInfoForm request, @LoginUser AppUserEntity user) {
AppUserInfoResponse response=appUserService.findUserInfoById(request.getUid(),user); AppUserInfoResponse response = appUserService.findUserInfoById(request.getUid(), user);
return R.ok().put("result",response); return R.ok().put("result", response);
} }
} }

View File

@ -41,9 +41,6 @@ public class AppOssController {
@Value("${qiniu.max-size}") @Value("${qiniu.max-size}")
private Long maxSize; private Long maxSize;
@Autowired
private SysOssService sysOssService;
@ApiOperation("上传文件") @ApiOperation("上传文件")
@PostMapping("/upload") @PostMapping("/upload")
@ -56,12 +53,6 @@ public class AppOssController {
String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")); String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("."));
String url = OSSFactory.build().uploadSuffix(file.getBytes(), suffix); 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); return R.ok().put("result", url);
} }

View File

@ -138,7 +138,7 @@ public class AppPostController {
ValidatorUtils.validateEntity(request); ValidatorUtils.validateEntity(request);
Integer id=postService.addPost(request,user); Integer id=postService.addPost(request,user);
if(id==0){ if(id==0){
return R.error(); return R.error("发帖失败");
} }
return R.ok().put("result",id); return R.ok().put("result",id);
} }

View File

@ -14,7 +14,6 @@ package io.linfeng.modules.app.controller;
import io.linfeng.common.utils.R; import io.linfeng.common.utils.R;
import io.linfeng.modules.admin.entity.SystemEntity; import io.linfeng.modules.admin.entity.SystemEntity;
import io.linfeng.modules.admin.service.SystemService; import io.linfeng.modules.admin.service.SystemService;
import io.linfeng.modules.sys.service.SysConfigService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
@ -34,7 +33,9 @@ public class AppSystemConfigController {
@GetMapping("/miniConfig") @GetMapping("/miniConfig")
public R 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()); return R.ok().put("logo",system.getIntro());
} }

View File

@ -55,8 +55,9 @@ public class CommentThumbsServiceImpl extends ServiceImpl<CommentThumbsDao, Comm
@Override @Override
public Integer getThumbsCount(Long id) { public Integer getThumbsCount(Long id) {
Integer count = this.lambdaQuery().eq(CommentThumbsEntity::getCId, id).count(); return this.lambdaQuery()
return count; .eq(CommentThumbsEntity::getCId, id)
.count();
} }
@Override @Override