|
@@ -9,6 +9,7 @@ import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
+import org.springframework.transaction.annotation.Propagation;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import shop.alien.entity.second.LifeUserLog;
|
|
import shop.alien.entity.second.LifeUserLog;
|
|
|
import shop.alien.entity.second.SecondRiskControlRecord;
|
|
import shop.alien.entity.second.SecondRiskControlRecord;
|
|
@@ -157,7 +158,8 @@ public class LifeUserService extends ServiceImpl<LifeUserGatewayMapper, LifeUser
|
|
|
if (count > 0) {
|
|
if (count > 0) {
|
|
|
String startDate = LocalDateTime.now().minusHours(24L).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
String startDate = LocalDateTime.now().minusHours(24L).format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
String endDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
String endDate = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
|
|
|
- List<LifeUserLog> lsit = lifeUserLogMapper.getLifeUserLogByDate(startDate, endDate, macIp);
|
|
|
|
|
|
|
+ // 使用一个新的事务来查询,确保能看到刚才插入的数据
|
|
|
|
|
+ List<LifeUserLog> lsit = getLifeUserLogByDateInNewTransaction(startDate, endDate, macIp);
|
|
|
|
|
|
|
|
if (lsit.size() > riskControlProperties.getAccountAbnormal().getRegCount24h() && !isViolation(startDate, endDate, macIp, user.getId())) {
|
|
if (lsit.size() > riskControlProperties.getAccountAbnormal().getRegCount24h() && !isViolation(startDate, endDate, macIp, user.getId())) {
|
|
|
String detailInfo = lsit.stream()
|
|
String detailInfo = lsit.stream()
|
|
@@ -174,6 +176,11 @@ public class LifeUserService extends ServiceImpl<LifeUserGatewayMapper, LifeUser
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Transactional(propagation = Propagation.REQUIRES_NEW)
|
|
|
|
|
+ public List<LifeUserLog> getLifeUserLogByDateInNewTransaction(String startDate, String endDate, String macIp) {
|
|
|
|
|
+ return lifeUserLogMapper.getLifeUserLogByDate(startDate, endDate, macIp);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
public boolean isViolation(String startDate, String endDate, String macIp, Integer userId) {
|
|
public boolean isViolation(String startDate, String endDate, String macIp, Integer userId) {
|
|
|
List<SecondRiskControlRecord> list = secondRiskControlRecordMapper.selectByBusinessId(startDate, endDate, macIp);
|
|
List<SecondRiskControlRecord> list = secondRiskControlRecordMapper.selectByBusinessId(startDate, endDate, macIp);
|
|
|
for (SecondRiskControlRecord record : list) {
|
|
for (SecondRiskControlRecord record : list) {
|