|
|
@@ -11,6 +11,8 @@ import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.github.pagehelper.PageHelper;
|
|
|
import com.github.pagehelper.PageInfo;
|
|
|
+import com.ytpm.agent.enums.UserStatusEnum;
|
|
|
+import com.ytpm.agent.model.YtApp;
|
|
|
import com.ytpm.agent.model.YtPlatformBanned;
|
|
|
import com.ytpm.agent.model.YtPlatformDeblocking;
|
|
|
import com.ytpm.agent.model.YtPlatformUserApp;
|
|
|
@@ -23,6 +25,7 @@ import com.ytpm.app.param.AppUserParam;
|
|
|
import com.ytpm.custom.CustomField;
|
|
|
import com.ytpm.dao.AgentAppMapper;
|
|
|
import com.ytpm.dao.AgentDictMapper;
|
|
|
+import com.ytpm.dao.AppMapper;
|
|
|
import com.ytpm.dao.RiskMapper;
|
|
|
import com.ytpm.general.RepMessage;
|
|
|
import com.ytpm.general.Result;
|
|
|
@@ -53,8 +56,10 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
+import javax.annotation.Resource;
|
|
|
import java.lang.reflect.Field;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.Arrays;
|
|
|
import java.util.Collections;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
@@ -76,7 +81,9 @@ public class RiskServiceImpl implements RiskService {
|
|
|
@Autowired
|
|
|
private RiskMapper riskMapper;
|
|
|
@Autowired
|
|
|
- private AgentAppMapper appMapper;
|
|
|
+ private AgentAppMapper agentAppMapper;
|
|
|
+ @Resource
|
|
|
+ private AppMapper appMapper;
|
|
|
@Autowired
|
|
|
private AgentDictMapper dictMapper;
|
|
|
@Autowired
|
|
|
@@ -113,8 +120,24 @@ public class RiskServiceImpl implements RiskService {
|
|
|
if(StrUtil.isBlank(param.getUserIds())){
|
|
|
return Result.resultErr("请选择封禁用户");
|
|
|
}
|
|
|
- String[] split = param.getUserIds().split(",");
|
|
|
- for (String userId : split) { // 为避免大量解锁的key再同一时间过期, 这里采用随机数
|
|
|
+ List<String> userIds = Arrays.asList(param.getUserIds().split(","));
|
|
|
+
|
|
|
+ // 母包封禁
|
|
|
+ if (param.getIfSuperiorBanned() != null && param.getIfSuperiorBanned() == 1) {
|
|
|
+ YtApp ytApp = appMapper.selectPrimary(param.getAppId());
|
|
|
+ YtPlatformUserApp platformUserApp = ytApp == null ? null : agentAppMapper.selectByPrimaryKey(ytApp.getSuperiorId());
|
|
|
+ if (platformUserApp != null) {
|
|
|
+ Object obj = feignInvoker.invoke(platformUserApp.getServiceName(), "queryAllDitchUser",
|
|
|
+ param.getUserIds());
|
|
|
+ if (obj != null) {
|
|
|
+ List<YtDyzUser> dyzUsers = JSONArray.parseArray(JSON.toJSONString(obj), YtDyzUser.class);
|
|
|
+ userIds = dyzUsers.stream()
|
|
|
+ .filter(user-> UserStatusEnum.NORMAL.getCode().equals(user.getUserStatus()))
|
|
|
+ .map(YtDyzUser::getUserId).collect(Collectors.toList());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ for (String userId : userIds) { // 为避免大量解锁的key再同一时间过期, 这里采用随机数
|
|
|
redisService.setTimeOutStr("lock_"+userId,param.getAppId(),RandomUtil.randomInt(500, 2000));
|
|
|
addBannedRecord(userId,curUser,param.getAppId(),param.getBannedLimit()*24, param.getBannedReason());
|
|
|
//预设20-24小时过期key 用于解锁用户
|
|
|
@@ -166,7 +189,7 @@ public class RiskServiceImpl implements RiskService {
|
|
|
PageHelper.startPage(param.getPage(),param.getLimit());
|
|
|
List<RiskBannedListView> bannedList = riskMapper.getBannedList(param);
|
|
|
if(CollUtil.isNotEmpty(bannedList)){
|
|
|
- List<YtPlatformUserApp> issuedAppList = appMapper.getIssuedAppList(param.getAgentId());
|
|
|
+ List<YtPlatformUserApp> issuedAppList = agentAppMapper.getIssuedAppList(param.getAgentId());
|
|
|
if(CollUtil.isEmpty(issuedAppList)){
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(bannedList));
|
|
|
}
|
|
|
@@ -189,7 +212,7 @@ public class RiskServiceImpl implements RiskService {
|
|
|
PageHelper.startPage(param.getPage(),param.getLimit());
|
|
|
List<RiskDeblockingListView> deblockingList = riskMapper.getDeblockingList(param);
|
|
|
if(CollUtil.isNotEmpty(deblockingList)){
|
|
|
- List<YtPlatformUserApp> issuedAppList = appMapper.getIssuedAppList(param.getAgentId());
|
|
|
+ List<YtPlatformUserApp> issuedAppList = agentAppMapper.getIssuedAppList(param.getAgentId());
|
|
|
if(CollUtil.isEmpty(issuedAppList)){
|
|
|
return ResultTable.resultTableOk(new PageInfo<>(deblockingList));
|
|
|
}
|