Merge branch 'jenkins_with_weblogic' of ssh://192.168.240.178:18081/eapim/eapim-admin into jenkins_with_weblogic
This commit is contained in:
+22
-19
@@ -5,6 +5,7 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.MethodParameter;
|
||||
import org.springframework.http.MediaType;
|
||||
import org.springframework.http.converter.HttpMessageConverter;
|
||||
import org.springframework.http.converter.StringHttpMessageConverter;
|
||||
import org.springframework.http.server.ServerHttpRequest;
|
||||
import org.springframework.http.server.ServerHttpResponse;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
@@ -25,6 +26,7 @@ public class EmptyJsonResponseAdviceController implements ResponseBodyAdvice<Obj
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EmptyJsonResponseAdviceController.class);
|
||||
private static final Map<String, Object> EMPTY_JSON = Collections.emptyMap();
|
||||
private static final String EMPTY_JSON_STRING = "{}";
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
@@ -42,24 +44,25 @@ public class EmptyJsonResponseAdviceController implements ResponseBodyAdvice<Obj
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request,
|
||||
ServerHttpResponse response) {
|
||||
|
||||
// .json 요청이 아니면 원본 그대로 반환
|
||||
String path = request.getURI().getPath();
|
||||
if (path == null || !path.endsWith(".json")) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// 빈 응답인 경우 빈 JSON 객체로 변환
|
||||
if (body == null) {
|
||||
logger.debug("빈 응답 감지 (null), {} 로 변환: {}", path);
|
||||
return EMPTY_JSON;
|
||||
}
|
||||
|
||||
// String 타입의 빈 응답 처리
|
||||
if (body instanceof String && ((String) body).isEmpty()) {
|
||||
logger.debug("빈 응답 감지 (empty string), {} 로 변환: {}", path);
|
||||
return EMPTY_JSON;
|
||||
}
|
||||
|
||||
return body;
|
||||
String path = request.getURI().getPath();
|
||||
|
||||
// .json 요청이 아니면 원본 그대로 반환
|
||||
if (path == null || !path.endsWith(".json")) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// 정상적인 응답이 있는 경우, String 타입의 빈 응답 처리
|
||||
if (body != null && !(body instanceof String && ((String) body).isEmpty())) {
|
||||
return body;
|
||||
}
|
||||
|
||||
// Controller 리턴타입이 String 일 때 cannot be cast 에러 대응
|
||||
logger.debug("빈 응답 감지, {} 로 변환 시도. 선택된 컨버터: {}", path, selectedConverterType.getSimpleName());
|
||||
|
||||
if (StringHttpMessageConverter.class.isAssignableFrom(selectedConverterType)) {
|
||||
return EMPTY_JSON_STRING; // 문자열 "{}" 반환
|
||||
}
|
||||
|
||||
return EMPTY_JSON; // Map 객체 반환
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,6 +9,9 @@ import lombok.Data;
|
||||
@AllArgsConstructor
|
||||
public class ApiScopeDto {
|
||||
|
||||
@JsonProperty("EAISVCNAME")
|
||||
private String eaiSvcName;
|
||||
|
||||
@JsonProperty("EAISVCDESC")
|
||||
private String eaiSvcDesc;
|
||||
|
||||
@@ -20,5 +23,8 @@ public class ApiScopeDto {
|
||||
|
||||
@JsonProperty("SCOPENAME")
|
||||
private String scopeName;
|
||||
|
||||
@JsonProperty("APIFULLPATH")
|
||||
private String apiFullPath;
|
||||
|
||||
}
|
||||
|
||||
@@ -59,6 +59,8 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
, qServiceMessageEntity.psvsysadptrbzwkgroupname
|
||||
, qRouting.nonmotivrouturiname
|
||||
, qStdInfo.apifullpath
|
||||
, qStdInfo.bzwksvckeyname
|
||||
|
||||
)
|
||||
.limit(pageable.getPageSize())
|
||||
.offset(pageable.getOffset())
|
||||
@@ -111,6 +113,7 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
, qServiceMessageEntity.psvintfacdsticname
|
||||
, qRouting.nonmotivrouturiname
|
||||
, qStdInfo.apifullpath
|
||||
, qStdInfo.bzwksvckeyname
|
||||
)
|
||||
.from(qeaiMessageEntity)
|
||||
.join(qRouting)
|
||||
@@ -290,10 +293,14 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
|
||||
List<ApiScopeDto> result = getJPAQueryFactory()
|
||||
.select(Projections.constructor(ApiScopeDto.class ,
|
||||
qEaiMessageEntity.eaisvcname ,
|
||||
qEaiMessageEntity.eaisvcdesc ,
|
||||
qScopeEntity.id.scopeid ,
|
||||
qScopeEntity.id.bzwksvckeyname ,
|
||||
qScopeInfo.scopeName ))
|
||||
qScopeInfo.scopeName ,
|
||||
qStandardMessageInfo.apifullpath
|
||||
)
|
||||
)
|
||||
.from(qEaiMessageEntity)
|
||||
.join(qStandardMessageInfo)
|
||||
.on(qEaiMessageEntity.eaisvcname.eq(qStandardMessageInfo.eaisvcname))
|
||||
@@ -313,19 +320,20 @@ public class EAIMessageService extends AbstractDataService<EAIMessageEntity, Str
|
||||
private BooleanExpression booleanPredicate(QEAIMessageEntity qEaiMessageEntity, QScopeEntity qScopeEntity,
|
||||
QScopeInfo qScopeInfo, ApiScopeSearch apiScopeSearch) {
|
||||
|
||||
BooleanExpression predicate = qEaiMessageEntity.eaisvcdesc.containsIgnoreCase(apiScopeSearch.getSearchEaiSvcDesc());
|
||||
BooleanExpression predicate = qScopeEntity.id.scopeid.containsIgnoreCase(apiScopeSearch.getSearchScopeId());
|
||||
// BooleanExpression predicate = qEaiMessageEntity.eaisvcdesc.containsIgnoreCase(apiScopeSearch.getSearchEaiSvcDesc());
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchBzwkSvcKeyName())) {
|
||||
predicate = predicate.and(qScopeEntity.id.bzwksvckeyname.containsIgnoreCase(apiScopeSearch.getSearchBzwkSvcKeyName()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeId())) {
|
||||
predicate = predicate.and(qScopeEntity.id.scopeid.containsIgnoreCase(apiScopeSearch.getSearchScopeId()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeName())) {
|
||||
predicate = predicate.and(qScopeInfo.scopeName.containsIgnoreCase(apiScopeSearch.getSearchScopeName()));
|
||||
}
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchBzwkSvcKeyName())) {
|
||||
// predicate = predicate.and(qScopeEntity.id.bzwksvckeyname.containsIgnoreCase(apiScopeSearch.getSearchBzwkSvcKeyName()));
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeId())) {
|
||||
// predicate = predicate.and(qScopeEntity.id.scopeid.containsIgnoreCase(apiScopeSearch.getSearchScopeId()));
|
||||
// }
|
||||
//
|
||||
// if(StringUtils.isNotBlank(apiScopeSearch.getSearchScopeName())) {
|
||||
// predicate = predicate.and(qScopeInfo.scopeName.containsIgnoreCase(apiScopeSearch.getSearchScopeName()));
|
||||
// }
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
@@ -4,6 +4,15 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.eaimsg.ApiScopeSearch;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@@ -11,6 +20,7 @@ import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
@@ -53,6 +63,25 @@ public class ApiScopeController extends OnlBaseAnnotationController {
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/admin/authserver/apiScopeMan.json", params = "cmd=INSERT_APILIST")
|
||||
public ResponseEntity<Void> insertApiScopeList(@RequestParam("apiList") String apiListJson, @RequestParam("scopeId") String scopeId) {
|
||||
|
||||
ObjectMapper mapper = new ObjectMapper();
|
||||
List<ApiScopeUI> apiScopeList = null;
|
||||
|
||||
try {
|
||||
apiScopeList = mapper.readValue(apiListJson, new TypeReference<List<ApiScopeUI>>(){});
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new BizException("데이터 변환 중 오류가 발생했습니다.");
|
||||
}
|
||||
|
||||
apiScopeManService.insertApiScopeRelationList(apiScopeList, scopeId);
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/onl/admin/authserver/apiScopeMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> deleteApiScope(ApiScopeUI apiScopeUI) {
|
||||
apiScopeManService.deleteApiScopeRelation(apiScopeUI);
|
||||
|
||||
+31
-1
@@ -11,6 +11,8 @@ import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.agent.authserver.ReloadApiScopeCommand;
|
||||
import com.eactive.eai.agent.command.CommonCommand;
|
||||
import com.eactive.eai.rms.common.base.OnlBaseService;
|
||||
import com.eactive.eai.rms.common.spring.LocaleMessage;
|
||||
import com.eactive.eai.rms.data.entity.onl.authserver.ScopeEntityService;
|
||||
@@ -56,10 +58,12 @@ public class ApiScopeManService extends OnlBaseService {
|
||||
|
||||
private ApiScopeUI convertToApiScopeUI(ApiScopeDto dto) {
|
||||
ApiScopeUI apiScopeUI = new ApiScopeUI();
|
||||
apiScopeUI.setEaiSvcDesc(dto.getEaiSvcDesc());
|
||||
apiScopeUI.setApiDesc(dto.getEaiSvcDesc());
|
||||
apiScopeUI.setScopeId(dto.getScopeId());
|
||||
apiScopeUI.setBzwkSvcKeyName(dto.getBzwkSvcKeyName());
|
||||
apiScopeUI.setScopeName(dto.getScopeName());
|
||||
apiScopeUI.setApiFullPath(dto.getApiFullPath());
|
||||
apiScopeUI.setApiId(dto.getEaiSvcName());
|
||||
return apiScopeUI;
|
||||
}
|
||||
|
||||
@@ -72,6 +76,32 @@ public class ApiScopeManService extends OnlBaseService {
|
||||
scopeEntityService.save(apiScopeUIMapper.toEntity(apiScopeUI));
|
||||
}
|
||||
|
||||
public void insertApiScopeRelationList(List<ApiScopeUI> apiScopeList, String scopeId) {
|
||||
// ScopeId 기준 전체 삭제 후 LIST 기준으로 저장.
|
||||
if(scopeId == null || scopeId.isEmpty()) {
|
||||
throw new BizException("ScopeId 가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
scopeEntityService.deleteByIdScopeId(scopeId);
|
||||
|
||||
if(apiScopeList == null || apiScopeList.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ApiScopeUI ui : apiScopeList) {
|
||||
ui.setScopeId(scopeId);
|
||||
|
||||
scopeEntityService.save(apiScopeUIMapper.toEntity(ui));
|
||||
|
||||
CommonCommand.builder()
|
||||
.name(CommonCommand.RELOAD_API_SCOPE_COMMAND)
|
||||
.args(new String[] {ReloadApiScopeCommand.COMMAND_TYPE_API_SCOPE,
|
||||
ui.getBzwkSvcKeyName(), ui.getScopeId()})
|
||||
.build()
|
||||
.broadcast(agentUtilService);
|
||||
}
|
||||
}
|
||||
|
||||
public void deleteApiScopeRelation(ApiScopeUI apiScopeUI) {
|
||||
scopeEntityService.deleteById(apiScopeUIMapper.toId(apiScopeUI));
|
||||
}
|
||||
|
||||
@@ -1,10 +1,14 @@
|
||||
package com.eactive.eai.rms.onl.manage.authserver.scope;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor // jackson 사용을 위해 추가.
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ApiScopeUI {
|
||||
|
||||
@JsonProperty("SCOPEID")
|
||||
@@ -16,7 +20,13 @@ public class ApiScopeUI {
|
||||
@JsonProperty("SCOPENAME")
|
||||
private String scopeName;
|
||||
|
||||
@JsonProperty("EAISVCDESC")
|
||||
private String eaiSvcDesc;
|
||||
@JsonProperty("apiDesc")
|
||||
private String apiDesc;
|
||||
|
||||
@JsonProperty("APIFULLPATH")
|
||||
private String apiFullPath;
|
||||
|
||||
@JsonProperty("apiId")
|
||||
private String apiId;
|
||||
|
||||
}
|
||||
|
||||
@@ -271,10 +271,12 @@ public class ApiInterfaceController extends OnlBaseAnnotationController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/transaction/apim/apiInterfaceMan.json", params = "cmd=CLONE")
|
||||
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode, String newApiInterfaceId, String newInboundHttpMethod, String newInboundRestPath, boolean importDupliCheck) throws BizException {
|
||||
public ResponseEntity<?> cloneApiInterface(String orgApiInterfaceId, String newBizCode,
|
||||
String newApiInterfaceId, String newInboundHttpMethod,
|
||||
String newInboundRestPath, String newSvcDesc, boolean importDupliCheck) throws BizException {
|
||||
try {
|
||||
ApiInterfaceUI orgApiInterfaceUI = service.selectDetail(orgApiInterfaceId);
|
||||
ApiInterfaceUI apiInterfaceUI = service.cloneApiInterface(orgApiInterfaceUI, newBizCode, newApiInterfaceId, newInboundHttpMethod, newInboundRestPath, importDupliCheck);
|
||||
ApiInterfaceUI apiInterfaceUI = service.cloneApiInterface(orgApiInterfaceUI, newBizCode, newApiInterfaceId, newInboundHttpMethod, newInboundRestPath, newSvcDesc, importDupliCheck);
|
||||
Map<String, Object> resultMap = reloadSync(apiInterfaceUI);
|
||||
return ResponseEntity.ok(resultMap);
|
||||
} catch(Exception e) {
|
||||
|
||||
@@ -139,6 +139,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
EAIMessageEntity eaiMessageEntity = tuple.get(QEAIMessageEntity.eAIMessageEntity);
|
||||
|
||||
String apiFullPath = tuple.get(QStandardMessageInfo.standardMessageInfo.apifullpath);
|
||||
String bzwksvckeyname = tuple.get(QStandardMessageInfo.standardMessageInfo.bzwksvckeyname);
|
||||
|
||||
ApiInterfaceUI apiInterfaceUI;
|
||||
if (eaiMessageEntity.getServiceMessages() != null && eaiMessageEntity.getServiceMessages().size() > 0) {
|
||||
@@ -148,6 +149,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
}
|
||||
|
||||
apiInterfaceUI.setApiFullPath(apiFullPath);
|
||||
apiInterfaceUI.setBzwksvckeyname(bzwksvckeyname);
|
||||
|
||||
return apiInterfaceUI;
|
||||
});
|
||||
@@ -1159,7 +1161,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
|
||||
public ApiInterfaceUI cloneApiInterface(ApiInterfaceUI orgApiInterfaceUI, String newBizCd,
|
||||
String newApiInterfaceId, String newInboundHttpMethod,
|
||||
String newInboundRestPath, boolean importDupliCheck) throws Exception {
|
||||
String newInboundRestPath, String newSvcDesc, boolean importDupliCheck) throws Exception {
|
||||
|
||||
Optional<EAIMessageEntity> optional = eaiMessageQueryService.findById(newApiInterfaceId);
|
||||
if (optional.isPresent()) {
|
||||
@@ -1173,6 +1175,7 @@ public class ApiInterfaceService extends OnlBaseService {
|
||||
apiInterfaceUI.setEaiBzwkDstcd(newBizCd);
|
||||
settingInterfaceId(apiInterfaceUI, newApiInterfaceId);
|
||||
apiInterfaceUI.setEaiSvcName(newApiInterfaceId);
|
||||
apiInterfaceUI.setEaiSvcDesc(newSvcDesc);
|
||||
apiInterfaceUI.setInboundHttpMethod(newInboundHttpMethod);
|
||||
apiInterfaceUI.setInboundRestPath(newInboundRestPath);
|
||||
|
||||
|
||||
@@ -51,6 +51,7 @@ public class ApiInterfaceUI {
|
||||
private List<StdMessageItemUI> inboundResponseStandardMessageItems ;
|
||||
|
||||
private String apiFullPath;
|
||||
private String bzwksvckeyname;
|
||||
|
||||
//ASYNC-SYNC 용
|
||||
private String inboundResponseHttpMethod;
|
||||
|
||||
Reference in New Issue
Block a user