|
@@ -3708,15 +3708,18 @@ public class ApiController {
|
|
|
*/
|
|
|
String date = DateUtil.today() + ":";
|
|
|
System.err.println("DateUtil.today():" + date);
|
|
|
- for (int i = 0; i < drugTableList.size(); i++) {
|
|
|
- WmDaDrugEntDrugtable drug = drugTableList.get(i);
|
|
|
- if (StringUtils.isEmpty(drug.getDrugEntId())) {
|
|
|
- continue;
|
|
|
- }
|
|
|
+
|
|
|
+ Set<String> drugEntIds = drugTableList.stream()
|
|
|
+ .filter(drugTable -> StrUtil.isNotBlank(drugTable.getDrugEntId()))
|
|
|
+ .map(WmDaDrugEntDrugtable::getDrugEntId)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ for (String drugEntId : drugEntIds) {
|
|
|
+
|
|
|
String key = CacheConstants.DRUG_ENT_PERSONAL_SHARE_KEY1 + date
|
|
|
- + drug.getDrugEntId() + CacheConstants.DRUG_ENT_PERSONAL_SHARE_KEY2 + sysUser.getUserId();
|
|
|
+ + drugEntId + CacheConstants.DRUG_ENT_PERSONAL_SHARE_KEY2 + sysUser.getUserId();
|
|
|
System.err.println("key" + key);
|
|
|
- if (redisTemplate.hasKey(key)) {
|
|
|
+ if (Boolean.TRUE.equals(redisTemplate.hasKey(key))) {
|
|
|
int times = Integer.parseInt(redisTemplate.opsForValue().get(key).toString());
|
|
|
if (times >= maxShareTimes) {
|
|
|
return String.format("您当日转发的该药企产品相册%s次,已超过%s次,转发将不再获得积分", times, maxShareTimes);
|
|
@@ -3726,8 +3729,8 @@ public class ApiController {
|
|
|
} else {
|
|
|
redisTemplate.opsForValue().set(key, 1, CacheConstants.SHARE_TIME, TimeUnit.DAYS);
|
|
|
}
|
|
|
-
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
return null;
|