@@ -0,0 +1,33 @@ | |||
HELP.md | |||
target/ | |||
!.mvn/wrapper/maven-wrapper.jar | |||
!**/src/main/**/target/ | |||
!**/src/test/**/target/ | |||
### STS ### | |||
.apt_generated | |||
.classpath | |||
.factorypath | |||
.project | |||
.settings | |||
.springBeans | |||
.sts4-cache | |||
### IntelliJ IDEA ### | |||
.idea | |||
*.iws | |||
*.iml | |||
*.ipr | |||
### NetBeans ### | |||
/nbproject/private/ | |||
/nbbuild/ | |||
/dist/ | |||
/nbdist/ | |||
/.nb-gradle/ | |||
build/ | |||
!**/src/main/**/build/ | |||
!**/src/test/**/build/ | |||
### VS Code ### | |||
.vscode/ |
@@ -17,4 +17,8 @@ public class DspConstant { | |||
* 获取算法的调度包行业信息及对应的算法实例 | |||
*/ | |||
public static final String FIND_EXAMPLE = "/industryServiceInst/list"; | |||
/** | |||
* 获取算法的调度包行业信息及对应的算法实例 | |||
*/ | |||
public static final String FIND_MODELIST = "/industryServiceInst/getModelList"; | |||
} |
@@ -1,7 +1,11 @@ | |||
package com.tuoheng.model.param; | |||
import com.tuoheng.third.request.ModelInfoDao; | |||
import com.tuoheng.third.vo.ModelInfoVo; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @author chenjiandong | |||
* @description: TODO | |||
@@ -16,8 +20,7 @@ public class ClientRoleDto { | |||
/** | |||
* 该平台对应服务实例id(多个逗号隔开) | |||
*/ | |||
private String serviceId;; | |||
private String serviceId; | |||
/** | |||
* 该平台对应角色id | |||
*/ | |||
@@ -27,4 +30,14 @@ public class ClientRoleDto { | |||
* 角色名 | |||
*/ | |||
private String roleName; | |||
/** | |||
* 服务实例名称 | |||
*/ | |||
private String serviceName; | |||
/** | |||
* 模型集合及其对应检测目标集合 | |||
*/ | |||
private List<ModelInfoDao> modelInfoDaos; | |||
} |
@@ -78,10 +78,4 @@ public class CreateClientTenantDto { | |||
* 1 启用 0禁用 | |||
*/ | |||
private Integer status; | |||
///** | |||
// *是否包含机场平台 | |||
// */ | |||
// | |||
//private Boolean isAirport; | |||
} |
@@ -35,6 +35,7 @@ import com.tuoheng.model.vo.CreateTenantVo; | |||
import com.tuoheng.model.vo.TenantVo; | |||
import com.tuoheng.model.vo.UserVo; | |||
import com.tuoheng.service.TenantService; | |||
import com.tuoheng.third.service.impl.ThirdServiceImpl; | |||
import com.tuoheng.until.JsonResult; | |||
import com.tuoheng.until.MapUtils; | |||
import lombok.extern.slf4j.Slf4j; | |||
@@ -75,6 +76,8 @@ public class TenantServiceImpl implements TenantService { | |||
@Autowired | |||
private RestTemplate restTemplate; | |||
@Autowired | |||
private ThirdServiceImpl thirdService; | |||
@Autowired | |||
private PlatformMapper platformMapper; | |||
@@ -190,6 +193,9 @@ public class TenantServiceImpl implements TenantService { | |||
clientUserRoleMapper.batchInsert(clientUserRolePoArrayList); | |||
//todo:调用业务系统完成租户创建 | |||
List<ClientRoleDto> list = createClientTenantDto.getClientRoleDtoList(); | |||
list = thirdService.getModelList(list); | |||
createClientTenantDto.setClientRoleDtoList(list); | |||
for (ClientRoleDto clientRoleDto : list) { | |||
try { | |||
log.info("参数:{}", clientRoleDto.toString()); | |||
@@ -613,6 +619,7 @@ public class TenantServiceImpl implements TenantService { | |||
log.info("删除集合:{}", deleteClientRoleDtoList.toString()); | |||
log.info("交集集合:{}", coincideClientRoleDtoList.toString()); | |||
//交集集合做更新操作 editTenant | |||
clientTenantDto.setClientRoleDtoList(thirdService.getModelList(clientTenantDto.getClientRoleDtoList())); | |||
for (ClientRoleDto clientRoleDto : coincideClientRoleDtoList) { | |||
try { | |||
editResult(clientTenantDto, clientRoleDto.getClientId(), DictConstant.EDIT_TENANT, loginUser); | |||
@@ -692,6 +699,7 @@ public class TenantServiceImpl implements TenantService { | |||
if (CollectionUtil.isNotEmpty(insertClientRoleDtoList)) { | |||
//todo:调用业务系统完成租户创建 | |||
dto.setClientRoleDtoList(thirdService.getModelList(dto.getClientRoleDtoList())); | |||
for (ClientRoleDto clientRoleDto : insertClientRoleDtoList) { | |||
try { | |||
log.info("参数:{}", clientRoleDto.toString()); |
@@ -0,0 +1,24 @@ | |||
package com.tuoheng.third.request; | |||
import lombok.Data; | |||
@Data | |||
public class ModelInfoDao { | |||
private String id; | |||
private String serviceInstId; | |||
private String modelId; | |||
private String modelName; | |||
private String detectTargetsId; | |||
private String detectTargetsName; | |||
private String detectTargetsCode; | |||
private String serviceName; | |||
} |
@@ -1,9 +1,12 @@ | |||
package com.tuoheng.third.service; | |||
import com.tuoheng.model.dto.LoginUser; | |||
import com.tuoheng.model.param.ClientRoleDto; | |||
import com.tuoheng.third.request.ThirdRequest; | |||
import com.tuoheng.until.JsonResult; | |||
import java.util.List; | |||
public interface ThirdService { | |||
/** | |||
* dsp -获取算法实例 | |||
@@ -27,4 +30,11 @@ public interface ThirdService { | |||
* @return | |||
*/ | |||
JsonResult getMenuList(ThirdRequest request, LoginUser loginUser); | |||
/** | |||
* 获取对应算法实例及其对应名称及其相关模型监测目标等 | |||
* @param list | |||
* @return | |||
*/ | |||
List<ClientRoleDto> getModelList(List<ClientRoleDto> list); | |||
} |
@@ -15,6 +15,8 @@ import com.tuoheng.model.dto.LoginUser; | |||
import com.tuoheng.model.dto.Platform; | |||
import com.tuoheng.model.dto.RoleDto; | |||
import com.tuoheng.model.entity.DictData; | |||
import com.tuoheng.model.param.ClientRoleDto; | |||
import com.tuoheng.third.request.ModelInfoDao; | |||
import com.tuoheng.third.request.ThirdRequest; | |||
import com.tuoheng.third.service.ThirdService; | |||
import com.tuoheng.third.vo.*; | |||
@@ -24,6 +26,8 @@ import org.springframework.beans.factory.annotation.Autowired; | |||
import org.springframework.core.ParameterizedTypeReference; | |||
import org.springframework.http.*; | |||
import org.springframework.stereotype.Service; | |||
import org.springframework.util.CollectionUtils; | |||
import org.springframework.util.StringUtils; | |||
import org.springframework.web.client.RestTemplate; | |||
import java.util.*; | |||
@@ -80,6 +84,42 @@ public class ThirdServiceImpl implements ThirdService { | |||
return JsonResult.success(serviceInstListVoList); | |||
} | |||
/** | |||
* 根据serviceIds获取对面模型集合相关 | |||
* | |||
* @return | |||
*/ | |||
@Override | |||
public List<ClientRoleDto> getModelList(List<ClientRoleDto> list) { | |||
for (ClientRoleDto clientRoleDto : list) { | |||
if (ObjectUtil.isNotEmpty(clientRoleDto.getServiceId())) { | |||
List<String> collect = Arrays.stream(clientRoleDto.getServiceId().split(",")).collect(Collectors.toList()); | |||
String param = collect.toString().replace("[", "").replace("]", ""); | |||
String url = CommonConfig.dspURL + DspConstant.FIND_MODELIST + "?serviceIds=" + param; | |||
ParameterizedTypeReference<JsonResult<List<ModelInfoDao>>> parameterizedTypeReference = | |||
new ParameterizedTypeReference<JsonResult<List<ModelInfoDao>>>() { | |||
}; | |||
ResponseEntity<JsonResult<List<ModelInfoDao>>> response; | |||
try { | |||
log.info("url:{}", url); | |||
response = restTemplate.exchange(url, HttpMethod.GET, null, parameterizedTypeReference); | |||
} catch (Exception e) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "请求发送内部出现异常!"); | |||
} | |||
if (null == response || !response.hasBody() || response.getBody().getCode() != JsonResult.SUCCESS) { | |||
throw new ServiceException(HttpStatus.BAD_REQUEST.value(), "dsp获取服务实例异常"); | |||
} | |||
List<ModelInfoDao> modelInfoDaos = response.getBody().getData(); | |||
clientRoleDto.setModelInfoDaos(modelInfoDaos); | |||
} | |||
} | |||
return list; | |||
} | |||
/** | |||
* 查询对应业务平台的所有角色 | |||
* |
@@ -0,0 +1,27 @@ | |||
package com.tuoheng.third.vo; | |||
import lombok.Data; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/9/13 10:22 | |||
*/ | |||
@Data | |||
public class DetectTargetsVo { | |||
/** | |||
* 检测目标id | |||
*/ | |||
private String detectTargetsId; | |||
/** | |||
* 检测目标名称 | |||
*/ | |||
private String detectTargetsName; | |||
/** | |||
* 检测目标code | |||
*/ | |||
private String detectTargetsCode; | |||
} |
@@ -0,0 +1,25 @@ | |||
package com.tuoheng.third.vo; | |||
import lombok.Data; | |||
import java.util.List; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/9/13 10:22 | |||
*/ | |||
@Data | |||
public class ModelInfoVo { | |||
/** | |||
* 模型id | |||
*/ | |||
private String modelId; | |||
/** | |||
* 模型名称 | |||
*/ | |||
private String modelName; | |||
/** | |||
* 检测目标集合 | |||
*/ | |||
private List<DetectTargetsVo> detectTargetsVoList; | |||
} |
@@ -22,7 +22,7 @@ public class ServiceExampleVo { | |||
*/ | |||
private String name; | |||
/** | |||
* 服务实例id | |||
* 服务实例详情 | |||
*/ | |||
private String description; | |||
} |
@@ -71,7 +71,7 @@ tuoheng: | |||
#airport配置地址 | |||
airport-url: https://airport-test.t-aaron.com | |||
#dsp配置地址 | |||
dsp-url: http://106.15.64.139:7011/api/web/dsp | |||
dsp-url: http://192.168.11.11:7011/api/web/dsp | |||
# 高德Key | |||
gaodeKey: 5a1f63e7563cba471a9d0773e218144a | |||
# 图片域名 |
@@ -1,5 +1,7 @@ | |||
package com.tuoheng; | |||
import com.tuoheng.model.param.ClientRoleDto; | |||
import com.tuoheng.third.service.impl.ThirdServiceImpl; | |||
import org.junit.Test; | |||
import org.junit.runner.RunWith; | |||
import org.springframework.beans.factory.annotation.Autowired; | |||
@@ -7,6 +9,9 @@ import org.springframework.boot.test.context.SpringBootTest; | |||
import org.springframework.security.crypto.password.PasswordEncoder; | |||
import org.springframework.test.context.junit4.SpringRunner; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
/** | |||
* @Author xiaoying | |||
* @Date 2023/2/21 11:12 | |||
@@ -17,6 +22,8 @@ public class passwordTest { | |||
@Autowired | |||
PasswordEncoder passwordEncoder; | |||
@Autowired | |||
ThirdServiceImpl thirdService; | |||
/* | |||
明文,加密成密文 | |||
*/ | |||
@@ -36,4 +43,20 @@ public class passwordTest { | |||
boolean matches = passwordEncoder.matches(password, encode); | |||
System.out.println(matches); | |||
} | |||
@Test | |||
public void getModelList() { | |||
List<ClientRoleDto> list =new ArrayList<>(); | |||
ClientRoleDto clientRoleDto = new ClientRoleDto(); | |||
clientRoleDto.setServiceId("85b0fe8a352c4dbda6191a382362a81a"); | |||
ClientRoleDto clientRoleDto2 = new ClientRoleDto(); | |||
clientRoleDto.setServiceId("e5137ec466db426c96a8b194a6853b77"); | |||
list.add(clientRoleDto); | |||
list.add(clientRoleDto2); | |||
List<ClientRoleDto> modelList = thirdService.getModelList(list); | |||
System.out.println("modelList = " + modelList); | |||
} | |||
} |
@@ -21,7 +21,7 @@ spring: | |||
# 最小连接池数量 | |||
minIdle: 5 | |||
# 最大连接池数量 | |||
maxActive: 20 | |||
maxActive: 50 | |||
# 配置获取连接等待超时的时间 | |||
maxWait: 60000 | |||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 |
@@ -3,7 +3,7 @@ server: | |||
spring: | |||
profiles: | |||
active: test | |||
active: dev | |||
web: | |||
resources: | |||
static-locations: classpath:/ |
@@ -3,7 +3,7 @@ server: | |||
spring: | |||
profiles: | |||
active: test | |||
active: dev | |||
web: | |||
resources: | |||
static-locations: classpath:/ |
@@ -25,6 +25,7 @@ com\tuoheng\config\AuthorizationServerConfig.class | |||
com\tuoheng\config\MyCorsFilter.class | |||
com\tuoheng\config\JWKSourceConfig.class | |||
com\tuoheng\mapper\AuthoritiesMapper.class | |||
com\tuoheng\exception\DiyException.class | |||
com\tuoheng\controller\HealthController.class | |||
com\tuoheng\oauth2\authentication\OAuth2ResourceOwnerPasswordAuthenticationConverter.class | |||
com\tuoheng\model\po\AuthoritiesPo.class | |||
@@ -33,6 +34,5 @@ com\tuoheng\model\dto\UserBaseInfoDto.class | |||
com\tuoheng\oauth2\authentication\OAuth2EndpointUtils.class | |||
com\tuoheng\model\param\CreateUserDto.class | |||
com\tuoheng\oauth2\authentication\OAuth2ResourceOwnerPasswordAuthenticationProvider.class | |||
com\tuoheng\model\dto\AuthoritiesDto.class | |||
com\tuoheng\service\OidcUserInfoService.class | |||
com\tuoheng\model\param\GetUserInfoDto.class |
@@ -2,6 +2,7 @@ D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\ | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\config\VerifyCodeFilter.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\model\dto\UserBaseInfoDto.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\service\impl\OidcUserInfoServiceImpl.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\exception\DiyException.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\oauth2\authentication\OAuth2ResourceOwnerPasswordAuthenticationConverter.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\config\MyCorsFilter.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\service\impl\UserServiceImpl.java | |||
@@ -14,7 +15,6 @@ D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\ | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\model\dto\ClientRoleDto.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\oauth2\authentication\OAuth2ResourceOwnerPasswordAuthenticationProvider.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\mapper\AuthoritiesMapper.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\model\dto\AuthoritiesDto.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\oauth2\authentication\OAuth2ResourceOwnerPasswordAuthenticationToken.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\model\param\CreateUserDto.java | |||
D:\myprojects\tuohen\tuoheng_oidc\tuoheng_oidc_server\src\main\java\com\tuoheng\model\po\AuthoritiesPo.java |