提交 f369ba1a authored 作者: yucaiwei's avatar yucaiwei

--no commit message

上级 2b903670
...@@ -44,8 +44,8 @@ public interface ForumMapper extends BaseMapper<Forum> { ...@@ -44,8 +44,8 @@ public interface ForumMapper extends BaseMapper<Forum> {
+ "<if test = 'isOnLine != null'>" + "<if test = 'isOnLine != null'>"
+ " AND s1.isOnLine = #{isOnLine} " + " AND s1.isOnLine = #{isOnLine} "
+ "</if>" + "</if>"
+ "<if test = '" + NOTBLANK + "(biginTime)'>" + "<if test = '" + NOTBLANK + "(beginTime)'>"
+ "and DATE_FORMAT(s1.releaseTime,'%Y-%m-%d') &gt;= #{biginTime} " + "and DATE_FORMAT(s1.releaseTime,'%Y-%m-%d') &gt;= #{beginTime} "
+ "</if>" + "</if>"
+ "<if test = '" + NOTBLANK + "(endTime)'>" + "<if test = '" + NOTBLANK + "(endTime)'>"
+ "and DATE_FORMAT(s1.releaseTime,'%Y-%m-%d') &lt;= #{endTime} " + "and DATE_FORMAT(s1.releaseTime,'%Y-%m-%d') &lt;= #{endTime} "
......
...@@ -51,6 +51,7 @@ public class ForumServiceImpl extends BaseServiceImpl<Forum, Integer> implements ...@@ -51,6 +51,7 @@ public class ForumServiceImpl extends BaseServiceImpl<Forum, Integer> implements
throw new ParameterValidateException(6, "必填参数不能为空"); throw new ParameterValidateException(6, "必填参数不能为空");
} }
BeanUtils.copyProperties(form, forum); BeanUtils.copyProperties(form, forum);
forum.setImgs(StringUtils.join(form.getImgList(), ","));
forum.setUserId(user.getUserId()); forum.setUserId(user.getUserId());
forum.setPhone(user.getPhone()); forum.setPhone(user.getPhone());
forum.setReleaseTime(new Date()); forum.setReleaseTime(new Date());
...@@ -70,9 +71,9 @@ public class ForumServiceImpl extends BaseServiceImpl<Forum, Integer> implements ...@@ -70,9 +71,9 @@ public class ForumServiceImpl extends BaseServiceImpl<Forum, Integer> implements
} }
forum.setId(form.getId()); forum.setId(form.getId());
forum.setTitle(form.getTitle()); forum.setTitle(form.getTitle());
form.setContent(form.getContent()); forum.setContent(form.getContent());
forum.setType(form.getType()); forum.setType(form.getType());
forum.setImgs(form.getImgs()); forum.setImgs(StringUtils.join(form.getImgList(), ","));
return mapper.updateByPrimaryKeySelective(forum) > 0; return mapper.updateByPrimaryKeySelective(forum) > 0;
} }
} }
......
...@@ -57,6 +57,8 @@ public class FgForumController { ...@@ -57,6 +57,8 @@ public class FgForumController {
@ApiOperation(value = "查看帖子详情及回复分页", notes = "查看评论详情及回复") @ApiOperation(value = "查看帖子详情及回复分页", notes = "查看评论详情及回复")
@GetMapping(value = SysUserRequestPath.GET) @GetMapping(value = SysUserRequestPath.GET)
public CallBack<FgForumDetailsVo> getById(Integer oid, PageParam pageParam) { public CallBack<FgForumDetailsVo> getById(Integer oid, PageParam pageParam) {
// 更新浏览量
service.updateBrowseNum(oid);
return CallBack.success(service.getById(oid, pageParam)); return CallBack.success(service.getById(oid, pageParam));
} }
......
...@@ -20,7 +20,7 @@ public interface FgForumMapper extends BaseMapper<Forum> { ...@@ -20,7 +20,7 @@ public interface FgForumMapper extends BaseMapper<Forum> {
* @date: 2019年4月10日 下午7:26:07 * @date: 2019年4月10日 下午7:26:07
*/ */
@Select("<script>" @Select("<script>"
+ "select id,userId,title,content,type,DATE_FORMAT(releaseTime,'%Y-%m-%d %H:%i') releaseTime,status,isOnLine,topStatus,fabulousNum,browseNum,imgs " + "select id,userId,title,content,type,DATE_FORMAT(releaseTime,'%Y-%m-%d %H:%i:%s') releaseTime,status,isOnLine,topStatus,fabulousNum,browseNum,imgs "
+ "FROM sys_Forum " + "FROM sys_Forum "
+ "where 1 = 1 and fatherId = 0 " + "where 1 = 1 and fatherId = 0 "
+ "<if test = 'type != null' >" + "<if test = 'type != null' >"
...@@ -43,7 +43,7 @@ public interface FgForumMapper extends BaseMapper<Forum> { ...@@ -43,7 +43,7 @@ public interface FgForumMapper extends BaseMapper<Forum> {
* @date: 2019年4月10日 下午6:24:21 * @date: 2019年4月10日 下午6:24:21
*/ */
@Select("<script>" @Select("<script>"
+ "select id,userId,userName,userImg,title,content,type,DATE_FORMAT(releaseTime,'%Y-%m-%d %H:%i') releaseTime,status,isOnLine,topStatus,name,fabulousNum,browseNum,userClass,fatherId,fatherName,mainId " + "select id,userId,userName,userImg,title,content,type,DATE_FORMAT(releaseTime,'%Y-%m-%d %H:%i:%s') releaseTime,status,isOnLine,topStatus,name,fabulousNum,browseNum,userClass,fatherId,fatherName,mainId "
+ "FROM sys_Forum " + "FROM sys_Forum "
+ "where 1 = 1 and mainId = #{mainId} " + "where 1 = 1 and mainId = #{mainId} "
+ "<if test = 'userId == null' >" + "<if test = 'userId == null' >"
......
...@@ -38,4 +38,13 @@ public interface FgForumService extends BaseService<Forum, Integer> { ...@@ -38,4 +38,13 @@ public interface FgForumService extends BaseService<Forum, Integer> {
* @date: 2019年1月22日 下午6:45:48 * @date: 2019年1月22日 下午6:45:48
*/ */
FgForumDetailsVo getById(Integer oid, PageParam pageParam); FgForumDetailsVo getById(Integer oid, PageParam pageParam);
/**
* 更新浏览量
* @param oid
* @return
* @author ycw
* @date: 2019年1月30日 下午3:19:54
*/
boolean updateBrowseNum(Integer oid);
} }
...@@ -17,11 +17,13 @@ import com.zrqx.core.enums.OnOffLineStatusEnum; ...@@ -17,11 +17,13 @@ import com.zrqx.core.enums.OnOffLineStatusEnum;
import com.zrqx.core.enums.sysuser.comment.CommentEnum; import com.zrqx.core.enums.sysuser.comment.CommentEnum;
import com.zrqx.core.enums.sysuser.comment.UserTypeEnum; import com.zrqx.core.enums.sysuser.comment.UserTypeEnum;
import com.zrqx.core.enums.sysuser.forum.ForumTypeEnum; import com.zrqx.core.enums.sysuser.forum.ForumTypeEnum;
import com.zrqx.core.exception.BusinessValidateException;
import com.zrqx.core.exception.LoginValidateException; import com.zrqx.core.exception.LoginValidateException;
import com.zrqx.core.exception.ParameterValidateException; import com.zrqx.core.exception.ParameterValidateException;
import com.zrqx.core.form.member.fg.permissions.LoginMemberInfo; import com.zrqx.core.form.member.fg.permissions.LoginMemberInfo;
import com.zrqx.core.form.sysuser.fg.forum.FgSaveForumForm; import com.zrqx.core.form.sysuser.fg.forum.FgSaveForumForm;
import com.zrqx.core.mapper.BaseMapper; import com.zrqx.core.mapper.BaseMapper;
import com.zrqx.core.model.resource.articlelibrary.ArticleLibrary;
import com.zrqx.core.model.sysuser.forum.Forum; import com.zrqx.core.model.sysuser.forum.Forum;
import com.zrqx.core.model.sysuser.forum.ForumAgree; import com.zrqx.core.model.sysuser.forum.ForumAgree;
import com.zrqx.core.service.BaseServiceImpl; import com.zrqx.core.service.BaseServiceImpl;
...@@ -64,6 +66,8 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer> ...@@ -64,6 +66,8 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer>
startPage(pageParam); startPage(pageParam);
List<FgForumListVo> list = mapper.pageForum(type, userId); List<FgForumListVo> list = mapper.pageForum(type, userId);
list.forEach(l -> { list.forEach(l -> {
// 时间截取
l.setReleaseTime(StringUtils.substring(l.getReleaseTime(), 0, 16));
// 设置回复数量 // 设置回复数量
String u = null; String u = null;
if(redisManage.isExistMember()){ if(redisManage.isExistMember()){
...@@ -222,6 +226,8 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer> ...@@ -222,6 +226,8 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer>
}); });
} }
vos.forEach(l -> { vos.forEach(l -> {
// 时间截取
l.setReleaseTime(StringUtils.substring(l.getReleaseTime(), 0, 16));
//对每条评论,判断是否已点赞 //对每条评论,判断是否已点赞
l.setIsAgree(Integer.parseInt(BooleanStatusEnum.NO.getCode())); l.setIsAgree(Integer.parseInt(BooleanStatusEnum.NO.getCode()));
// 评论或者回复是否是发布人 // 评论或者回复是否是发布人
...@@ -325,4 +331,26 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer> ...@@ -325,4 +331,26 @@ public class FgForumServiceImpl extends BaseServiceImpl<Forum, Integer>
return respage; return respage;
} }
/**
* 更新浏览量
* @param oid
* @return
* @author ycw
* @date: 2019年1月30日 下午3:19:54
*/
@Override
public boolean updateBrowseNum(Integer oid){
Forum forum = mapper.selectByPrimaryKey(oid);
if(forum == null){
throw new BusinessValidateException("此帖子不存在");
}
if(forum.getBrowseNum() == null ){
forum.setBrowseNum(50);
}
Integer num = forum.getBrowseNum();
num += 1;
forum.setBrowseNum(num);
mapper.updateByPrimaryKeySelective(forum);
return true;
}
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论