|
@@ -80,6 +80,12 @@ public class WorkKnowledgeBaseReadLikeService extends CrudService<WorkKnowledgeB
|
|
|
existingRecord.preUpdate();
|
|
existingRecord.preUpdate();
|
|
|
readRecordDao.updateReadRecord(existingRecord);
|
|
readRecordDao.updateReadRecord(existingRecord);
|
|
|
|
|
|
|
|
|
|
+ // 非首次阅读,检查是否已发放阅读积分(change_type=3),未发放则补发
|
|
|
|
|
+ int pointCount = pointDetailDao.countByUserIdAndShareIdAndChangeType(userId, fileId, 3);
|
|
|
|
|
+ if (pointCount == 0) {
|
|
|
|
|
+ grantPointsForFirstRead(fileId, userId);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
return false; // 非首次阅读
|
|
return false; // 非首次阅读
|
|
|
} else {
|
|
} else {
|
|
|
// 首次阅读,创建新记录
|
|
// 首次阅读,创建新记录
|
|
@@ -140,7 +146,7 @@ public class WorkKnowledgeBaseReadLikeService extends CrudService<WorkKnowledgeB
|
|
|
newRecord.preInsert();
|
|
newRecord.preInsert();
|
|
|
likeRecordDao.insert(newRecord);
|
|
likeRecordDao.insert(newRecord);
|
|
|
|
|
|
|
|
- // 首次点赞:给创建人发放积分
|
|
|
|
|
|
|
+ // 首次点赞:给点赞人发放积分
|
|
|
grantPointsForFirstLike(fileId, userId);
|
|
grantPointsForFirstLike(fileId, userId);
|
|
|
return true; // 首次点赞
|
|
return true; // 首次点赞
|
|
|
}
|
|
}
|
|
@@ -264,10 +270,10 @@ public class WorkKnowledgeBaseReadLikeService extends CrudService<WorkKnowledgeB
|
|
|
? shareInfo.getSubmitAuditUserId()
|
|
? shareInfo.getSubmitAuditUserId()
|
|
|
: shareInfo.getCreateBy().getId();
|
|
: shareInfo.getCreateBy().getId();
|
|
|
|
|
|
|
|
- if (ownerUserId.equals(readerUserId)) {
|
|
|
|
|
|
|
+ /*if (ownerUserId.equals(readerUserId)) {
|
|
|
// 记录所有者阅读自己的文件,不给积分
|
|
// 记录所有者阅读自己的文件,不给积分
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
// 查询"基础积分"分类的积分规则
|
|
// 查询"基础积分"分类的积分规则
|
|
|
List<WorkKnowledgePointCategory> categories = categoryDao.findList(
|
|
List<WorkKnowledgePointCategory> categories = categoryDao.findList(
|
|
@@ -314,10 +320,10 @@ public class WorkKnowledgeBaseReadLikeService extends CrudService<WorkKnowledgeB
|
|
|
? shareInfo.getSubmitAuditUserId()
|
|
? shareInfo.getSubmitAuditUserId()
|
|
|
: shareInfo.getCreateBy().getId();
|
|
: shareInfo.getCreateBy().getId();
|
|
|
|
|
|
|
|
- if (ownerUserId.equals(likerUserId)) {
|
|
|
|
|
|
|
+ /*if (ownerUserId.equals(likerUserId)) {
|
|
|
// 记录所有者点赞自己的文件,不给积分
|
|
// 记录所有者点赞自己的文件,不给积分
|
|
|
return;
|
|
return;
|
|
|
- }
|
|
|
|
|
|
|
+ }*/
|
|
|
|
|
|
|
|
// 查询"基础积分"分类的积分规则
|
|
// 查询"基础积分"分类的积分规则
|
|
|
List<WorkKnowledgePointCategory> categories = categoryDao.findList(
|
|
List<WorkKnowledgePointCategory> categories = categoryDao.findList(
|
|
@@ -398,14 +404,10 @@ public class WorkKnowledgeBaseReadLikeService extends CrudService<WorkKnowledgeB
|
|
|
if (shareInfo == null || shareInfo.getCreateBy() == null) {
|
|
if (shareInfo == null || shareInfo.getCreateBy() == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 判断记录所有者(与grantPointsForFirstLike逻辑一致)
|
|
|
|
|
- String ownerUserId = (StringUtils.isNotBlank(shareInfo.getSubmitAuditUserId()))
|
|
|
|
|
- ? shareInfo.getSubmitAuditUserId()
|
|
|
|
|
- : shareInfo.getCreateBy().getId();
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
// 物理删除记录所有者的点赞积分记录(change_type=4表示点赞积分)
|
|
// 物理删除记录所有者的点赞积分记录(change_type=4表示点赞积分)
|
|
|
- pointDetailDao.deleteByUserIdAndShareIdAndChangeType(ownerUserId, fileId, 4);
|
|
|
|
|
|
|
+ pointDetailDao.deleteByUserIdAndShareIdAndChangeType(likerUserId, fileId, 4);
|
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
|
// 删除失败不影响取消点赞操作,记录日志即可
|
|
// 删除失败不影响取消点赞操作,记录日志即可
|
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|