Skip to content

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
diyhi committed Mar 29, 2022
1 parent 642d1a8 commit 862d60d
Show file tree
Hide file tree
Showing 59 changed files with 1,414 additions and 188 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>bbs</groupId>
<artifactId>bbs</artifactId>
<version>5.6</version>
<version>5.7</version>
<packaging>war</packaging>
<name>bbs</name>
<description/>
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/cms/bean/ErrorView.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public enum ErrorView {
_11("令牌为空"),
_12("令牌过期"),
_13("令牌错误"),
_14("验证码参数错误"),
_14("需要输入验证码"),//验证码参数错误
_15("验证码错误"),
_16("请输入验证码"),
_17("验证码过期"),
Expand Down
66 changes: 66 additions & 0 deletions src/main/java/cms/bean/user/RewardPointInfo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
package cms.bean.user;

import java.io.Serializable;

/**
* 奖励积分信息
* @author Gao
*
*/
public class RewardPointInfo implements Serializable{

private static final long serialVersionUID = -4809755688926932271L;

/** 发表话题奖励积分 **/
private Long topic_rewardPoint = 0L;
/** 发表评论奖励积分 **/
private Long comment_rewardPoint = 0L;
/** 发表回复奖励积分 **/
private Long reply_rewardPoint = 0L;

/** 提交问题奖励积分 **/
private Long question_rewardPoint = 0L;
/** 提交答案奖励积分 **/
private Long answer_rewardPoint = 0L;
/** 提交答案回复奖励积分 **/
private Long answerReply_rewardPoint = 0L;

public Long getTopic_rewardPoint() {
return topic_rewardPoint;
}
public void setTopic_rewardPoint(Long topic_rewardPoint) {
this.topic_rewardPoint = topic_rewardPoint;
}
public Long getComment_rewardPoint() {
return comment_rewardPoint;
}
public void setComment_rewardPoint(Long comment_rewardPoint) {
this.comment_rewardPoint = comment_rewardPoint;
}
public Long getReply_rewardPoint() {
return reply_rewardPoint;
}
public void setReply_rewardPoint(Long reply_rewardPoint) {
this.reply_rewardPoint = reply_rewardPoint;
}
public Long getQuestion_rewardPoint() {
return question_rewardPoint;
}
public void setQuestion_rewardPoint(Long question_rewardPoint) {
this.question_rewardPoint = question_rewardPoint;
}
public Long getAnswer_rewardPoint() {
return answer_rewardPoint;
}
public void setAnswer_rewardPoint(Long answer_rewardPoint) {
this.answer_rewardPoint = answer_rewardPoint;
}
public Long getAnswerReply_rewardPoint() {
return answerReply_rewardPoint;
}
public void setAnswerReply_rewardPoint(Long answerReply_rewardPoint) {
this.answerReply_rewardPoint = answerReply_rewardPoint;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -543,7 +543,10 @@ public Integer deleteQuestion(Long questionId,String userName,Long point,Object
//增加用户预存款
userService.addUserDeposit(userName, amount, paymentLogObject);
}

//删除标签关联
Query deleteQuestionTagAssociation = em.createQuery("delete from QuestionTagAssociation o where o.questionId=?1")
.setParameter(1, questionId);
deleteQuestionTagAssociation.executeUpdate();
return i;
}

Expand Down
20 changes: 20 additions & 0 deletions src/main/java/cms/utils/SecureLink.java
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,24 @@ public static String createSecureLink(String link,String fileName,String secret,
.build().toString();
return newLink;
}

/**
* 生成安全URI
* @param link 链接 例如 http://127.0.0.1/bbs-bucket/file/topic/2020-10-11/file/6197f199f6234f2791416282d94a805cb1.rar
* @param fileName 文件名称
* @param secret 密钥
* @param expires 有效时间 单位/秒
* @return
*/
public static String createSecureLink(String link,String secret,Long expires){
String uri = UriComponentsBuilder.fromUriString(link).build().getPath();
String time = String.valueOf((System.currentTimeMillis() / 1000) + expires);
String md5 = org.apache.commons.codec.binary.Base64.encodeBase64URLSafeString(DigestUtils.md5(secret + uri + time));

String newLink = UriComponentsBuilder.fromUriString(link)
.replaceQueryParam("md5", md5)
.replaceQueryParam("expires", time)
.build().toString();
return newLink;
}
}
115 changes: 75 additions & 40 deletions src/main/java/cms/web/action/common/HomeManageAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import cms.bean.user.PointLog;
import cms.bean.user.RefreshUser;
import cms.bean.user.ResourceEnum;
import cms.bean.user.RewardPointInfo;
import cms.bean.user.User;
import cms.bean.user.UserCustom;
import cms.bean.user.UserDynamic;
Expand Down Expand Up @@ -625,6 +626,20 @@ public String pointUI(ModelMap model,PageForm pageForm,
returnValue.put("user",viewUser);
}

SystemSetting systemSetting = settingService.findSystemSetting_cache();
if(systemSetting != null){
RewardPointInfo rewardPointInfo = new RewardPointInfo();
rewardPointInfo.setTopic_rewardPoint(systemSetting.getTopic_rewardPoint());
rewardPointInfo.setComment_rewardPoint(systemSetting.getComment_rewardPoint());
rewardPointInfo.setReply_rewardPoint(systemSetting.getReply_rewardPoint());
rewardPointInfo.setQuestion_rewardPoint(systemSetting.getQuestion_rewardPoint());
rewardPointInfo.setAnswer_rewardPoint(systemSetting.getAnswer_rewardPoint());
rewardPointInfo.setAnswerReply_rewardPoint(systemSetting.getAnswerReply_rewardPoint());

model.addAttribute("rewardPointInfo",rewardPointInfo);
returnValue.put("rewardPointInfo",rewardPointInfo);

}

if(isAjax == true){
WebUtil.writeToWeb(JsonUtils.toJSONString(returnValue), "json", response);
Expand Down Expand Up @@ -2390,11 +2405,13 @@ public String privateMessageList(ModelMap model,PageForm pageForm,
User friend_user = userMap.get(privateMessage.getFriendUserId());
if(friend_user != null){
privateMessage.setFriendUserName(friend_user.getUserName());//私信对方用户名称
privateMessage.setFriendAccount(friend_user.getAccount());
privateMessage.setFriendNickname(friend_user.getNickname());
if(friend_user.getAvatarName() != null && !"".equals(friend_user.getAvatarName().trim())){
privateMessage.setFriendAvatarPath(fileManage.fileServerAddress()+friend_user.getAvatarPath());//私信对方头像路径
privateMessage.setFriendAvatarName(friend_user.getAvatarName());//私信对方头像名称
if(friend_user.getCancelAccountTime().equals(-1L)){
privateMessage.setFriendAccount(friend_user.getAccount());
privateMessage.setFriendNickname(friend_user.getNickname());
if(friend_user.getAvatarName() != null && !"".equals(friend_user.getAvatarName().trim())){
privateMessage.setFriendAvatarPath(fileManage.fileServerAddress()+friend_user.getAvatarPath());//私信对方头像路径
privateMessage.setFriendAvatarName(friend_user.getAvatarName());//私信对方头像名称
}
}
}
User sender_user = userMap.get(privateMessage.getSenderUserId());
Expand Down Expand Up @@ -2526,11 +2543,13 @@ public String privateMessageChatList(ModelMap model,Integer page,String friendUs
User sender_user = userMap.get(privateMessage.getSenderUserId());
if(sender_user != null){
privateMessage.setSenderUserName(sender_user.getUserName());//私信发送者用户名称
privateMessage.setSenderAccount(sender_user.getAccount());
privateMessage.setSenderNickname(sender_user.getNickname());
if(sender_user.getAvatarName() != null && !"".equals(sender_user.getAvatarName().trim())){
privateMessage.setSenderAvatarPath(fileManage.fileServerAddress()+sender_user.getAvatarPath());//发送者头像路径
privateMessage.setSenderAvatarName(sender_user.getAvatarName());//发送者头像名称
if(sender_user.getCancelAccountTime().equals(-1L)){
privateMessage.setSenderAccount(sender_user.getAccount());
privateMessage.setSenderNickname(sender_user.getNickname());
if(sender_user.getAvatarName() != null && !"".equals(sender_user.getAvatarName().trim())){
privateMessage.setSenderAvatarPath(fileManage.fileServerAddress()+sender_user.getAvatarPath());//发送者头像路径
privateMessage.setSenderAvatarName(sender_user.getAvatarName());//发送者头像名称
}
}
}

Expand All @@ -2556,26 +2575,30 @@ public String privateMessageChatList(ModelMap model,Integer page,String friendUs
}

if(chatUser != null){
//仅显示指定的字段
User viewUser = new User();
viewUser.setId(chatUser.getId());
viewUser.setUserName(chatUser.getUserName());//会员用户名
viewUser.setAccount(chatUser.getAccount());//账号
viewUser.setNickname(chatUser.getNickname());//呢称
viewUser.setRegistrationDate(chatUser.getRegistrationDate());//注册日期

List<UserGrade> userGradeList = userGradeService.findAllGrade_cache();//取得用户所有等级
if(userGradeList != null && userGradeList.size() >0){
for(UserGrade userGrade : userGradeList){
if(chatUser.getPoint() >= userGrade.getNeedPoint()){
viewUser.setGradeId(userGrade.getId());//等级Id
viewUser.setGradeName(userGrade.getName());//将等级值设进等级参数里
break;
}
}
if(chatUser.getCancelAccountTime().equals(-1L)){
//仅显示指定的字段
User viewUser = new User();
viewUser.setId(chatUser.getId());
viewUser.setUserName(chatUser.getUserName());//会员用户名
viewUser.setAccount(chatUser.getAccount());//账号
viewUser.setNickname(chatUser.getNickname());//呢称
viewUser.setRegistrationDate(chatUser.getRegistrationDate());//注册日期

List<UserGrade> userGradeList = userGradeService.findAllGrade_cache();//取得用户所有等级
if(userGradeList != null && userGradeList.size() >0){
for(UserGrade userGrade : userGradeList){
if(chatUser.getPoint() >= userGrade.getNeedPoint()){
viewUser.setGradeId(userGrade.getId());//等级Id
viewUser.setGradeName(userGrade.getName());//将等级值设进等级参数里
break;
}
}
}

chatUser = viewUser;
}else{
chatUser = null;
}

chatUser = viewUser;
}


Expand Down Expand Up @@ -3389,7 +3412,7 @@ public String remindList(ModelMap model,PageForm pageForm,
for(Remind remind : qr.getResultlist()){

User sender_user = userMap.get(remind.getSenderUserId());
if(sender_user != null){
if(sender_user != null && sender_user.getCancelAccountTime().equals(-1L)){
remind.setSenderUserName(sender_user.getUserName());//发送者用户名称
remind.setSenderAccount(sender_user.getAccount());//发送者账号
remind.setSenderNickname(sender_user.getNickname());
Expand Down Expand Up @@ -3571,13 +3594,15 @@ public String topicFavoriteList(ModelMap model,PageForm pageForm,Long topicId,
favorites.setTopicTitle(topic.getTitle());
}
User user = userManage.query_cache_findUserByUserName(favorites.getUserName());
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
favorites.setAccount(user.getAccount());
favorites.setNickname(user.getNickname());
if(user.getAvatarName() != null && !"".equals(user.getAvatarName().trim())){
favorites.setAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());//头像路径
favorites.setAvatarName(user.getAvatarName());//头像名称
}
}else{
favorites.setUserName(null);
}
}
}
Expand Down Expand Up @@ -3639,13 +3664,15 @@ public String questionFavoriteList(ModelMap model,PageForm pageForm,Long questio
favorites.setQuestionTitle(question.getTitle());
}
User user = userManage.query_cache_findUserByUserName(favorites.getUserName());
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
favorites.setAccount(user.getAccount());
favorites.setNickname(user.getNickname());
if(user.getAvatarName() != null && !"".equals(user.getAvatarName().trim())){
favorites.setAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());//头像路径
favorites.setAvatarName(user.getAvatarName());//头像名称
}
}else{
favorites.setUserName(null);
}
}
}
Expand Down Expand Up @@ -3902,11 +3929,13 @@ public String topicUnhideList(ModelMap model,PageForm pageForm,Long topicId,
if(qr != null && qr.getResultlist() != null && qr.getResultlist().size() >0){
for(TopicUnhide topicUnhide : qr.getResultlist()){
User user = userManage.query_cache_findUserByUserName(topicUnhide.getUserName());
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
topicUnhide.setAccount(user.getAccount());
topicUnhide.setNickname(user.getNickname());
topicUnhide.setAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());
topicUnhide.setAvatarName(user.getAvatarName());
}else{
topicUnhide.setUserName(null);
}
}
}
Expand Down Expand Up @@ -4302,14 +4331,16 @@ public String topicLikeList(ModelMap model,PageForm pageForm,Long topicId,
like.setTopicTitle(topic.getTitle());
}
User user = userManage.query_cache_findUserByUserName(like.getUserName());
if(user != null){
like.setAccount(user.getAccount());
if(user != null && user.getCancelAccountTime().equals(-1L)){
like.setAccount(user.getAccount());
like.setNickname(user.getNickname());
if(user.getAvatarName() != null && !"".equals(user.getAvatarName().trim())){
like.setAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());//头像路径
like.setAvatarName(user.getAvatarName());//头像名称
}
}
}else{
like.setUserName(null);
}
}
}
//将查询结果集传给分页List
Expand Down Expand Up @@ -4531,13 +4562,15 @@ public String followList(ModelMap model,PageForm pageForm,
if(qr != null && qr.getResultlist() != null && qr.getResultlist().size() >0){
for(Follow follow : qr.getResultlist()){
User user = userManage.query_cache_findUserByUserName(follow.getFriendUserName());//查询缓存
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
follow.setFriendAccount(user.getAccount());
follow.setFriendNickname(user.getNickname());
if(user.getAvatarName() != null && !"".equals(user.getAvatarName().trim())){
follow.setFriendAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());
follow.setFriendAvatarName(user.getAvatarName());
}
}else{
follow.setFriendUserName(null);
}
}
}
Expand Down Expand Up @@ -4586,13 +4619,15 @@ public String followerList(ModelMap model,PageForm pageForm,
if(qr != null && qr.getResultlist() != null && qr.getResultlist().size() >0){
for(Follower follower : qr.getResultlist()){
User user = userManage.query_cache_findUserByUserName(follower.getFriendUserName());//查询缓存
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
follower.setFriendAccount(user.getAccount());
follower.setFriendNickname(user.getNickname());
if(user.getAvatarName() != null && !"".equals(user.getAvatarName().trim())){
follower.setFriendAvatarPath(fileManage.fileServerAddress()+user.getAvatarPath());
follower.setFriendAvatarName(user.getAvatarName());
}
}else{
follower.setFriendUserName(null);
}
}
}
Expand Down Expand Up @@ -5194,7 +5229,7 @@ public String redEnvelopeAmountDistributionUI(ModelMap model,PageForm pageForm,S
//排序
boolean sort = false;//true:正序 false:倒序

QueryResult<ReceiveRedEnvelope> qr = redEnvelopeManage.queryReceiveRedEnvelopeByCondition(giveRedEnvelope,false,firstindex, pageView.getMaxresult(),sort);
QueryResult<ReceiveRedEnvelope> qr = redEnvelopeManage.queryReceiveRedEnvelopeByCondition(giveRedEnvelope,false,firstindex, pageView.getMaxresult(),sort,false);

if(giveRedEnvelope.getBindTopicId() != null && giveRedEnvelope.getBindTopicId() >0L){
Topic topic = topicManage.queryTopicCache(giveRedEnvelope.getBindTopicId());//查询缓存
Expand Down Expand Up @@ -5254,7 +5289,7 @@ public String receiveRedEnvelopeUI(ModelMap model,PageForm pageForm,
if(qr.getResultlist() != null && qr.getResultlist().size() >0){
for(ReceiveRedEnvelope receiveRedEnvelope : qr.getResultlist()){
User user = userManage.query_cache_findUserById(receiveRedEnvelope.getGiveUserId());
if(user != null){
if(user != null && user.getCancelAccountTime().equals(-1L)){
receiveRedEnvelope.setGiveNickname(user.getNickname());
receiveRedEnvelope.setGiveUserName(user.getUserName());
receiveRedEnvelope.setGiveAccount(user.getAccount());
Expand Down
Loading

0 comments on commit 862d60d

Please sign in to comment.