|
|
@@ -10,6 +10,7 @@ import com.ytpm.agent.enums.UserStatusEnum;
|
|
|
import com.ytpm.agent.model.YtAppUser;
|
|
|
import com.ytpm.agent.model.YtPlatformBanned;
|
|
|
import com.ytpm.agent.model.YtPlatformDeblocking;
|
|
|
+import com.ytpm.agent.view.AgentEnableAppView;
|
|
|
import com.ytpm.app.model.YtAppUserLoginRecord;
|
|
|
import com.ytpm.app.view.YtAppUserListView;
|
|
|
import com.ytpm.custom.CustomField;
|
|
|
@@ -104,7 +105,6 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
|
|
|
if(CollUtil.isEmpty(param.getConfigList())){
|
|
|
return Result.resultErr(RepMessage.COLLECTION_EMPTY);
|
|
|
}
|
|
|
- YtRiskTemplate template = new YtRiskTemplate();
|
|
|
List<YtRiskConfig> configs = new ArrayList<>();
|
|
|
YtRiskConfig config;
|
|
|
StringBuilder content = new StringBuilder();
|
|
|
@@ -120,14 +120,27 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
|
|
|
configs.add(config);
|
|
|
}
|
|
|
configMapper.insertAll(configs);
|
|
|
+ addTemplateAndRelative(param,content.toString(),configs);
|
|
|
+ return Result.resultOk(RepMessage.SAVE_SUCCESS);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增模版和关联配置
|
|
|
+ */
|
|
|
+ private void addTemplateAndRelative(RiskConfigParam param,String content,List<YtRiskConfig> configs) {
|
|
|
+ YtRiskTemplate template = new YtRiskTemplate();
|
|
|
BeanUtil.copyProperties(param,template);
|
|
|
template.setTemplateId(IdUtil.fastSimpleUUID());
|
|
|
- template.setTemplateContent(content.toString());
|
|
|
+ template.setTemplateContent(content);
|
|
|
template.setEnabled(0);
|
|
|
template.setCreateUserId(param.getChannelId());
|
|
|
template.setCreateTime(new Date());
|
|
|
configMapper.saveTemplate(template);
|
|
|
- return Result.resultOk(RepMessage.SAVE_SUCCESS);
|
|
|
+
|
|
|
+ configMapper.addRelease(template.getTemplateId(),
|
|
|
+ configs.stream().map(YtRiskConfig::getConfigId).collect(Collectors.toList()),
|
|
|
+ param.getOperator(),param.getOperatorName()
|
|
|
+ );
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -238,8 +251,8 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Result<?> relativeApp(RiskRelativeAppParam param) {
|
|
|
- List<String> appIdList = param.getAppIdList();
|
|
|
- if(CollUtil.isEmpty(appIdList)){
|
|
|
+ List<AgentEnableAppView> appList = param.getAppList();
|
|
|
+ if(CollUtil.isEmpty(appList)){
|
|
|
return Result.resultErr(RepMessage.COLLECTION_EMPTY);
|
|
|
}
|
|
|
riskManageMapper.deleteRelatives(param.getTemplateId());
|
|
|
@@ -293,7 +306,7 @@ public class RiskServiceImpl extends ReflectUtil implements RiskService {
|
|
|
config.setConfigId(listParam.getConfigId());
|
|
|
config.setConfigVal(listParam.getConfigVal());
|
|
|
configMapper.updateConfigVal(config);
|
|
|
- String format = String.format(config.getFieldDesc(), config.getConfigVal());
|
|
|
+ String format = String.format(listParam.getFieldDesc(), listParam.getConfigVal());
|
|
|
if(StrUtil.isNotBlank(format)){
|
|
|
content.append(format).append(",");
|
|
|
}
|