|
|
@@ -6,7 +6,9 @@ import com.jeeplus.modules.WorkKnowledgeBase.dao.WorkKnowledgeBasePointDetailDao
|
|
|
import com.jeeplus.modules.WorkKnowledgeBase.dao.WorkKnowledgeBasePointRuleDao;
|
|
|
import com.jeeplus.modules.WorkKnowledgeBase.dao.WorkKnowledgeBaseUserExchangeFlagDao;
|
|
|
import com.jeeplus.modules.WorkKnowledgeBase.entity.*;
|
|
|
+import com.jeeplus.modules.sys.entity.Office;
|
|
|
import com.jeeplus.modules.sys.entity.User;
|
|
|
+import com.jeeplus.modules.sys.service.OfficeService;
|
|
|
import com.jeeplus.modules.sys.utils.UserUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -36,6 +38,9 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
@Autowired
|
|
|
private WorkKnowledgeBasePointRuleDao pointRuleDao;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private OfficeService officeService;
|
|
|
+
|
|
|
/**
|
|
|
* 获取用户当前可用基础积分(分类ID=1)
|
|
|
* @param userId 用户ID
|
|
|
@@ -255,6 +260,13 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
return new java.util.ArrayList<>();
|
|
|
}
|
|
|
|
|
|
+ // 1.5 查询用户信息(用于过滤不参与兑换的人员)
|
|
|
+ List<WorkKnowledgeBasePoint> allUsersForFilter = pointDetailDao.findAllUserPointSummary();
|
|
|
+ Map<String, WorkKnowledgeBasePoint> userMapForFilter = new HashMap<>();
|
|
|
+ for (WorkKnowledgeBasePoint u : allUsersForFilter) {
|
|
|
+ userMapForFilter.put(u.getUserId(), u);
|
|
|
+ }
|
|
|
+
|
|
|
// 2. 读取兑换规则
|
|
|
Integer firstThreshold = getRuleValueByType("91");
|
|
|
Integer nonFirstThreshold = getRuleValueByType("92");
|
|
|
@@ -277,6 +289,12 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
// 3. 逐用户执行兑换(根据类型决定兑换哪种)
|
|
|
for (String userId : userIdList) {
|
|
|
try {
|
|
|
+ // 过滤不参与兑换的人员(管理员、苏州团队毛志祥、工程四部/五部)
|
|
|
+ WorkKnowledgeBasePoint filterUser = userMapForFilter.get(userId);
|
|
|
+ if (isExcludedFromExport(filterUser)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+
|
|
|
// === 基础积分兑换 ===
|
|
|
if ("basic".equals(exchangeType)) {
|
|
|
int basicPoints = pointDetailDao.sumUserPointByColumnId(userId, "1");
|
|
|
@@ -360,6 +378,10 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
if (!exchangedUserIds.contains(item.getUserId())) {
|
|
|
continue;
|
|
|
}
|
|
|
+ // 过滤不参与导出的人员
|
|
|
+ if (isExcludedFromExport(item)) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
|
|
|
int exBasic = exchangedBasicMap.containsKey(item.getUserId()) ? exchangedBasicMap.get(item.getUserId()) : 0;
|
|
|
int exContrib = exchangedContribMap.containsKey(item.getUserId()) ? exchangedContribMap.get(item.getUserId()) : 0;
|
|
|
@@ -440,9 +462,9 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
// 4. 逐用户同时执行基础积分和贡献积分兑换
|
|
|
for (String userId : userIdSet) {
|
|
|
try {
|
|
|
- // 管理员不参与兑换,直接跳过
|
|
|
+ // 管理员及指定部门/人员不参与兑换,直接跳过
|
|
|
WorkKnowledgeBasePoint userInfo = userMap.get(userId);
|
|
|
- if (userInfo != null && "管理员".equals(userInfo.getUserName())) {
|
|
|
+ if (isExcludedFromExport(userInfo)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -517,8 +539,8 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
if (!exchangedUserIds.contains(item.getUserId())) {
|
|
|
continue;
|
|
|
}
|
|
|
- // 管理员不导出
|
|
|
- if ("管理员".equals(item.getUserName())) {
|
|
|
+ // 过滤不参与导出的人员
|
|
|
+ if (isExcludedFromExport(item)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -695,8 +717,8 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
if (!previewUserIds.contains(item.getUserId())) {
|
|
|
continue;
|
|
|
}
|
|
|
- // 管理员不可兑换,不展示
|
|
|
- if ("管理员".equals(item.getUserName())) {
|
|
|
+ // 过滤不参与导出的人员
|
|
|
+ if (isExcludedFromExport(item)) {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
@@ -743,6 +765,50 @@ public class WorkKnowledgeBasePointExchangeService extends CrudService<WorkKnowl
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
+ * 判断用户是否应从积分导出中排除
|
|
|
+ * 排除规则:管理员、苏州团队的毛志祥、工程四部和工程五部的人员(含子部门)
|
|
|
+ */
|
|
|
+ private boolean isExcludedFromExport(WorkKnowledgeBasePoint user) {
|
|
|
+ if (user == null) return true;
|
|
|
+ // 管理员不参与
|
|
|
+ if ("管理员".equals(user.getUserName())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ String officeName = user.getOfficeName();
|
|
|
+ if (StringUtils.isBlank(officeName)) return false;
|
|
|
+ // 苏州团队下的毛志祥
|
|
|
+ if ("苏州团队".equals(officeName) && "毛志祥".equals(user.getUserName())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 工程四部和工程五部的人员(含子部门)
|
|
|
+ if ("工程四部".equals(officeName) || "工程五部".equals(officeName)) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ // 检查是否为工程四部或工程五部的子部门
|
|
|
+ try {
|
|
|
+ if (user.getOfficeId() != null) {
|
|
|
+ Office fourDept = officeService.getByName("工程四部");
|
|
|
+ if (fourDept != null) {
|
|
|
+ List<String> fourChildren = officeService.getChildrenOffice(fourDept.getId());
|
|
|
+ if (fourChildren != null && fourChildren.contains(user.getOfficeId())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ Office fiveDept = officeService.getByName("工程五部");
|
|
|
+ if (fiveDept != null) {
|
|
|
+ List<String> fiveChildren = officeService.getChildrenOffice(fiveDept.getId());
|
|
|
+ if (fiveChildren != null && fiveChildren.contains(user.getOfficeId())) {
|
|
|
+ return true;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ // 查询异常时仅按直接部门名称过滤
|
|
|
+ }
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
* 根据rule_type获取规则配置的point_value值
|
|
|
* @param ruleType 规则类型(91/92/93)
|
|
|
* @return 规则值,如果不存在返回null
|