|
@@ -586,6 +586,26 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
}
|
|
}
|
|
|
String shareId = entity.getId();
|
|
String shareId = entity.getId();
|
|
|
|
|
|
|
|
|
|
+ // 查询该分类对应的积分规则(用于获取categoryId和ruleId)
|
|
|
|
|
+ String categoryId = null;
|
|
|
|
|
+ WorkKnowledgeBasePointRule createRule = null;
|
|
|
|
|
+ WorkKnowledgeBasePointRule auditRule = null;
|
|
|
|
|
+
|
|
|
|
|
+ if (StringUtils.isNotBlank(entity.getTreeNodeId())) {
|
|
|
|
|
+ WorkKnowledgeBaseTreeInfo treeInfo = getTreeInfoById(entity.getTreeNodeId());
|
|
|
|
|
+ if (treeInfo != null) {
|
|
|
|
|
+ // 根据treeName查询分类表获取categoryId
|
|
|
|
|
+ List<WorkKnowledgePointCategory> categories = findCategoriesByName(treeInfo.getTreeName());
|
|
|
|
|
+ if (categories != null && !categories.isEmpty()) {
|
|
|
|
|
+ categoryId = categories.get(0).getId();
|
|
|
|
|
+ // 查询该分类下rule_type=1(创建积分)的规则
|
|
|
|
|
+ createRule = pointRuleDao.findByCategoryIdAndRuleType(categoryId, "1");
|
|
|
|
|
+ // 查询该分类下rule_type=2(审核积分)的规则
|
|
|
|
|
+ auditRule = pointRuleDao.findByCategoryIdAndRuleType(categoryId, "2");
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// 计算三人评分的平均分(仅用于创建人)
|
|
// 计算三人评分的平均分(仅用于创建人)
|
|
|
Integer averageScore = null;
|
|
Integer averageScore = null;
|
|
|
List<WorkKnowledgeBaseAuditRecord> records = auditRecordDao.findByFileIdSinceTime(shareId, startTime);
|
|
List<WorkKnowledgeBaseAuditRecord> records = auditRecordDao.findByFileIdSinceTime(shareId, startTime);
|
|
@@ -606,34 +626,21 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
|
|
|
|
|
// 1、提交审核人获得创建积分(使用平均分)
|
|
// 1、提交审核人获得创建积分(使用平均分)
|
|
|
String submitUserId = entity.getSubmitAuditUserId();
|
|
String submitUserId = entity.getSubmitAuditUserId();
|
|
|
- if (StringUtils.isNotBlank(submitUserId) && averageScore != null) {
|
|
|
|
|
- insertPointDetail(submitUserId, shareId, POINT_CHANGE_CREATE, averageScore);
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(submitUserId) && averageScore != null && createRule != null) {
|
|
|
|
|
+ insertPointDetail(submitUserId, shareId, POINT_CHANGE_CREATE, categoryId, createRule.getId(), averageScore);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 2、查询该分类对应的审核积分规则(rule_type=2)
|
|
|
|
|
|
|
+ // 2、本轮三位审核人各获得审核积分(使用固定审核积分值)
|
|
|
|
|
+ if (records == null || records.isEmpty() || auditRule == null || StringUtils.isBlank(auditRule.getPointValue())) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
Integer auditPointValue = null;
|
|
Integer auditPointValue = null;
|
|
|
- if (StringUtils.isNotBlank(entity.getTreeNodeId())) {
|
|
|
|
|
- WorkKnowledgeBaseTreeInfo treeInfo = getTreeInfoById(entity.getTreeNodeId());
|
|
|
|
|
- if (treeInfo != null) {
|
|
|
|
|
- // 根据treeName查询分类表获取categoryId
|
|
|
|
|
- List<WorkKnowledgePointCategory> categories = findCategoriesByName(treeInfo.getTreeName());
|
|
|
|
|
- if (categories != null && !categories.isEmpty()) {
|
|
|
|
|
- String categoryId = categories.get(0).getId();
|
|
|
|
|
- // 查询该分类下rule_type=2(审核积分)的规则
|
|
|
|
|
- WorkKnowledgeBasePointRule auditRule = pointRuleDao.findByCategoryIdAndRuleType(categoryId, "2");
|
|
|
|
|
- if (auditRule != null && StringUtils.isNotBlank(auditRule.getPointValue())) {
|
|
|
|
|
- try {
|
|
|
|
|
- auditPointValue = Integer.parseInt(auditRule.getPointValue());
|
|
|
|
|
- } catch (NumberFormatException e) {
|
|
|
|
|
- // 忽略无效值
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ auditPointValue = Integer.parseInt(auditRule.getPointValue());
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- // 3、本轮三位审核人各获得审核积分(使用固定审核积分值)
|
|
|
|
|
- if (records == null || records.isEmpty() || auditPointValue == null || auditPointValue <= 0) {
|
|
|
|
|
|
|
+ if (auditPointValue <= 0) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
Set<String> grantedUserIds = new HashSet<>();
|
|
Set<String> grantedUserIds = new HashSet<>();
|
|
@@ -641,7 +648,7 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
if (record.getAuditResult() != null && record.getAuditResult() == 1
|
|
if (record.getAuditResult() != null && record.getAuditResult() == 1
|
|
|
&& StringUtils.isNotBlank(record.getAuditUserId())
|
|
&& StringUtils.isNotBlank(record.getAuditUserId())
|
|
|
&& grantedUserIds.add(record.getAuditUserId())) {
|
|
&& grantedUserIds.add(record.getAuditUserId())) {
|
|
|
- insertPointDetail(record.getAuditUserId(), shareId, POINT_CHANGE_AUDIT, auditPointValue);
|
|
|
|
|
|
|
+ insertPointDetail(record.getAuditUserId(), shareId, POINT_CHANGE_AUDIT, categoryId, auditRule.getId(), auditPointValue);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -655,18 +662,35 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
}
|
|
}
|
|
|
String shareId = entity.getId();
|
|
String shareId = entity.getId();
|
|
|
|
|
|
|
|
|
|
+ // 查询全局默认积分规则(用于获取categoryId和ruleId)
|
|
|
|
|
+ WorkKnowledgeBasePointRule createRule = pointRuleDao.findByRuleType(POINT_RULE_CREATE);
|
|
|
|
|
+ WorkKnowledgeBasePointRule auditRule = pointRuleDao.findByRuleType(POINT_RULE_AUDIT);
|
|
|
|
|
+
|
|
|
// 1、提交审核人获得创建积分(使用固定值)
|
|
// 1、提交审核人获得创建积分(使用固定值)
|
|
|
String submitUserId = entity.getSubmitAuditUserId();
|
|
String submitUserId = entity.getSubmitAuditUserId();
|
|
|
- if (StringUtils.isNotBlank(submitUserId)) {
|
|
|
|
|
- WorkKnowledgeBasePointRule createRule = pointRuleDao.findByRuleType(POINT_RULE_CREATE);
|
|
|
|
|
- if (createRule != null && createRule.getPointValue() != null && Integer.parseInt(createRule.getPointValue()) > 0) {
|
|
|
|
|
- insertPointDetail(submitUserId, shareId, POINT_CHANGE_CREATE, Integer.parseInt(createRule.getPointValue()));
|
|
|
|
|
|
|
+ if (StringUtils.isNotBlank(submitUserId) && createRule != null && createRule.getPointValue() != null) {
|
|
|
|
|
+ Integer createPoint = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ createPoint = Integer.parseInt(createRule.getPointValue());
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ createPoint = null;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (createPoint != null && createPoint > 0) {
|
|
|
|
|
+ insertPointDetail(submitUserId, shareId, POINT_CHANGE_CREATE, createRule.getCategoryId(), createRule.getId(), createPoint);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 2、本轮三位审核人各获得审核积分(使用固定值)
|
|
// 2、本轮三位审核人各获得审核积分(使用固定值)
|
|
|
- WorkKnowledgeBasePointRule auditRule = pointRuleDao.findByRuleType(POINT_RULE_AUDIT);
|
|
|
|
|
- if (auditRule == null || auditRule.getPointValue() == null || Integer.parseInt(auditRule.getPointValue()) <= 0) {
|
|
|
|
|
|
|
+ if (auditRule == null || auditRule.getPointValue() == null) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ Integer auditPointValue = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ auditPointValue = Integer.parseInt(auditRule.getPointValue());
|
|
|
|
|
+ } catch (NumberFormatException e) {
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ if (auditPointValue <= 0) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
List<WorkKnowledgeBaseAuditRecord> records = auditRecordDao.findByFileIdSinceTime(shareId, startTime);
|
|
List<WorkKnowledgeBaseAuditRecord> records = auditRecordDao.findByFileIdSinceTime(shareId, startTime);
|
|
@@ -678,7 +702,7 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
if (record.getAuditResult() != null && record.getAuditResult() == 1
|
|
if (record.getAuditResult() != null && record.getAuditResult() == 1
|
|
|
&& StringUtils.isNotBlank(record.getAuditUserId())
|
|
&& StringUtils.isNotBlank(record.getAuditUserId())
|
|
|
&& grantedUserIds.add(record.getAuditUserId())) {
|
|
&& grantedUserIds.add(record.getAuditUserId())) {
|
|
|
- insertPointDetail(record.getAuditUserId(), shareId, POINT_CHANGE_AUDIT, Integer.parseInt(auditRule.getPointValue()));
|
|
|
|
|
|
|
+ insertPointDetail(record.getAuditUserId(), shareId, POINT_CHANGE_AUDIT, auditRule.getCategoryId(), auditRule.getId(), auditPointValue);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -686,12 +710,14 @@ public class WorkKnowledgeBaseShareService extends CrudService<WorkKnowledgeBase
|
|
|
/**
|
|
/**
|
|
|
* 插入一条积分明细记录
|
|
* 插入一条积分明细记录
|
|
|
*/
|
|
*/
|
|
|
- private void insertPointDetail(String userId, String shareId, Integer changeType, Integer point) {
|
|
|
|
|
|
|
+ private void insertPointDetail(String userId, String shareId, Integer changeType, String categoryId, String ruleId, Integer point) {
|
|
|
WorkKnowledgeBasePointDetail detail = new WorkKnowledgeBasePointDetail();
|
|
WorkKnowledgeBasePointDetail detail = new WorkKnowledgeBasePointDetail();
|
|
|
detail.setId(IdGen.uuid());
|
|
detail.setId(IdGen.uuid());
|
|
|
detail.setUserId(userId);
|
|
detail.setUserId(userId);
|
|
|
detail.setShareId(shareId);
|
|
detail.setShareId(shareId);
|
|
|
detail.setChangeType(changeType);
|
|
detail.setChangeType(changeType);
|
|
|
|
|
+ detail.setCategoryId(categoryId);
|
|
|
|
|
+ detail.setRuleId(ruleId);
|
|
|
detail.setPoint(point);
|
|
detail.setPoint(point);
|
|
|
detail.preInsert();
|
|
detail.preInsert();
|
|
|
pointDetailDao.insert(detail);
|
|
pointDetailDao.insert(detail);
|