|
@@ -193,7 +193,7 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
}
|
|
}
|
|
|
Page<UserPointDetail> page = workKnowledgeBasePointDetailService.findUserPointDetailPage(new Page<>(request, response), userPointDetail);
|
|
Page<UserPointDetail> page = workKnowledgeBasePointDetailService.findUserPointDetailPage(new Page<>(request, response), userPointDetail);
|
|
|
// 查询该用户在当前分类(含子节点)下的积分总和(根据积分类型筛选)
|
|
// 查询该用户在当前分类(含子节点)下的积分总和(根据积分类型筛选)
|
|
|
- int totalPoint = workKnowledgeBasePointDetailService.sumUserPointByColumnId(
|
|
|
|
|
|
|
+ double totalPoint = workKnowledgeBasePointDetailService.sumUserPointByColumnId(
|
|
|
userPointDetail.getUserId(), userPointDetail.getColumnId(), userPointDetail.getPointType());
|
|
userPointDetail.getUserId(), userPointDetail.getColumnId(), userPointDetail.getPointType());
|
|
|
model.addAttribute("page", page);
|
|
model.addAttribute("page", page);
|
|
|
model.addAttribute("userPointDetail", userPointDetail);
|
|
model.addAttribute("userPointDetail", userPointDetail);
|
|
@@ -279,10 +279,10 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
int exBasic = item.getExchangedBasicPoint() != null ? item.getExchangedBasicPoint() : 0;
|
|
int exBasic = item.getExchangedBasicPoint() != null ? item.getExchangedBasicPoint() : 0;
|
|
|
int exContrib = item.getExchangedContributionPoint() != null ? item.getExchangedContributionPoint() : 0;
|
|
int exContrib = item.getExchangedContributionPoint() != null ? item.getExchangedContributionPoint() : 0;
|
|
|
// 可兑换积分(兑换前的原始积分)
|
|
// 可兑换积分(兑换前的原始积分)
|
|
|
- int origBasic = item.getOriginalBasicPoint() != null ? item.getOriginalBasicPoint() : 0;
|
|
|
|
|
|
|
+ double origBasic = item.getOriginalBasicPoint() != null ? item.getOriginalBasicPoint() : 0;
|
|
|
int origContrib = item.getOriginalContributionPoint() != null ? item.getOriginalContributionPoint() : 0;
|
|
int origContrib = item.getOriginalContributionPoint() != null ? item.getOriginalContributionPoint() : 0;
|
|
|
// 兑换后剩余积分
|
|
// 兑换后剩余积分
|
|
|
- int remainBasic = item.getRemainingBasicPoint() != null ? item.getRemainingBasicPoint() : 0;
|
|
|
|
|
|
|
+ double remainBasic = item.getRemainingBasicPoint() != null ? item.getRemainingBasicPoint() : 0;
|
|
|
int remainContrib = item.getRemainingContributionPoint() != null ? item.getRemainingContributionPoint() : 0;
|
|
int remainContrib = item.getRemainingContributionPoint() != null ? item.getRemainingContributionPoint() : 0;
|
|
|
// 兑换金额(两类合计)
|
|
// 兑换金额(两类合计)
|
|
|
int exchangeAmt = item.getExchangeAmount() != null ? item.getExchangeAmount() : 0;
|
|
int exchangeAmt = item.getExchangeAmount() != null ? item.getExchangeAmount() : 0;
|
|
@@ -298,9 +298,9 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
exportExcel.addCell(row, col++, exContrib, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, exContrib, 2, Integer.class);
|
|
|
exportExcel.addCell(row, col++, remainContrib, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, remainContrib, 2, Integer.class);
|
|
|
// 基础积分三列
|
|
// 基础积分三列
|
|
|
- exportExcel.addCell(row, col++, origBasic, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, origBasic, 2, Double.class);
|
|
|
exportExcel.addCell(row, col++, exBasic, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, exBasic, 2, Integer.class);
|
|
|
- exportExcel.addCell(row, col++, remainBasic, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, remainBasic, 2, Double.class);
|
|
|
// 兑换金额(元):最后一列
|
|
// 兑换金额(元):最后一列
|
|
|
exportExcel.addCell(row, col++, exchangeAmt, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, exchangeAmt, 2, Integer.class);
|
|
|
}
|
|
}
|
|
@@ -451,9 +451,9 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
.collect(Collectors.toList());
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
// 4a. 按rule分组积分(包含负数扣分)
|
|
// 4a. 按rule分组积分(包含负数扣分)
|
|
|
- java.util.Map<String, java.util.Map<String, Integer>> pointsByRule = new java.util.HashMap<>();
|
|
|
|
|
|
|
+ java.util.Map<String, java.util.Map<String, Double>> pointsByRule = new java.util.HashMap<>();
|
|
|
// 扣分标准(category_id=10)的积分单独汇总,归入贡献积分小计
|
|
// 扣分标准(category_id=10)的积分单独汇总,归入贡献积分小计
|
|
|
- java.util.Map<String, Integer> deductionByUser = new java.util.HashMap<>();
|
|
|
|
|
|
|
+ java.util.Map<String, Double> deductionByUser = new java.util.HashMap<>();
|
|
|
if (!userIds.isEmpty()) {
|
|
if (!userIds.isEmpty()) {
|
|
|
List<java.util.Map<String, Object>> ruleResults =
|
|
List<java.util.Map<String, Object>> ruleResults =
|
|
|
workKnowledgeBasePointDetailService.sumPointsByRuleGrouped(userIds, queryParam.getBeginDate(), queryParam.getEndDate());
|
|
workKnowledgeBasePointDetailService.sumPointsByRuleGrouped(userIds, queryParam.getBeginDate(), queryParam.getEndDate());
|
|
@@ -461,21 +461,21 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
String uid = (String) r.get("userId");
|
|
String uid = (String) r.get("userId");
|
|
|
String catId = String.valueOf(r.get("categoryId"));
|
|
String catId = String.valueOf(r.get("categoryId"));
|
|
|
String rid = String.valueOf(r.get("ruleId"));
|
|
String rid = String.valueOf(r.get("ruleId"));
|
|
|
- int pts = ((Number) r.get("totalPoint")).intValue();
|
|
|
|
|
|
|
+ double pts = ((Number) r.get("totalPoint")).doubleValue();
|
|
|
if ("10".equals(catId)) {
|
|
if ("10".equals(catId)) {
|
|
|
// 扣分标准的积分单独汇总
|
|
// 扣分标准的积分单独汇总
|
|
|
- deductionByUser.merge(uid, pts, Integer::sum);
|
|
|
|
|
|
|
+ deductionByUser.merge(uid, pts, Double::sum);
|
|
|
} else {
|
|
} else {
|
|
|
- pointsByRule.computeIfAbsent(uid, k -> new java.util.HashMap<>()).merge(rid, pts, Integer::sum);
|
|
|
|
|
|
|
+ pointsByRule.computeIfAbsent(uid, k -> new java.util.HashMap<>()).merge(rid, pts, Double::sum);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // 4a-extra. 汇总L2叶子分类的积分(用于无L3子列的L2叶子,如"阅读"、"点赞")
|
|
|
|
|
- java.util.Map<String, java.util.Map<String, Integer>> l2PointsByCategory = new java.util.HashMap<>();
|
|
|
|
|
- for (java.util.Map.Entry<String, java.util.Map<String, Integer>> entry : pointsByRule.entrySet()) {
|
|
|
|
|
|
|
+ // 4a-extra. 汇总L2叶子分类的积分(用于无L3子列的L2叶子,如“阅读”、“点赞”)
|
|
|
|
|
+ java.util.Map<String, java.util.Map<String, Double>> l2PointsByCategory = new java.util.HashMap<>();
|
|
|
|
|
+ for (java.util.Map.Entry<String, java.util.Map<String, Double>> entry : pointsByRule.entrySet()) {
|
|
|
String uid = entry.getKey();
|
|
String uid = entry.getKey();
|
|
|
- java.util.Map<String, Integer> userRulePoints = entry.getValue();
|
|
|
|
|
|
|
+ java.util.Map<String, Double> userRulePoints = entry.getValue();
|
|
|
for (int i = 0; i < secondLevelCategoryIds.size(); i++) {
|
|
for (int i = 0; i < secondLevelCategoryIds.size(); i++) {
|
|
|
List<String> catIds = secondLevelCategoryIds.get(i);
|
|
List<String> catIds = secondLevelCategoryIds.get(i);
|
|
|
for (int j = 0; j < catIds.size(); j++) {
|
|
for (int j = 0; j < catIds.size(); j++) {
|
|
@@ -483,9 +483,9 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
if (catId.isEmpty()) continue;
|
|
if (catId.isEmpty()) continue;
|
|
|
// 查询该L2分类下的所有规则ID
|
|
// 查询该L2分类下的所有规则ID
|
|
|
List<WorkKnowledgeBasePointRule> catRules = pointRuleDao.findEnabledByCategoryId(catId);
|
|
List<WorkKnowledgeBasePointRule> catRules = pointRuleDao.findEnabledByCategoryId(catId);
|
|
|
- int total = 0;
|
|
|
|
|
|
|
+ double total = 0;
|
|
|
for (WorkKnowledgeBasePointRule r : catRules) {
|
|
for (WorkKnowledgeBasePointRule r : catRules) {
|
|
|
- total += userRulePoints.getOrDefault(r.getId(), 0);
|
|
|
|
|
|
|
+ total += userRulePoints.getOrDefault(r.getId(), 0.0);
|
|
|
}
|
|
}
|
|
|
l2PointsByCategory.computeIfAbsent(uid, k -> new java.util.HashMap<>()).put(catId, total);
|
|
l2PointsByCategory.computeIfAbsent(uid, k -> new java.util.HashMap<>()).put(catId, total);
|
|
|
}
|
|
}
|
|
@@ -493,14 +493,14 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
// 4b. 兑现积分(按L1分类,point<0取绝对值)
|
|
// 4b. 兑现积分(按L1分类,point<0取绝对值)
|
|
|
- java.util.Map<String, java.util.Map<String, Integer>> exchangeByL1 = new java.util.HashMap<>();
|
|
|
|
|
|
|
+ java.util.Map<String, java.util.Map<String, Double>> exchangeByL1 = new java.util.HashMap<>();
|
|
|
if (!userIds.isEmpty()) {
|
|
if (!userIds.isEmpty()) {
|
|
|
List<java.util.Map<String, Object>> exResults =
|
|
List<java.util.Map<String, Object>> exResults =
|
|
|
workKnowledgeBasePointDetailService.sumExchangeByFirstLevelCategory(userIds, queryParam.getBeginDate(), queryParam.getEndDate());
|
|
workKnowledgeBasePointDetailService.sumExchangeByFirstLevelCategory(userIds, queryParam.getBeginDate(), queryParam.getEndDate());
|
|
|
for (java.util.Map<String, Object> r : exResults) {
|
|
for (java.util.Map<String, Object> r : exResults) {
|
|
|
String uid = (String) r.get("userId");
|
|
String uid = (String) r.get("userId");
|
|
|
String lid = String.valueOf(r.get("firstLevelId"));
|
|
String lid = String.valueOf(r.get("firstLevelId"));
|
|
|
- int pts = ((Number) r.get("totalPoint")).intValue();
|
|
|
|
|
|
|
+ double pts = ((Number) r.get("totalPoint")).doubleValue();
|
|
|
exchangeByL1.computeIfAbsent(uid, k -> new java.util.HashMap<>()).put(lid, pts);
|
|
exchangeByL1.computeIfAbsent(uid, k -> new java.util.HashMap<>()).put(lid, pts);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -536,18 +536,18 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
// 直接规则L2(如"基础积分"下的规则),直接从pointsByRule取数据
|
|
// 直接规则L2(如"基础积分"下的规则),直接从pointsByRule取数据
|
|
|
String ruleId = (i < directRuleIds.size() && j < directRuleIds.get(i).size())
|
|
String ruleId = (i < directRuleIds.size() && j < directRuleIds.get(i).size())
|
|
|
? directRuleIds.get(i).get(j) : "";
|
|
? directRuleIds.get(i).get(j) : "";
|
|
|
- int drVal = emps.stream().mapToInt(e -> {
|
|
|
|
|
- java.util.Map<String, Integer> m = pointsByRule.get(e.getUserId());
|
|
|
|
|
- return m != null && m.containsKey(ruleId) ? m.get(ruleId) : 0;
|
|
|
|
|
|
|
+ double drVal = emps.stream().mapToDouble(e -> {
|
|
|
|
|
+ java.util.Map<String, Double> m = pointsByRule.get(e.getUserId());
|
|
|
|
|
+ return m != null && m.containsKey(ruleId) ? m.get(ruleId) : 0.0;
|
|
|
}).sum();
|
|
}).sum();
|
|
|
row.put("exchange_" + i + "_" + j, drVal);
|
|
row.put("exchange_" + i + "_" + j, drVal);
|
|
|
} else if (l2LeafIndices.contains(i * 1000 + j)) {
|
|
} else if (l2LeafIndices.contains(i * 1000 + j)) {
|
|
|
// L2叶子列(如"阅读"、"点赞"),使用L2级汇总数据
|
|
// L2叶子列(如"阅读"、"点赞"),使用L2级汇总数据
|
|
|
String catId = (i < secondLevelCategoryIds.size() && j < secondLevelCategoryIds.get(i).size())
|
|
String catId = (i < secondLevelCategoryIds.size() && j < secondLevelCategoryIds.get(i).size())
|
|
|
? secondLevelCategoryIds.get(i).get(j) : "";
|
|
? secondLevelCategoryIds.get(i).get(j) : "";
|
|
|
- int leafVal = emps.stream().mapToInt(e -> {
|
|
|
|
|
- java.util.Map<String, Integer> m = l2PointsByCategory.get(e.getUserId());
|
|
|
|
|
- return m != null && m.containsKey(catId) ? m.get(catId) : 0;
|
|
|
|
|
|
|
+ double leafVal = emps.stream().mapToDouble(e -> {
|
|
|
|
|
+ java.util.Map<String, Double> m = l2PointsByCategory.get(e.getUserId());
|
|
|
|
|
+ return m != null && m.containsKey(catId) ? m.get(catId) : 0.0;
|
|
|
}).sum();
|
|
}).sum();
|
|
|
row.put("exchange_" + i + "_" + j, leafVal);
|
|
row.put("exchange_" + i + "_" + j, leafVal);
|
|
|
} else if (subtotalIndices.contains(i * 1000 + j)) {
|
|
} else if (subtotalIndices.contains(i * 1000 + j)) {
|
|
@@ -558,15 +558,15 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
row.put("remaining_" + i, 0);
|
|
row.put("remaining_" + i, 0);
|
|
|
} else if (deductionIndices.contains(i * 1000 + j)) {
|
|
} else if (deductionIndices.contains(i * 1000 + j)) {
|
|
|
// 扣除积分列(仅贡献积分组),从deductionByUser取数据
|
|
// 扣除积分列(仅贡献积分组),从deductionByUser取数据
|
|
|
- int dedVal = emps.stream().mapToInt(e ->
|
|
|
|
|
- deductionByUser.getOrDefault(e.getUserId(), 0)
|
|
|
|
|
|
|
+ double dedVal = emps.stream().mapToDouble(e ->
|
|
|
|
|
+ deductionByUser.getOrDefault(e.getUserId(), 0.0)
|
|
|
).sum();
|
|
).sum();
|
|
|
row.put("exchange_" + i + "_" + j, dedVal);
|
|
row.put("exchange_" + i + "_" + j, dedVal);
|
|
|
} else {
|
|
} else {
|
|
|
// 已兑换积分列
|
|
// 已兑换积分列
|
|
|
- int exVal = emps.stream().mapToInt(e -> {
|
|
|
|
|
- java.util.Map<String, Integer> m = exchangeByL1.get(e.getUserId());
|
|
|
|
|
- return m != null && m.containsKey(l1Id) ? m.get(l1Id) : 0;
|
|
|
|
|
|
|
+ double exVal = emps.stream().mapToDouble(e -> {
|
|
|
|
|
+ java.util.Map<String, Double> m = exchangeByL1.get(e.getUserId());
|
|
|
|
|
+ return m != null && m.containsKey(l1Id) ? m.get(l1Id) : 0.0;
|
|
|
}).sum();
|
|
}).sum();
|
|
|
row.put("exchange_" + i + "_" + j, exVal);
|
|
row.put("exchange_" + i + "_" + j, exVal);
|
|
|
}
|
|
}
|
|
@@ -576,16 +576,16 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
&& k < dataKeysL3.get(i).get(j).size())
|
|
&& k < dataKeysL3.get(i).get(j).size())
|
|
|
? dataKeysL3.get(i).get(j).get(k) : "";
|
|
? dataKeysL3.get(i).get(j).get(k) : "";
|
|
|
String ruleId = ruleKey.startsWith("rule_") ? ruleKey.substring(5) : "";
|
|
String ruleId = ruleKey.startsWith("rule_") ? ruleKey.substring(5) : "";
|
|
|
- int ruleVal = emps.stream().mapToInt(e -> {
|
|
|
|
|
- java.util.Map<String, Integer> m = pointsByRule.get(e.getUserId());
|
|
|
|
|
- return m != null && m.containsKey(ruleId) ? m.get(ruleId) : 0;
|
|
|
|
|
|
|
+ double ruleVal = emps.stream().mapToDouble(e -> {
|
|
|
|
|
+ java.util.Map<String, Double> m = pointsByRule.get(e.getUserId());
|
|
|
|
|
+ return m != null && m.containsKey(ruleId) ? m.get(ruleId) : 0.0;
|
|
|
}).sum();
|
|
}).sum();
|
|
|
row.put("rule_" + i + "_" + j + "_" + k, ruleVal);
|
|
row.put("rule_" + i + "_" + j + "_" + k, ruleVal);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 小计 = 所有规则列之和 + L2叶子列之和 + 直接规则列之和(不含汇总、已兑换、未兑换)
|
|
// 小计 = 所有规则列之和 + L2叶子列之和 + 直接规则列之和(不含汇总、已兑换、未兑换)
|
|
|
- int subtotal = 0;
|
|
|
|
|
|
|
+ double subtotal = 0;
|
|
|
for (int j = 0; j < l2ForL1.size(); j++) {
|
|
for (int j = 0; j < l2ForL1.size(); j++) {
|
|
|
List<String> l3ForL2 = l3ForL1.get(j);
|
|
List<String> l3ForL2 = l3ForL1.get(j);
|
|
|
if (subtotalIndices.contains(i * 1000 + j) || remainingIndices.contains(i * 1000 + j)) {
|
|
if (subtotalIndices.contains(i * 1000 + j) || remainingIndices.contains(i * 1000 + j)) {
|
|
@@ -594,12 +594,12 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
} else if (directRuleIndices.contains(i * 1000 + j) || l2LeafIndices.contains(i * 1000 + j) || deductionIndices.contains(i * 1000 + j)) {
|
|
} else if (directRuleIndices.contains(i * 1000 + j) || l2LeafIndices.contains(i * 1000 + j) || deductionIndices.contains(i * 1000 + j)) {
|
|
|
// 直接规则L2、L2叶子列、扣除积分列,直接取值
|
|
// 直接规则L2、L2叶子列、扣除积分列,直接取值
|
|
|
Object v = row.get("exchange_" + i + "_" + j);
|
|
Object v = row.get("exchange_" + i + "_" + j);
|
|
|
- if (v instanceof Number) subtotal += ((Number) v).intValue();
|
|
|
|
|
|
|
+ if (v instanceof Number) subtotal += ((Number) v).doubleValue();
|
|
|
} else if (!l3ForL2.isEmpty()) {
|
|
} else if (!l3ForL2.isEmpty()) {
|
|
|
// 有L3的规则列
|
|
// 有L3的规则列
|
|
|
for (int k = 0; k < l3ForL2.size(); k++) {
|
|
for (int k = 0; k < l3ForL2.size(); k++) {
|
|
|
Object v = row.get("rule_" + i + "_" + j + "_" + k);
|
|
Object v = row.get("rule_" + i + "_" + j + "_" + k);
|
|
|
- if (v instanceof Number) subtotal += ((Number) v).intValue();
|
|
|
|
|
|
|
+ if (v instanceof Number) subtotal += ((Number) v).doubleValue();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 注意:已兑换积分列不计入小计
|
|
// 注意:已兑换积分列不计入小计
|
|
@@ -607,11 +607,11 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
row.put("subtotal_" + i, subtotal);
|
|
row.put("subtotal_" + i, subtotal);
|
|
|
// 剩余积分 = 积分汇总 - 已兑换积分
|
|
// 剩余积分 = 积分汇总 - 已兑换积分
|
|
|
Integer exColIdx = exchangeColumnIndexMap.get(i);
|
|
Integer exColIdx = exchangeColumnIndexMap.get(i);
|
|
|
- int exVal = 0;
|
|
|
|
|
|
|
+ double exVal = 0;
|
|
|
if (exColIdx != null) {
|
|
if (exColIdx != null) {
|
|
|
Object v = row.get("exchange_" + i + "_" + exColIdx);
|
|
Object v = row.get("exchange_" + i + "_" + exColIdx);
|
|
|
if (v instanceof Number) {
|
|
if (v instanceof Number) {
|
|
|
- exVal = ((Number) v).intValue();
|
|
|
|
|
|
|
+ exVal = ((Number) v).doubleValue();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
row.put("remaining_" + i, subtotal - exVal);
|
|
row.put("remaining_" + i, subtotal - exVal);
|
|
@@ -704,26 +704,26 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
// 查询所有员工快照明细,聚合贡献积分各列(field3-field14)
|
|
// 查询所有员工快照明细,聚合贡献积分各列(field3-field14)
|
|
|
List<WkPointSnapshotInfo> allInfos = wkPointSnapshotService.getAllEmployeeInfos(year, month);
|
|
List<WkPointSnapshotInfo> allInfos = wkPointSnapshotService.getAllEmployeeInfos(year, month);
|
|
|
// 公司级聚合(field1~field15全部聚合)
|
|
// 公司级聚合(field1~field15全部聚合)
|
|
|
- Map<String, Integer> companyContrib = new LinkedHashMap<>();
|
|
|
|
|
- for (int f = 1; f <= 15; f++) companyContrib.put("field" + f, 0);
|
|
|
|
|
|
|
+ Map<String, Double> companyContrib = new LinkedHashMap<>();
|
|
|
|
|
+ for (int f = 1; f <= 15; f++) companyContrib.put("field" + f, 0.0);
|
|
|
for (WkPointSnapshotInfo info : allInfos) {
|
|
for (WkPointSnapshotInfo info : allInfos) {
|
|
|
for (int f = 1; f <= 15; f++) {
|
|
for (int f = 1; f <= 15; f++) {
|
|
|
String val = getFieldValue(info, f);
|
|
String val = getFieldValue(info, f);
|
|
|
- companyContrib.merge("field" + f, parseInt(val), Integer::sum);
|
|
|
|
|
|
|
+ companyContrib.merge("field" + f, parseDouble(val), Double::sum);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
// 部门级聚合(按officeId分组)
|
|
// 部门级聚合(按officeId分组)
|
|
|
- Map<String, Map<String, Integer>> deptContribMap = new LinkedHashMap<>();
|
|
|
|
|
|
|
+ Map<String, Map<String, Double>> deptContribMap = new LinkedHashMap<>();
|
|
|
for (WkPointSnapshotInfo info : allInfos) {
|
|
for (WkPointSnapshotInfo info : allInfos) {
|
|
|
String oid = info.getOfficeId() != null ? info.getOfficeId() : "";
|
|
String oid = info.getOfficeId() != null ? info.getOfficeId() : "";
|
|
|
- Map<String, Integer> deptContrib = deptContribMap.computeIfAbsent(oid, k -> {
|
|
|
|
|
- Map<String, Integer> m = new LinkedHashMap<>();
|
|
|
|
|
- for (int f = 1; f <= 15; f++) m.put("field" + f, 0);
|
|
|
|
|
|
|
+ Map<String, Double> deptContrib = deptContribMap.computeIfAbsent(oid, k -> {
|
|
|
|
|
+ Map<String, Double> m = new LinkedHashMap<>();
|
|
|
|
|
+ for (int f = 1; f <= 15; f++) m.put("field" + f, 0.0);
|
|
|
return m;
|
|
return m;
|
|
|
});
|
|
});
|
|
|
for (int f = 1; f <= 15; f++) {
|
|
for (int f = 1; f <= 15; f++) {
|
|
|
String val = getFieldValue(info, f);
|
|
String val = getFieldValue(info, f);
|
|
|
- deptContrib.merge("field" + f, parseInt(val), Integer::sum);
|
|
|
|
|
|
|
+ deptContrib.merge("field" + f, parseDouble(val), Double::sum);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -771,9 +771,9 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private int parseInt(String val) {
|
|
|
|
|
|
|
+ private double parseDouble(String val) {
|
|
|
if (val == null || val.isEmpty()) return 0;
|
|
if (val == null || val.isEmpty()) return 0;
|
|
|
- try { return Integer.parseInt(val); } catch (NumberFormatException e) { return 0; }
|
|
|
|
|
|
|
+ try { return Double.parseDouble(val); } catch (NumberFormatException e) { return 0; }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -1098,13 +1098,13 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
|
|
|
|
|
int rank = 1;
|
|
int rank = 1;
|
|
|
for (WorkKnowledgeBasePoint item : rankingList) {
|
|
for (WorkKnowledgeBasePoint item : rankingList) {
|
|
|
- int basicEarned = item.getBasicPoint() != null ? item.getBasicPoint() : 0;
|
|
|
|
|
|
|
+ double basicEarned = item.getBasicPoint() != null ? item.getBasicPoint() : 0;
|
|
|
int basicExchanged = item.getExchangedBasicPoint() != null ? item.getExchangedBasicPoint() : 0;
|
|
int basicExchanged = item.getExchangedBasicPoint() != null ? item.getExchangedBasicPoint() : 0;
|
|
|
- int basicRemaining = item.getRemainingBasicPoint() != null ? item.getRemainingBasicPoint() : 0;
|
|
|
|
|
|
|
+ double basicRemaining = item.getRemainingBasicPoint() != null ? item.getRemainingBasicPoint() : 0;
|
|
|
int contribEarned = item.getContributionPoint() != null ? item.getContributionPoint() : 0;
|
|
int contribEarned = item.getContributionPoint() != null ? item.getContributionPoint() : 0;
|
|
|
int contribExchanged = item.getExchangedContributionPoint() != null ? item.getExchangedContributionPoint() : 0;
|
|
int contribExchanged = item.getExchangedContributionPoint() != null ? item.getExchangedContributionPoint() : 0;
|
|
|
int contribRemaining = item.getRemainingContributionPoint() != null ? item.getRemainingContributionPoint() : 0;
|
|
int contribRemaining = item.getRemainingContributionPoint() != null ? item.getRemainingContributionPoint() : 0;
|
|
|
- int totalEarned = item.getTotalPoint() != null ? item.getTotalPoint() : 0;
|
|
|
|
|
|
|
+ double totalEarned = item.getTotalPoint() != null ? item.getTotalPoint() : 0;
|
|
|
|
|
|
|
|
org.apache.poi.ss.usermodel.Row row = exportExcel.addRow();
|
|
org.apache.poi.ss.usermodel.Row row = exportExcel.addRow();
|
|
|
int col = 0;
|
|
int col = 0;
|
|
@@ -1120,18 +1120,18 @@ public class WorkKnowledgeBasePointController extends BaseController {
|
|
|
exportExcel.addCell(row, col++, contribRemaining, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, contribRemaining, 2, Integer.class);
|
|
|
break;
|
|
break;
|
|
|
case "basic":
|
|
case "basic":
|
|
|
- exportExcel.addCell(row, col++, basicEarned, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, basicEarned, 2, Double.class);
|
|
|
exportExcel.addCell(row, col++, basicExchanged, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, basicExchanged, 2, Integer.class);
|
|
|
- exportExcel.addCell(row, col++, basicRemaining, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, basicRemaining, 2, Double.class);
|
|
|
break;
|
|
break;
|
|
|
default:
|
|
default:
|
|
|
- exportExcel.addCell(row, col++, basicEarned, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, basicEarned, 2, Double.class);
|
|
|
exportExcel.addCell(row, col++, basicExchanged, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, basicExchanged, 2, Integer.class);
|
|
|
- exportExcel.addCell(row, col++, basicRemaining, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, basicRemaining, 2, Double.class);
|
|
|
exportExcel.addCell(row, col++, contribEarned, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, contribEarned, 2, Integer.class);
|
|
|
exportExcel.addCell(row, col++, contribExchanged, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, contribExchanged, 2, Integer.class);
|
|
|
exportExcel.addCell(row, col++, contribRemaining, 2, Integer.class);
|
|
exportExcel.addCell(row, col++, contribRemaining, 2, Integer.class);
|
|
|
- exportExcel.addCell(row, col++, totalEarned, 2, Integer.class);
|
|
|
|
|
|
|
+ exportExcel.addCell(row, col++, totalEarned, 2, Double.class);
|
|
|
break;
|
|
break;
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|