|
|
@@ -135,12 +135,14 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
|
|
|
}
|
|
|
|
|
|
// 资源录入成功后,为红娘添加积分奖励(阶梯奖励)
|
|
|
- if (result && myResource.getMatchmakerId() != null && pointsManageService != null) {
|
|
|
+ // 只有上传线索(未注册用户,isUser=0)才给积分,上传资源(已注册用户,isUser=1)不给积分
|
|
|
+ boolean isClue = myResource.getIsUser() == null || myResource.getIsUser() == 0;
|
|
|
+ if (result && isClue && myResource.getMatchmakerId() != null && pointsManageService != null) {
|
|
|
try {
|
|
|
String resourceName = myResource.getName() != null ? myResource.getName() : "未知";
|
|
|
|
|
|
- // 查询红娘当日已上传的资源数量(包括刚录入的这条)
|
|
|
- int todayCount = getTodayResourceCount(myResource.getMatchmakerId());
|
|
|
+ // 查询红娘当日已上传的线索数量(只统计未注册用户,包括刚录入的这条)
|
|
|
+ int todayCount = getTodayClueCount(myResource.getMatchmakerId());
|
|
|
|
|
|
// 计算阶梯积分:基础10分,超3人+2分,超10人+5分
|
|
|
int basePoints = 10;
|
|
|
@@ -152,7 +154,7 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
|
|
|
}
|
|
|
int totalPoints = basePoints + bonusPoints;
|
|
|
|
|
|
- String reason = "录入资源: " + resourceName + " (今日第" + todayCount + "个";
|
|
|
+ String reason = "上传线索: " + resourceName + " (今日第" + todayCount + "个";
|
|
|
if (bonusPoints > 0) {
|
|
|
reason += ",额外奖励+" + bonusPoints;
|
|
|
}
|
|
|
@@ -165,27 +167,29 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
|
|
|
reason
|
|
|
);
|
|
|
if (pointsAdded) {
|
|
|
- System.out.println("✅ 资源录入积分奖励添加成功,红娘ID: " + myResource.getMatchmakerId() +
|
|
|
- ",今日第" + todayCount + "个,获得" + totalPoints + "积分");
|
|
|
+ System.out.println("✅ 线索录入积分奖励添加成功,红娘ID: " + myResource.getMatchmakerId() +
|
|
|
+ ",今日第" + todayCount + "个线索,获得" + totalPoints + "积分");
|
|
|
} else {
|
|
|
- System.out.println("⚠️ 资源录入积分奖励添加失败,红娘ID: " + myResource.getMatchmakerId());
|
|
|
+ System.out.println("⚠️ 线索录入积分奖励添加失败,红娘ID: " + myResource.getMatchmakerId());
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
// 积分添加失败不影响资源录入
|
|
|
System.err.println("⚠️ 添加积分奖励时发生异常: " + e.getMessage());
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
+ } else if (result && !isClue) {
|
|
|
+ System.out.println("📝 录入的是已注册用户(资源),不给积分奖励");
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 获取红娘当日已上传的资源数量
|
|
|
+ * 获取红娘当日已上传的线索数量(只统计未注册用户,isUser=0或null)
|
|
|
* @param matchmakerId 红娘ID
|
|
|
- * @return 当日上传数量
|
|
|
+ * @return 当日上传线索数量
|
|
|
*/
|
|
|
- private int getTodayResourceCount(Integer matchmakerId) {
|
|
|
+ private int getTodayClueCount(Integer matchmakerId) {
|
|
|
if (matchmakerId == null) {
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -201,11 +205,12 @@ public class MyResourceServiceImpl extends ServiceImpl<MyResourceMapper, MyResou
|
|
|
calendar.add(java.util.Calendar.DAY_OF_MONTH, 1);
|
|
|
Date todayEnd = calendar.getTime();
|
|
|
|
|
|
- // 查询当日该红娘上传的资源数量
|
|
|
+ // 查询当日该红娘上传的线索数量(只统计未注册用户,isUser=0或null)
|
|
|
QueryWrapper<MyResource> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("matchmaker_id", matchmakerId)
|
|
|
.ge("create_time", todayStart)
|
|
|
- .lt("create_time", todayEnd);
|
|
|
+ .lt("create_time", todayEnd)
|
|
|
+ .and(wrapper -> wrapper.eq("is_user", 0).or().isNull("is_user"));
|
|
|
|
|
|
long count = this.count(queryWrapper);
|
|
|
return (int) count;
|