mirror of
https://codeup.aliyun.com/67762337eccfc218f6110e0e/per-boe/java-servers.git
synced 2025-12-09 02:46:50 +08:00
回调的处理已经个人主页选择开关
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xboe.phase2.dao;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
import com.xboe.phase2.entity.GuestBook;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class GuestBookDao extends BaseDao<GuestBook> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.xboe.phase2.dao;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.BaseDao;
|
||||||
|
import com.xboe.phase2.entity.NoteInfo;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
|
@Repository
|
||||||
|
public class NoteInfoDao extends BaseDao<NoteInfo> {
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.xboe.phase2.entity;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.orm.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言
|
||||||
|
* */
|
||||||
|
@Data
|
||||||
|
@Entity
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Table(name = SysConstant.TABLE_PRE+"guest_book")
|
||||||
|
public class GuestBook extends BaseEntity {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1546791463472018751L;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
* */
|
||||||
|
@Column(name = "aid",length = 20)
|
||||||
|
private String aid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 留言内容
|
||||||
|
* */
|
||||||
|
@Column(name = "content",length = 200)
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复内容
|
||||||
|
* */
|
||||||
|
@Column(name = "replys",columnDefinition = "text")
|
||||||
|
private String replys;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 回复时间
|
||||||
|
* */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Column(name = "reply_time")
|
||||||
|
private LocalDateTime replyTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞数
|
||||||
|
* */
|
||||||
|
@Column(name = "praises")
|
||||||
|
private Integer praises;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,150 @@
|
|||||||
|
package com.xboe.phase2.entity;
|
||||||
|
|
||||||
|
import com.xboe.core.SysConstant;
|
||||||
|
import com.xboe.core.orm.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.persistence.Column;
|
||||||
|
import javax.persistence.Entity;
|
||||||
|
import javax.persistence.Table;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记
|
||||||
|
* */
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Entity
|
||||||
|
@Table(name = SysConstant.TABLE_PRE+"note_info")
|
||||||
|
public class NoteInfo extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**课程笔记*/
|
||||||
|
public static final int COURSE_TYPE=1;
|
||||||
|
|
||||||
|
/**上传的笔记*/
|
||||||
|
public static final int UPLODE_TYPE=2;
|
||||||
|
|
||||||
|
/**不公开*/
|
||||||
|
public static final int NOOPEN=1;
|
||||||
|
|
||||||
|
/**完全公开*/
|
||||||
|
public static final int OPEN=9;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记类型
|
||||||
|
* 1 课程笔记 2 上传的笔记
|
||||||
|
* 我发布的是1 我导入的是2,
|
||||||
|
* */
|
||||||
|
@Column(name = "type",length = 1)
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记内容
|
||||||
|
* */
|
||||||
|
@Column(name = "content",columnDefinition = "text")
|
||||||
|
private String content;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*课程播放点 秒
|
||||||
|
* 课程内容播放时间点,只限于音视频
|
||||||
|
* */
|
||||||
|
@Column(name = "play_time")
|
||||||
|
private Integer playTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程id
|
||||||
|
* */
|
||||||
|
@Column(name = "course_id",length = 20)
|
||||||
|
private String courseId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程内容id
|
||||||
|
* */
|
||||||
|
@Column(name = "content_id",length = 20)
|
||||||
|
private String contentId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程名称
|
||||||
|
* */
|
||||||
|
@Column(name = "course_name",length = 100)
|
||||||
|
private String courseName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否公开
|
||||||
|
* 1表不公开 9表完全公开
|
||||||
|
* */
|
||||||
|
@Column(name = "open_type",length = 1)
|
||||||
|
private Integer openType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记原文件
|
||||||
|
* */
|
||||||
|
@Column(name = "file_path",length = 200)
|
||||||
|
private String filePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记原文件名称
|
||||||
|
* */
|
||||||
|
@Column(name = "file_name",length = 100)
|
||||||
|
private String fileName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点赞数
|
||||||
|
* */
|
||||||
|
@Column(name = "praises")
|
||||||
|
private Integer praises;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 收藏数
|
||||||
|
* */
|
||||||
|
@Column(name = "favorites")
|
||||||
|
private Integer favorites;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 评论数
|
||||||
|
* */
|
||||||
|
@Column(name = "comments")
|
||||||
|
private Integer comments;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否自动保存
|
||||||
|
* */
|
||||||
|
@Column(name = "is_auto")
|
||||||
|
private Boolean isAuto;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 内容类型 1 txt 2 word image 3
|
||||||
|
* */
|
||||||
|
@Column(name = "content_type")
|
||||||
|
private Integer contentType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public NoteInfo(Integer type, String content, Integer playTime, String courseId, String contentId, String courseName, Integer openType, String filePath, String fileName, Integer praises, Integer favorites, Integer comments) {
|
||||||
|
this.type = type;
|
||||||
|
this.content = content;
|
||||||
|
this.playTime = playTime;
|
||||||
|
this.courseId = courseId;
|
||||||
|
this.contentId = contentId;
|
||||||
|
this.courseName = courseName;
|
||||||
|
this.openType = openType;
|
||||||
|
this.filePath = filePath;
|
||||||
|
this.fileName = fileName;
|
||||||
|
this.praises = praises;
|
||||||
|
this.favorites = favorites;
|
||||||
|
this.comments = comments;
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoteInfo() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public NoteInfo(String courseId, String courseName){
|
||||||
|
this.courseId=courseId;
|
||||||
|
this.courseName=courseName;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.dao.CommentsDao;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文章评论对点数的增加或者减少
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class ArticleCommentAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CommentsDao commentsDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.ArticleComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.dao.CommentsDao;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.transaction.Transactional;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 案例评论 对点数的增加或者减少
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class CaseCommentAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommentsDao commentsDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.CaseComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.dao.CommentsDao;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 课程评论对点数的增加和减少
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class CourseCommentAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
CommentsDao commentsDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.CourseComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.phase2.dao.GuestBookDao;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class GuestAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
GuestBookDao guestBookDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.Guest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
guestBookDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
guestBookDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.dao.CommentsDao;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记评论对点数的增加和减少
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class NoteCommentAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
CommentsDao commentsDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.NoteComment;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
commentsDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.xboe.school.impl;
|
||||||
|
|
||||||
|
import com.xboe.core.orm.FieldUpdateType;
|
||||||
|
import com.xboe.core.orm.UpdateBuilder;
|
||||||
|
import com.xboe.module.interaction.service.ICallbackAddHits;
|
||||||
|
import com.xboe.phase2.dao.NoteInfoDao;
|
||||||
|
import com.xboe.standard.enums.BoedxHitsField;
|
||||||
|
import com.xboe.standard.enums.BoedxResourceType;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 笔记 对点数的增加或者减少
|
||||||
|
* */
|
||||||
|
@Service
|
||||||
|
public class NoteInfoAddHitsImpl implements ICallbackAddHits {
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
NoteInfoDao noteInfoDao;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BoedxResourceType getType() {
|
||||||
|
return BoedxResourceType.NoteInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void increase(String id, BoedxHitsField field) {
|
||||||
|
noteInfoDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"+1", FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reduce(String id, BoedxHitsField field) {
|
||||||
|
noteInfoDao.updateMultiFieldById(id, UpdateBuilder.create(field.getField(),field.getField()+"-1",FieldUpdateType.EXPRESSION));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -387,6 +387,28 @@ public class UserApi extends ApiBaseController {
|
|||||||
return success(map);
|
return success(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 个人主页开或关
|
||||||
|
* */
|
||||||
|
@GetMapping("/show-home")
|
||||||
|
public JsonResponse<Boolean> showHome(String id,Boolean showHome){
|
||||||
|
if(StringUtil.isBlank(id)){
|
||||||
|
id=this.getCurrent().getAccountId();
|
||||||
|
}
|
||||||
|
if(StringUtil.isBlank(id)){
|
||||||
|
return badRequest("参数异常");
|
||||||
|
}
|
||||||
|
if(showHome==null){
|
||||||
|
return badRequest("请选择对应操作");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
service.updateShowHome(id, showHome);
|
||||||
|
return success(true);
|
||||||
|
} catch (Exception e){
|
||||||
|
return error("操作失败",e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -242,6 +242,12 @@ public class User extends IdEntity {
|
|||||||
@Column(name = "sign")
|
@Column(name = "sign")
|
||||||
private String sign;
|
private String sign;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关
|
||||||
|
* */
|
||||||
|
@Column(name = "show_home")
|
||||||
|
private Boolean showHome;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -146,4 +146,10 @@ public interface IUserService {
|
|||||||
* 查少量字段
|
* 查少量字段
|
||||||
* */
|
* */
|
||||||
Map<String,Object> findByFiled(String id);
|
Map<String,Object> findByFiled(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开关
|
||||||
|
* */
|
||||||
|
void updateShowHome(String id,Boolean showHome);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -333,6 +333,11 @@ public class UserServiceImpl implements IUserService {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateShowHome(String id, Boolean showHome) {
|
||||||
|
dao.updateFieldById(id,"showHome",showHome);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public User getByUserNo(String userNo) {
|
public User getByUserNo(String userNo) {
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user