init
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.rms.data;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface EMSDataSource {
|
||||
|
||||
}
|
||||
+86
@@ -0,0 +1,86 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.engine.jdbc.connections.spi.MultiTenantConnectionProvider;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class ConfigurableMultiTenantConnectionProvider implements MultiTenantConnectionProvider {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Autowired
|
||||
private transient DataSource dataSource;
|
||||
|
||||
@Override
|
||||
public Connection getAnyConnection() throws SQLException {
|
||||
return dataSource.getConnection();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseAnyConnection(Connection connection) throws SQLException {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Connection getConnection(String tenantIdentifier) throws SQLException {
|
||||
return changeSchema(dataSource.getConnection(), tenantIdentifier);
|
||||
}
|
||||
|
||||
public Connection changeSchema(Connection connection, String tenantIdentifier) throws SQLException {
|
||||
// connection.setSchema() 를 이용하여 schema를 설정 하려 했으나 postgresql 에서는 대문자로 넣으면 에러가
|
||||
// 발생 한다. 에러가 발생 하지 않게 하려면 applicationContext-datasource.xml 에서 스키마명을 소문자로 변경
|
||||
// 한다.
|
||||
// 일단 schema 설정을 하지 않고 사용
|
||||
String schema = DataSourceTypeManager.getDataSourceType(tenantIdentifier).getSchema();
|
||||
// connection.setSchema(schema);
|
||||
log.debug("change schema : {} connection : {}", schema, connection);
|
||||
return connection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void releaseConnection(String tenantIdentifier, Connection connection) throws SQLException {
|
||||
connection.close();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsAggressiveRelease() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUnwrappableAs(@SuppressWarnings("rawtypes") Class aClass) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> T unwrap(Class<T> aClass) {
|
||||
throw new UnsupportedOperationException("Can't unwrap this.");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@Configuration
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaAuditing(auditorAwareRef = "EMSAuditorAware")
|
||||
@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactoryForEMS", transactionManagerRef = "transactionManagerForEMS", basePackages = {"com.eactive.eai", "com.eactive.apim.portal"}, repositoryBaseClass = BaseRepositoryImpl.class, includeFilters = @Filter(classes = EMSDataSource.class))
|
||||
public class EMSTenantConfiguration {
|
||||
|
||||
@Bean("entityManagerFactoryForEMS")
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactoryForEMS(
|
||||
@Qualifier(DataSourceTypeManager.MONITORING) DataSource dataSource,
|
||||
@Qualifier("hibernateProperties") Properties hibernateProperties) {
|
||||
|
||||
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setPackagesToScan("com.eactive.eai.data", "com.eactive.eai.rms.data", "com.eactive.apim.portal");
|
||||
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
||||
|
||||
bean.setJpaProperties(hibernateProperties);
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean("transactionManagerForEMS")
|
||||
public TransactionManager transactionManager(@Qualifier(DataSourceTypeManager.MONITORING) DataSource dataSource,
|
||||
@Qualifier("entityManagerFactoryForEMS") EntityManagerFactory entityManagerFactory) {
|
||||
JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
|
||||
jpaTransactionManager.setDataSource(dataSource);
|
||||
jpaTransactionManager.setEntityManagerFactory(entityManagerFactory);
|
||||
return jpaTransactionManager;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.persistence.metamodel.EntityType;
|
||||
|
||||
import org.hibernate.annotations.Table;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextRefreshedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EntityTablePrinter implements ApplicationListener<ContextRefreshedEvent> {
|
||||
|
||||
private EntityManagerFactory entityManagerFactory;
|
||||
|
||||
@Autowired
|
||||
public EntityTablePrinter(EntityManagerFactory entityManagerFactory) {
|
||||
this.entityManagerFactory = entityManagerFactory;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextRefreshedEvent event) {
|
||||
if (log.isDebugEnabled() && event.getApplicationContext().getParent() == null) {
|
||||
log.debug("################### TABLE INFO ###################");
|
||||
entityManagerFactory.getMetamodel().getEntities().parallelStream().forEach(this::printEntityTableInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private void printEntityTableInfo(EntityType<?> entityType) {
|
||||
String entityName = entityType.getName();
|
||||
|
||||
// Hibernate Table 정보 출력
|
||||
printTableInfo(entityType, Table.class,
|
||||
table -> log.debug("Table Name : {} = {} ({})", table.appliesTo(), entityName, table.comment()));
|
||||
|
||||
// JPA Table 정보 출력
|
||||
printTableInfo(entityType, javax.persistence.Table.class,
|
||||
table -> log.debug("Table Name : {} = {}", table.name(), entityName));
|
||||
}
|
||||
|
||||
private <T extends Annotation> void printTableInfo(EntityType<?> entityType, Class<T> annotationClass,
|
||||
Consumer<T> printer) {
|
||||
T tableAnnotation = entityType.getBindableJavaType().getAnnotation(annotationClass);
|
||||
if (tableAnnotation != null) {
|
||||
printer.accept(tableAnnotation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.orm.jpa.support.SharedEntityManagerBean;
|
||||
|
||||
@Configuration
|
||||
public class JPAConfiguration {
|
||||
|
||||
@Bean("entityManager")
|
||||
public SharedEntityManagerBean entityManager(EntityManagerFactory entityManagerFactory) {
|
||||
SharedEntityManagerBean sharedEntityManagerBean = new SharedEntityManagerBean();
|
||||
sharedEntityManagerBean.setEntityManagerFactory(entityManagerFactory);
|
||||
return sharedEntityManagerBean;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.persistence.EntityManagerFactory;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.ComponentScan.Filter;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Primary;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
import org.springframework.orm.jpa.JpaTransactionManager;
|
||||
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
|
||||
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.transaction.TransactionManager;
|
||||
import org.springframework.transaction.annotation.EnableTransactionManagement;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepositoryImpl;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.kakao.rolling.TableSuffixResolver;
|
||||
|
||||
@Configuration
|
||||
@EnableScheduling
|
||||
@EnableTransactionManagement
|
||||
@EnableJpaAuditing(auditorAwareRef = "EMSAuditorAware")
|
||||
@EnableJpaRepositories(entityManagerFactoryRef = "entityManagerFactory", transactionManagerRef = "transactionManager", basePackages = {
|
||||
"com.eactive.eai", }, repositoryBaseClass = BaseRepositoryImpl.class, excludeFilters = {
|
||||
@Filter(classes = EMSDataSource.class)
|
||||
,
|
||||
// @Filter(type = FilterType.ASSIGNABLE_TYPE, classes = { DataLoaderRepository.class })
|
||||
})
|
||||
public class MultitenantConfiguration {
|
||||
|
||||
@Bean("entityManagerFactory")
|
||||
@Primary
|
||||
public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource,
|
||||
@Qualifier("hibernateProperties") Properties hibernateProperties) {
|
||||
LocalContainerEntityManagerFactoryBean bean = new LocalContainerEntityManagerFactoryBean();
|
||||
bean.setDataSource(dataSource);
|
||||
bean.setPackagesToScan("com.eactive.eai.data", "com.eactive.eai.rms.data");
|
||||
bean.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
|
||||
|
||||
bean.setJpaProperties(hibernateProperties);
|
||||
|
||||
Map<String, Object> settings = new HashMap<>();
|
||||
settings.put(AvailableSettings.MULTI_TENANT, "SCHEMA");
|
||||
settings.put(AvailableSettings.MULTI_TENANT_CONNECTION_PROVIDER, configurableMultiTenantConnectionProvider());
|
||||
settings.put(AvailableSettings.MULTI_TENANT_IDENTIFIER_RESOLVER, tenantIdentifierResolver());
|
||||
|
||||
bean.setJpaPropertyMap(settings);
|
||||
|
||||
return bean;
|
||||
}
|
||||
|
||||
@Bean("transactionManager")
|
||||
@Primary
|
||||
public TransactionManager transactionManager(DataSource dataSource, EntityManagerFactory entityManagerFactory) {
|
||||
JpaTransactionManager jpaTransactionManager = new JpaTransactionManager();
|
||||
jpaTransactionManager.setDataSource(dataSource);
|
||||
jpaTransactionManager.setEntityManagerFactory(entityManagerFactory);
|
||||
return jpaTransactionManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConfigurableMultiTenantConnectionProvider configurableMultiTenantConnectionProvider() {
|
||||
return new ConfigurableMultiTenantConnectionProvider();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TenantIdentifierResolver tenantIdentifierResolver() {
|
||||
return new TenantIdentifierResolver();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TableSuffixResolver tableSuffixResolver() {
|
||||
return () -> "";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright 2022 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* https://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.eactive.eai.rms.data.config;
|
||||
|
||||
import org.hibernate.context.spi.CurrentTenantIdentifierResolver;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
|
||||
@Component
|
||||
public class TenantIdentifierResolver implements CurrentTenantIdentifierResolver {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(TenantIdentifierResolver.class);
|
||||
|
||||
@Override
|
||||
public String resolveCurrentTenantIdentifier() {
|
||||
|
||||
DataSourceType dataSourceType = DataSourceContextHolder.getDataSourceType();
|
||||
|
||||
if (dataSourceType == null) {
|
||||
dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING);
|
||||
logger.debug("DataSource가 명시적으로 선택되지 않았으므로, MONITORING DataSource를 사용합니다.");
|
||||
}
|
||||
|
||||
return dataSourceType != null ? dataSourceType.getName() : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean validateExistingCurrentSessions() {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.eactive.eai.rms.data.entity.man.audit;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Index;
|
||||
import javax.persistence.Table;
|
||||
import javax.persistence.TableGenerator;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
|
||||
@Table(name = "audit_log", indexes = {
|
||||
@Index(name = "idx_system_code_last_modified_date", columnList = "system_code, last_modified_date")
|
||||
})
|
||||
@org.hibernate.annotations.Table(appliesTo = "audit_log", comment = "Audit 정보")
|
||||
public class AuditLogEntity extends AbstractEntity<Long> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@TableGenerator(name = "audit_log", table = "hibernate_sequences", initialValue = 1, allocationSize = 1)
|
||||
@GeneratedValue(strategy = GenerationType.TABLE, generator = "audit_log")
|
||||
@Column(name = "id")
|
||||
private Long id;
|
||||
|
||||
@Column(name = "system_code")
|
||||
private String systemCode;
|
||||
|
||||
@Column(name = "log_type")
|
||||
private String logType;
|
||||
|
||||
@Column(name = "log_type_text")
|
||||
private String logTypeText;
|
||||
|
||||
@Column(name = "command")
|
||||
private String command;
|
||||
|
||||
@Column(name = "remote_address")
|
||||
private String remoteAddress;
|
||||
|
||||
@Column(name = "message")
|
||||
private String message;
|
||||
|
||||
@Column(name = "parameters", length = 4000)
|
||||
private String parameters;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "last_modified_date")
|
||||
private LocalDateTime lastModifiedDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.eai.rms.data.entity.man.bizKeyTran;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Convert;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.converter.StringTrimConverter;
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm32")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm32", comment = "업무코드 전환")
|
||||
public class BizKeyTran extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 4)
|
||||
@Comment("EAI 업무구분코드")
|
||||
@Convert(converter = StringTrimConverter.class)
|
||||
private String eaibzwkdstcd;
|
||||
|
||||
@Column(length = 4)
|
||||
@Comment("어플리케이션 코드")
|
||||
@Convert(converter = StringTrimConverter.class)
|
||||
private String apcode;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return eaibzwkdstcd;
|
||||
}
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.data.entity.man.bizKeyTran;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface BizKeyTranRepository extends BaseRepository<BizKeyTran, String> {
|
||||
|
||||
String findApcodeByEaibzwkdstcd(String eaiBzwkDstcd);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.eactive.eai.rms.data.entity.man.bizKeyTran;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.common.acl.bizKeyTran.BizKeyTranUI;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class BizKeyTranService extends AbstractDataService<BizKeyTran, String, BizKeyTranRepository> {
|
||||
|
||||
public Page<BizKeyTran> findAll(Pageable pageable, BizKeyTranUI bizKeyTranUI) {
|
||||
QBizKeyTran qBizKeyTran = QBizKeyTran.bizKeyTran;
|
||||
|
||||
BooleanExpression predicate = qBizKeyTran.eaibzwkdstcd.containsIgnoreCase(bizKeyTranUI.getSearchEaiBzwkDstcd())
|
||||
.and(qBizKeyTran.apcode.containsIgnoreCase(bizKeyTranUI.getSearchApCode()));
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm38")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm38", comment = "CMLOG상세")
|
||||
public class CmLogDetailEntity extends AbstractEntity<CmLogDetailEntityId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private CmLogDetailEntityId id;
|
||||
|
||||
@Column(length = 8)
|
||||
@Comment("리소스내용")
|
||||
private String resource_content;
|
||||
|
||||
// @ManyToOne
|
||||
// @JoinColumn(
|
||||
// name = "guid",
|
||||
// insertable = false,
|
||||
// updatable = false
|
||||
// )
|
||||
// private CmLog2Entity cmLog2Entity;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class CmLogDetailEntityId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(unique = true, nullable = false, length = 40)
|
||||
@Comment("GUID")
|
||||
private String guid;
|
||||
|
||||
@Column(length = 8)
|
||||
@Comment("리소스경로")
|
||||
private String resource_path;
|
||||
|
||||
@Column(length = 4)
|
||||
@Comment("리소스파일명")
|
||||
private String resource_name;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.cm.ui.CmLogUISearch;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class CmLogDetailEntityService extends AbstractEMSDataSerivce<CmLogDetailEntity, CmLogDetailEntityId, CmLogDetailRepository> {
|
||||
|
||||
// public CmLogDetailEntityService(@Qualifier("entityManagerForEMS") EntityManager entityManagerForEMS) {
|
||||
// super(entityManagerForEMS);
|
||||
// }
|
||||
|
||||
public Page<CmLogDetailEntity> selectList(CmLogUISearch cmLogUISearch, Pageable pageable) {
|
||||
QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
|
||||
JPAQuery<CmLogDetailEntity> jpaQuery = createBaseQuery(cmLogUISearch);
|
||||
|
||||
long totalCount = jpaQuery.select(qCmLogDetailEntity.cmLogDetailEntity.count()).stream().count();
|
||||
|
||||
List<CmLogDetailEntity> cmLogDetail = jpaQuery
|
||||
.select(qCmLogDetailEntity)
|
||||
.limit(pageable.getPageSize())
|
||||
.offset(pageable.getOffset())
|
||||
.orderBy(qCmLogDetailEntity.id.guid.asc(), qCmLogDetailEntity.id.resource_name.asc(), qCmLogDetailEntity.id.resource_path.asc())
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(cmLogDetail, pageable, totalCount);
|
||||
}
|
||||
|
||||
private JPAQuery<CmLogDetailEntity> createBaseQuery(CmLogUISearch cmLogUISearch) {
|
||||
QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
|
||||
BooleanBuilder predicate = createSelectListPredicate(cmLogUISearch);
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qCmLogDetailEntity)
|
||||
.from(qCmLogDetailEntity)
|
||||
.where(predicate);
|
||||
}
|
||||
|
||||
public BooleanBuilder createSelectListPredicate(CmLogUISearch cmLogUISearch) {
|
||||
QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
predicate.and( qCmLogDetailEntity.id.guid.eq( cmLogUISearch.getGuid() ) );
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchResourceType())) {
|
||||
predicate.and( qCmLogDetailEntity.id.resource_path.containsIgnoreCase( cmLogUISearch.getSearchResourceType() ) );
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchResourceName())) {
|
||||
predicate.and( qCmLogDetailEntity.id.resource_name.containsIgnoreCase( cmLogUISearch.getSearchResourceName() ) );
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
// public int setNullCmLogDetail(String deployTime){
|
||||
// QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
// QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
//
|
||||
// int resultCnt = 0;
|
||||
//
|
||||
// return resultCnt;
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
interface CmLogDetailRepository extends BaseRepository<CmLogDetailEntity, CmLogDetailEntityId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm37")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm37", comment = "CMLOG기본")
|
||||
public class CmLogEntity extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 40)
|
||||
@Comment("GUID")
|
||||
private String guid;
|
||||
|
||||
@Column(length = 8)
|
||||
@Comment("서비스타입")
|
||||
private String service_type;
|
||||
|
||||
@Column(length = 4)
|
||||
@Comment("업무구분코드")
|
||||
private String appl_cd;
|
||||
|
||||
@Column(length = 8)
|
||||
@Comment("반영ID")
|
||||
private String deploy_id;
|
||||
|
||||
@Column(length = 1)
|
||||
@Comment("롤백여부")
|
||||
private String rollback_yn;
|
||||
|
||||
@Column(length = 1)
|
||||
@Comment("성공여부")
|
||||
private String success_yn;
|
||||
|
||||
@Column(length = 2000)
|
||||
@Comment("오류메시지")
|
||||
private String error_msg;
|
||||
|
||||
@Column(length = 14)
|
||||
@Comment("반영시간")
|
||||
private String deploy_time;
|
||||
|
||||
@Column(length = 14)
|
||||
@Comment("반영종료시간")
|
||||
private String deploy_end_time;
|
||||
|
||||
// @OneToMany(
|
||||
// mappedBy = "cmLog2Entity",
|
||||
// cascade = {CascadeType.ALL},
|
||||
// orphanRemoval = true
|
||||
// )
|
||||
// @OrderBy("guid")
|
||||
// private List<CmLogDetail2Entity> cmLogDetail2Entities;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return guid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,129 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.cm.ui.CmLogUISearch;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class CmLogEntityService extends AbstractEMSDataSerivce<CmLogEntity, String, CmLogRepository> {
|
||||
|
||||
// public CmLogEntityService(@Qualifier("entityManagerForEMS") EntityManager entityManagerForEMS) {
|
||||
// super(entityManagerForEMS);
|
||||
// }
|
||||
|
||||
public Page<CmLogEntity> selectList(CmLogUISearch cmLogUISearch, Pageable pageable) {
|
||||
QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
QCmLogDetailEntity qCmLogDetail2Entity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
|
||||
JPAQuery<CmLogEntity> jpaQuery = createBaseQuery(cmLogUISearch);
|
||||
|
||||
long totalCount = jpaQuery.select(QCmLogEntity.cmLogEntity.count()).stream().count();
|
||||
|
||||
// RM37.GUID, RM37.SERVICE_TYPE, RM37.APPL_CD, RM37.DEPLOY_ID, RM37.ROLLBACK_YN, RM37.SUCCESS_YN, RM37.ERROR_MSG, RM37.DEPLOY_TIME, RM37.DEPLOY_END_TIME
|
||||
List<CmLogEntity> cmLog = jpaQuery
|
||||
.select(qCmLogEntity)
|
||||
.limit(pageable.getPageSize())
|
||||
.offset(pageable.getOffset())
|
||||
.orderBy(qCmLogEntity.deploy_time.desc())
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(cmLog, pageable, totalCount);
|
||||
}
|
||||
|
||||
// public Page<CmLogEntity> selectList(CmLogUISearch cmLogUISearch, Pageable pageable) {
|
||||
// QCmLogEntity qCmLogEntity = QCmLogEntity.cmLog2Entity;
|
||||
// QCmLogDetail2Entity qCmLogDetail2Entity = QCmLogDetail2Entity.cmLogDetail2Entity;
|
||||
//
|
||||
// JPAQuery<?> query = getJPAQueryFactoryForEMS()
|
||||
// .from(qCmLogEntity)
|
||||
// .innerJoin(qCmLogDetail2Entity)
|
||||
// .on(qCmLogEntity.guid.eq(qCmLogDetail2Entity.guid))
|
||||
// .groupBy(qCmLogEntity);
|
||||
//
|
||||
// BooleanBuilder predicate = createSelectListPredicate(cmLogUISearch);
|
||||
//
|
||||
// query.where(predicate);
|
||||
//
|
||||
// long totalCount = query.select(qCmLogEntity.count()).stream().count();
|
||||
//
|
||||
// if(pageable.isPaged()){
|
||||
// query.limit(pageable.getPageSize()).offset(pageable.getOffset());
|
||||
// }
|
||||
//
|
||||
// List<CmLogEntity> cmLog = query.select(qCmLogEntity).orderBy(qCmLogEntity.guid.asc()).fetch();
|
||||
//
|
||||
// return new PageImpl<>(cmLog, pageable, totalCount);
|
||||
// }
|
||||
|
||||
private JPAQuery<CmLogEntity> createBaseQuery(CmLogUISearch cmLogUISearch) {
|
||||
QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
|
||||
BooleanBuilder predicate = createSelectListPredicate(cmLogUISearch);
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qCmLogEntity)
|
||||
.from(qCmLogEntity)
|
||||
.leftJoin(qCmLogDetailEntity)
|
||||
.on(qCmLogDetailEntity.id.guid.eq(qCmLogEntity.guid))
|
||||
.where(predicate)
|
||||
.groupBy(qCmLogEntity.guid, qCmLogEntity.service_type, qCmLogEntity.appl_cd, qCmLogEntity.deploy_id, qCmLogEntity.rollback_yn, qCmLogEntity.success_yn, qCmLogEntity.error_msg, qCmLogEntity.deploy_time, qCmLogEntity.deploy_end_time);
|
||||
}
|
||||
|
||||
public BooleanBuilder createSelectListPredicate(CmLogUISearch cmLogUISearch) {
|
||||
QCmLogEntity qCmLogEntity = QCmLogEntity.cmLogEntity;
|
||||
QCmLogDetailEntity qCmLogDetailEntity = QCmLogDetailEntity.cmLogDetailEntity;
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
predicate.and( qCmLogEntity.deploy_time.between( cmLogUISearch.getSearchStartTime(), cmLogUISearch.getSearchEndTime() ) );
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchServiceType())) {
|
||||
predicate.and( qCmLogEntity.service_type.eq(cmLogUISearch.getSearchServiceType()) );
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchDeployId())) {
|
||||
predicate.and( qCmLogEntity.deploy_id.containsIgnoreCase(cmLogUISearch.getSearchDeployId()) );
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchSuccessYn())) {
|
||||
predicate.and( qCmLogEntity.success_yn.containsIgnoreCase(cmLogUISearch.getSearchSuccessYn()) );
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(cmLogUISearch.getSearchResourceName())) {
|
||||
predicate.and( qCmLogDetailEntity.id.resource_name.containsIgnoreCase( cmLogUISearch.getSearchResourceName() ) );
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
|
||||
public Page<CmLogEntity> findAll(Pageable pageable, String guid) {
|
||||
return repository.findAll( QCmLogEntity.cmLogEntity.guid.containsIgnoreCase(guid) , pageable);
|
||||
}
|
||||
|
||||
public Iterable<CmLogEntity> findAll(String guid) {
|
||||
return repository.findAll(QCmLogEntity.cmLogEntity.guid.containsIgnoreCase(guid));
|
||||
}
|
||||
|
||||
// public long count(String eaiSvcName) {
|
||||
// return repository.count(QCmLogEntity.cmLog2Entity.guid.eq(eaiSvcName));
|
||||
// }
|
||||
|
||||
public void delete(String id) {
|
||||
repository.deleteById(id);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.cm;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
interface CmLogRepository extends BaseRepository<CmLogEntity, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
package com.eactive.eai.rms.data.entity.man.menu;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.OrderBy;
|
||||
import javax.persistence.PostLoad;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm01")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm01", comment = "메뉴 관리")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Menu extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 40)
|
||||
@Comment("메뉴 ID")
|
||||
private String menuId;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("상위 메뉴 ID")
|
||||
private String parentMenuId;
|
||||
|
||||
@Column(nullable = false)
|
||||
@Comment("정렬 순서")
|
||||
private Integer sortOrder;
|
||||
|
||||
@Column(nullable = false, length = 200)
|
||||
@Comment("메뉴명")
|
||||
private String menuName;
|
||||
|
||||
@Column(nullable = false, length = 4000)
|
||||
@Comment("메뉴URL")
|
||||
private String menuUrl;
|
||||
|
||||
@Column(length = 50)
|
||||
@Comment("메뉴 IMG")
|
||||
private String menuImage;
|
||||
|
||||
@Column(nullable = false, length = 1)
|
||||
@Comment("출력 여부")
|
||||
private String displayYn;
|
||||
|
||||
@Column(nullable = false, length = 1)
|
||||
@Comment("사용여부")
|
||||
private String useYn;
|
||||
|
||||
@Column(length = 100)
|
||||
@Comment("데이터 경로")
|
||||
private String appPath;
|
||||
|
||||
@Column(nullable = false, length = 3)
|
||||
@Comment("메뉴코드")
|
||||
private String appCode;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return menuId;
|
||||
}
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "parentMenuId", insertable = false, updatable = false)
|
||||
@ToString.Exclude
|
||||
private Menu parentMenu;
|
||||
|
||||
@OneToMany(mappedBy = "parentMenu", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@OrderBy("menuId")
|
||||
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
|
||||
@ToString.Exclude
|
||||
private List<Menu> childMenus;
|
||||
|
||||
@PostLoad
|
||||
private void postLoad() {
|
||||
if (this.getChildMenus() == null) {
|
||||
this.childMenus = new ArrayList<>();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.menu;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface MenuRepository extends BaseRepository<Menu, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,230 @@
|
||||
package com.eactive.eai.rms.data.entity.man.menu;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.annotations.QueryHints;
|
||||
import org.springframework.context.i18n.LocaleContextHolder;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUISearch;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.eai.rms.data.entity.man.role.QRole;
|
||||
import com.eactive.eai.rms.data.entity.man.role.QRoleMenuAuth;
|
||||
import com.eactive.eai.rms.data.entity.man.user.QUserRole;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MenuService extends AbstractEMSDataSerivce<Menu, String, MenuRepository> {
|
||||
|
||||
public Page<Menu> findAll(Pageable pageable, MenuUISearch menuUISearch) {
|
||||
QMenu qMenu = QMenu.menu;
|
||||
|
||||
BooleanExpression predicate = qMenu.parentMenuId
|
||||
.ne("0")
|
||||
.and(qMenu.menuId.ne("0"))
|
||||
.and(qMenu.menuUrl.ne("NAN"))
|
||||
.and(qMenu.appCode.ne("BAP"));
|
||||
|
||||
if (!StringUtils.isBlank(menuUISearch.getSearchName())) {
|
||||
predicate = predicate.and(qMenu.menuName.containsIgnoreCase(menuUISearch.getSearchName()));
|
||||
}
|
||||
if (!StringUtils.isBlank(menuUISearch.getSearchTblName())) {
|
||||
predicate = predicate.and(qMenu.appPath.containsIgnoreCase(menuUISearch.getSearchTblName()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public String getPosition(String menuId) {
|
||||
Menu menu = repository.findById(menuId).orElse(null);
|
||||
return (menu == null) ? "" : buildPositionString(menu, 0);
|
||||
}
|
||||
|
||||
public String getMenuName(String menuId) {
|
||||
return repository.findById(menuId).map(Menu::getMenuName).orElse(null);
|
||||
}
|
||||
|
||||
private String buildPositionString(Menu menu, int level) {
|
||||
if (menu == null || level > 2) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder position = new StringBuilder();
|
||||
String parentPosition = buildPositionString(menu.getParentMenu(), level + 1);
|
||||
|
||||
if (!parentPosition.isEmpty()) {
|
||||
position.append(parentPosition).append(" > ");
|
||||
}
|
||||
position.append(menu.getMenuName());
|
||||
return position.toString();
|
||||
}
|
||||
|
||||
public String getUrlAuth(String userId, String url, String serviceType) {
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
QRole qRole = QRole.role;
|
||||
QRoleMenuAuth qRoleMenuAuth = QRoleMenuAuth.roleMenuAuth;
|
||||
QMenu qMenu = QMenu.menu;
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qRoleMenuAuth.auth.max())
|
||||
.from(qUserRole)
|
||||
.join(qRole)
|
||||
.on(qUserRole.id.roleId.eq(qRole.roleId))
|
||||
.join(qRoleMenuAuth)
|
||||
.on(qRole.roleId.eq(qRoleMenuAuth.id.roleId))
|
||||
.join(qMenu)
|
||||
.on(qRoleMenuAuth.id.menuId.eq(qMenu.menuId))
|
||||
.where( qUserRole.id.userId.eq(userId),
|
||||
qMenu.menuUrl.like(url.concat("%")), qRole.useYn.eq("Y"),
|
||||
qRoleMenuAuth.auth.in("R", "W"),
|
||||
qRoleMenuAuth.id.serviceType.eq(serviceType)
|
||||
)
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
public List<Menu> getLeftMenuList(String menuId, List<String> roleIds, List<String> appCodes, String serviceType) {
|
||||
QMenu qMenu = QMenu.menu;
|
||||
QRoleMenuAuth qRoleMenuAuth = QRoleMenuAuth.roleMenuAuth;
|
||||
|
||||
JPAQuery<String> roleMenuAuthSubQuery = getJPAQueryFactory()
|
||||
.select(qRoleMenuAuth.id.menuId)
|
||||
.from(qRoleMenuAuth)
|
||||
.where(qRoleMenuAuth.auth.in("R", "W"), qRoleMenuAuth.id.roleId.in(roleIds), qRoleMenuAuth.id.serviceType.eq(serviceType));
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qMenu)
|
||||
.from(qMenu)
|
||||
.where(qMenu.parentMenuId.eq(menuId), qMenu.appCode.in(appCodes), qMenu.useYn.eq("Y"),
|
||||
qMenu.displayYn.eq("Y"), qMenu.menuId.in(roleMenuAuthSubQuery))
|
||||
.orderBy(qMenu.sortOrder.asc())
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
public boolean isMenuExistInService(List<String> appCodes, String menuId) {
|
||||
QMenu qMenu = QMenu.menu;
|
||||
BooleanExpression predicate = qMenu.appCode.in(appCodes).and(qMenu.menuId.eq(menuId));
|
||||
|
||||
return repository.findOne(predicate).isPresent();
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> getMenuList(List<String> roleIds, List<String> appCodes, String serviceType) {
|
||||
QMenu qMenu = QMenu.menu;
|
||||
QMenu qParentMenu = new QMenu("qParentMenu");
|
||||
QMenu qGrandParentMenu = new QMenu("qGrandParentMenu");
|
||||
QMenu qGreatGrandParentMenu = new QMenu("qGreatGrandParentMenu");
|
||||
|
||||
List<Tuple> menus = getJPAQueryFactory()
|
||||
.select(qMenu, qParentMenu, qGrandParentMenu, qGreatGrandParentMenu)
|
||||
.from(qMenu)
|
||||
.leftJoin(qMenu.parentMenu, qParentMenu)
|
||||
.on(qParentMenu.menuId.eq(qMenu.parentMenuId))
|
||||
.leftJoin(qParentMenu.parentMenu, qGrandParentMenu)
|
||||
.on(qGrandParentMenu.menuId.eq(qParentMenu.parentMenuId))
|
||||
.leftJoin(qGrandParentMenu.parentMenu, qGreatGrandParentMenu)
|
||||
.on(qGreatGrandParentMenu.menuId.eq(qGrandParentMenu.parentMenuId))
|
||||
.where(menuQueryConditions(qMenu, qParentMenu, qGrandParentMenu, qGreatGrandParentMenu, roleIds, appCodes, serviceType))
|
||||
.orderBy(qGreatGrandParentMenu.sortOrder.asc(), qGrandParentMenu.sortOrder.asc(),
|
||||
qParentMenu.sortOrder.asc(), qMenu.sortOrder.asc())
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetch();
|
||||
|
||||
return menus.stream().map(this::convertToMap).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Predicate menuQueryConditions(
|
||||
QMenu qMenu, QMenu qParentMenu, QMenu qGrandParentMenu, QMenu qGreatGrandParentMenu,
|
||||
List<String> roleIds, List<String> appCodes, String serviceType) {
|
||||
|
||||
String serverType = CommonConstants.DB_MANAGE_TYPE_D;
|
||||
String lang = LocaleContextHolder.getLocale().getLanguage();
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
// lang - ko/en check
|
||||
if (StringUtils.isBlank(lang) || StringUtils.equalsIgnoreCase(lang, "ko")) {
|
||||
lang = "ROOT";
|
||||
} else {
|
||||
lang = "ROOT_" + lang.toUpperCase();
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(lang)) {
|
||||
predicate.and(qGreatGrandParentMenu.menuName.eq(lang));
|
||||
}
|
||||
|
||||
// all Menu - displayYn, useYn = 'Y' check
|
||||
Stream
|
||||
.of(qMenu, qParentMenu, qGrandParentMenu, qGreatGrandParentMenu)
|
||||
.forEach(m -> predicate.and(m.displayYn.eq("Y").and(m.useYn.eq("Y"))));
|
||||
|
||||
predicate.and(qMenu.menuUrl.ne("NAN"));
|
||||
|
||||
// QRoleMenuAuth - roleIds & "R", "W" & serviceType
|
||||
predicate
|
||||
.and(qMenu.menuId
|
||||
.in(getJPAQueryFactory()
|
||||
.select(QRoleMenuAuth.roleMenuAuth.id.menuId)
|
||||
.from(QRoleMenuAuth.roleMenuAuth)
|
||||
.where(QRoleMenuAuth.roleMenuAuth.id.roleId.in(roleIds),
|
||||
QRoleMenuAuth.roleMenuAuth.auth.in("R", "W"),
|
||||
QRoleMenuAuth.roleMenuAuth.id.serviceType.eq(serviceType))));
|
||||
// serverType
|
||||
predicate
|
||||
.and(qGreatGrandParentMenu.parentMenuId
|
||||
.eq(getJPAQueryFactory()
|
||||
.select(qGreatGrandParentMenu.menuId)
|
||||
.from(qGreatGrandParentMenu)
|
||||
.where(qGreatGrandParentMenu.parentMenuId.eq(serverType))));
|
||||
|
||||
// appCodes
|
||||
predicate
|
||||
.and(qMenu.menuId
|
||||
.in(getJPAQueryFactory()
|
||||
.select(qMenu.menuId)
|
||||
.from(qMenu)
|
||||
.where(qMenu.appCode.in(appCodes))));
|
||||
|
||||
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
private Map<String, Object> convertToMap(Tuple tuple) {
|
||||
Menu menu = tuple.get(QMenu.menu);
|
||||
Menu parentMenu = tuple.get(new QMenu("qParentMenu"));
|
||||
Menu grandParentMenu = tuple.get(new QMenu("qGrandParentMenu"));
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("LEV2_ID", grandParentMenu.getMenuId());
|
||||
map.put("LEV2_NAME", grandParentMenu.getMenuName());
|
||||
map.put("LEV2_IMG", grandParentMenu.getMenuImage());
|
||||
map.put("LEV2_URL", grandParentMenu.getMenuUrl());
|
||||
map.put("LEV3_ID", parentMenu.getMenuId());
|
||||
map.put("LEV3_NAME", parentMenu.getMenuName());
|
||||
map.put("LEV3_IMG", parentMenu.getMenuImage());
|
||||
map.put("LEV3_URL", parentMenu.getMenuUrl());
|
||||
|
||||
if (menu != null) {
|
||||
map.put("LEV4_ID", menu.getMenuId());
|
||||
map.put("LEV4_NAME", menu.getMenuName());
|
||||
map.put("LEV4_IMG", menu.getMenuImage());
|
||||
map.put("LEV4_URL", menu.getMenuUrl());
|
||||
map.put("APPCODE", menu.getAppCode());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringCode.repository;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeGroup;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface MonitoringCodeGroupRepository extends BaseRepository<MonitoringCodeGroup, String> {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringCode.repository;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeId;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface MonitoringCodeRepository extends BaseRepository<MonitoringCode, MonitoringCodeId> {
|
||||
|
||||
}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringCode.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeGroup;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.QMonitoringCodeGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUISearch;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringCode.repository.MonitoringCodeGroupRepository;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MonitoringCodeGroupService
|
||||
extends AbstractDataService<MonitoringCodeGroup, String, MonitoringCodeGroupRepository> {
|
||||
|
||||
public List<MonitoringCodeGroup> selectCodeGroupList(MonitoringCodeGroupUISearch search) {
|
||||
QMonitoringCodeGroup qMonitoringCodeGroup = QMonitoringCodeGroup.monitoringCodeGroup;
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (!StringUtils.isBlank(search.getSearchCodeGroup())) {
|
||||
predicate.and(qMonitoringCodeGroup.codeGroup.eq(search.getSearchCodeGroup()));
|
||||
}
|
||||
if (!StringUtils.isBlank(search.getSearchGroupDesc())) {
|
||||
predicate.and(qMonitoringCodeGroup.description.containsIgnoreCase(search.getSearchGroupDesc()));
|
||||
}
|
||||
if (!StringUtils.isBlank(search.getSearchCode()) || !StringUtils.isBlank(search.getSearchCodeName())) {
|
||||
predicate
|
||||
.and(qMonitoringCodeGroup.monitoringCodes.any().id.code.containsIgnoreCase(search.getSearchCode()));
|
||||
predicate.and(
|
||||
qMonitoringCodeGroup.monitoringCodes.any().codeName.containsIgnoreCase(search.getSearchCodeName()));
|
||||
}
|
||||
|
||||
return (List<MonitoringCodeGroup>) repository.findAll(predicate, Sort.by(Sort.Direction.ASC, "codeGroup"));
|
||||
}
|
||||
|
||||
public List<MonitoringCodeGroup> selectCodeGroupList(String searchCodeGroup) {
|
||||
QMonitoringCodeGroup qMonitoringCodeGroup = QMonitoringCodeGroup.monitoringCodeGroup;
|
||||
|
||||
return (List<MonitoringCodeGroup>) repository.findAll(qMonitoringCodeGroup.codeGroup.eq(searchCodeGroup), Sort.by(Sort.Direction.ASC, "codeGroup"));
|
||||
}
|
||||
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringCode.service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityNotFoundException;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeId;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.QMonitoringCode;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringCode.repository.MonitoringCodeRepository;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MonitoringCodeService extends AbstractDataService<MonitoringCode, MonitoringCodeId, MonitoringCodeRepository> {
|
||||
|
||||
public List<MonitoringCode> findByIdCodegroup(String codeGroup, String sortColumn) {
|
||||
QMonitoringCode qMonitoringCode = QMonitoringCode.monitoringCode;
|
||||
BooleanExpression predicate = qMonitoringCode.id.codeGroup.eq(codeGroup);
|
||||
Sort sort = Sort.by(Sort.Direction.ASC, sortColumn);
|
||||
return (List<MonitoringCode>) repository.findAll(predicate, sort);
|
||||
}
|
||||
|
||||
public Iterable<MonitoringCode> findByIdCodegroup(String codeGroup) {
|
||||
QMonitoringCode qMonitoringCode = QMonitoringCode.monitoringCode;
|
||||
BooleanExpression predicate = qMonitoringCode.id.codeGroup.eq(codeGroup);
|
||||
return repository.findAll(predicate);
|
||||
}
|
||||
public Iterable<MonitoringCode> findByIdCodegroupAndUseYn(String codeGroup) {
|
||||
QMonitoringCode qMonitoringCode = QMonitoringCode.monitoringCode;
|
||||
BooleanExpression predicate = qMonitoringCode.id.codeGroup.eq(codeGroup)
|
||||
.and(qMonitoringCode.useYn.eq("Y"));
|
||||
return repository.findAll(predicate, Sort.by("id.code"));
|
||||
}
|
||||
|
||||
public String findCodenameById(MonitoringCodeId monitoringCodeId) {
|
||||
return repository.findById(monitoringCodeId).orElseThrow(() -> new EntityNotFoundException(
|
||||
"MonitoringCode not found for codeGroup: " + monitoringCodeId.getCodeGroup() + " and code: " + monitoringCodeId.getCode()))
|
||||
.getCodeName();
|
||||
}
|
||||
|
||||
public Page<MonitoringCode> findAll(Pageable pageable, String codeGroup, String searchCodeName) {
|
||||
QMonitoringCode qMonitoringCode = QMonitoringCode.monitoringCode;
|
||||
BooleanExpression predicate = qMonitoringCode.id.codeGroup.eq(codeGroup)
|
||||
.and(qMonitoringCode.codeName.containsIgnoreCase(searchCodeName));
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
+45
@@ -0,0 +1,45 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Table(name = "tseairm24")
|
||||
@Entity
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm24", comment = "모니터링 프라퍼티")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class MonitoringProperty extends AbstractEntity<MonitoringPropertyId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private MonitoringPropertyId id;
|
||||
|
||||
@Column(nullable = false, length = 1000)
|
||||
@Comment("프라퍼티값")
|
||||
private String prpty2Val;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "prptyGroupName", insertable = false, updatable = false)
|
||||
@ToString.Exclude
|
||||
private MonitoringPropertyGroup monitoringPropertyGroup;
|
||||
}
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm23")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm23", comment = "모니터링 프라퍼티 그룹")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class MonitoringPropertyGroup extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 50)
|
||||
@Comment("프라퍼티그룹명")
|
||||
private String prptyGroupName;
|
||||
|
||||
@Column(nullable = false, length = 200)
|
||||
@Comment("프라퍼티 그룹설명")
|
||||
private String prptyGroupDesc;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return prptyGroupName;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "monitoringPropertyGroup", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
@ToString.Exclude
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
private List<MonitoringProperty> monitoringProperties;
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class MonitoringPropertyId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false, length = 50)
|
||||
@Comment("프라퍼티그룹명")
|
||||
private String prptyGroupName;
|
||||
|
||||
@Column(nullable = false, length = 100)
|
||||
@Comment("프라퍼티명")
|
||||
private String prptyName;
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty.repository;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyGroup;
|
||||
|
||||
@EMSDataSource
|
||||
public interface MonitoringPropertyGroupRepository extends BaseRepository<MonitoringPropertyGroup, String> {
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty.repository;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringProperty;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyId;
|
||||
|
||||
@EMSDataSource
|
||||
public interface MonitoringPropertyRepository extends BaseRepository<MonitoringProperty, MonitoringPropertyId> {
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty.service;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.common.property.UI.MonitoringPropertyGroupUI;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyGroup;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.QMonitoringPropertyGroup;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.repository.MonitoringPropertyGroupRepository;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MonitoringPropertyGroupService
|
||||
extends AbstractDataService<MonitoringPropertyGroup, String, MonitoringPropertyGroupRepository> {
|
||||
|
||||
public static final String MONITORING_PROPERTY_KEY = "Monitoring";
|
||||
|
||||
public static final String MONITORING_PROPERTY_KEY_FORMAT = "Monitoring{%s}";
|
||||
|
||||
public Page<MonitoringPropertyGroup> findAll(Pageable pageable, MonitoringPropertyGroupUI ui) {
|
||||
|
||||
QMonitoringPropertyGroup qMonitoringPropertyGroup = QMonitoringPropertyGroup.monitoringPropertyGroup;
|
||||
|
||||
BooleanExpression predicate = qMonitoringPropertyGroup.prptyGroupName
|
||||
.containsIgnoreCase(ui.getSearchPrptyGroupName())
|
||||
.and(qMonitoringPropertyGroup.prptyGroupDesc.containsIgnoreCase(ui.getSearchPrptyGroupDesc()));
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
}
|
||||
+47
@@ -0,0 +1,47 @@
|
||||
package com.eactive.eai.rms.data.entity.man.monitoringProperty.service;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringProperty;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.MonitoringPropertyId;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.QMonitoringProperty;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringProperty.repository.MonitoringPropertyRepository;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class MonitoringPropertyService
|
||||
extends AbstractDataService<MonitoringProperty, MonitoringPropertyId, MonitoringPropertyRepository> {
|
||||
|
||||
public String findPrpty2ValById(String prptyGroupName, String key) {
|
||||
MonitoringPropertyId id = new MonitoringPropertyId();
|
||||
id.setPrptyGroupName(prptyGroupName);
|
||||
id.setPrptyGroupName(key);
|
||||
|
||||
Optional<MonitoringProperty> property = repository.findById(id);
|
||||
return property.map(MonitoringProperty::getPrpty2Val).orElse(null);
|
||||
}
|
||||
|
||||
public String getPrpty2ValById(String prptyGroupName, String prptyName) {
|
||||
MonitoringPropertyId id = new MonitoringPropertyId();
|
||||
id.setPrptyGroupName(prptyGroupName);
|
||||
id.setPrptyName(prptyName);
|
||||
|
||||
Optional<MonitoringProperty> property = repository.findById(id);
|
||||
return property.map(MonitoringProperty::getPrpty2Val).orElse(null);
|
||||
}
|
||||
|
||||
public Iterable<MonitoringProperty> findAllByIdPrptyName(String prptyName) {
|
||||
BooleanExpression predicate = QMonitoringProperty.monitoringProperty.id.prptyName.eq(prptyName);
|
||||
return repository.findAll(predicate);
|
||||
}
|
||||
|
||||
public void refresh(MonitoringProperty p) {
|
||||
repository.refresh(p);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm05")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm05", comment = "역할 관리")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class Role extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 40)
|
||||
@Comment("역할ID")
|
||||
private String roleId;
|
||||
|
||||
@Column(nullable = false, length = 100)
|
||||
@Comment("역할명")
|
||||
private String roleName;
|
||||
|
||||
@Column(nullable = false, length = 1)
|
||||
@Comment("사용여부")
|
||||
private String useYn;
|
||||
|
||||
@Column(nullable = false, length = 400)
|
||||
@Comment("역할권한설명")
|
||||
private String roleDesc;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("메뉴ID")
|
||||
private String menuId;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return roleId;
|
||||
}
|
||||
|
||||
@OneToMany(mappedBy = "role", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<RoleMenuAuth> roleMenuAuths;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm03")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm03", comment = "역할별 메뉴 권한")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class RoleMenuAuth extends AbstractEntity<RoleMenuAuthId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private RoleMenuAuthId id;
|
||||
|
||||
@Column(nullable = false, length = 1)
|
||||
@Comment("권한")
|
||||
private String auth;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "roleId", updatable = false, insertable = false)
|
||||
private Role role;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class RoleMenuAuthId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("역할ID")
|
||||
private String roleId;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("메뉴ID")
|
||||
private String menuId;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("표현 서비스타입")
|
||||
private String serviceType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface RoleMenuAuthRepository extends BaseRepository<RoleMenuAuth, RoleMenuAuthId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import com.eactive.eai.rms.data.entity.man.user.QUserRole;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import org.hibernate.annotations.QueryHints;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class RoleMenuAuthService extends AbstractEMSDataSerivce<RoleMenuAuth, RoleMenuAuthId, RoleMenuAuthRepository> {
|
||||
|
||||
public String getRoleList(String userId, String menuId, String serviceType) {
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
QRoleMenuAuth qRoleMenuAuth = QRoleMenuAuth.roleMenuAuth;
|
||||
QRole qRole = QRole.role;
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qRoleMenuAuth.auth.max())
|
||||
.from(qUserRole)
|
||||
.join(qRole).on(qUserRole.id.roleId.eq(qRole.roleId))
|
||||
.join(qRoleMenuAuth).on(qRole.roleId.eq(qRoleMenuAuth.id.roleId))
|
||||
.where((qUserRole.id.userId.eq(userId)),
|
||||
qRoleMenuAuth.id.menuId.eq(menuId),
|
||||
qRoleMenuAuth.auth.in("R", "W"),
|
||||
qRoleMenuAuth.id.serviceType.eq(serviceType),
|
||||
qRole.useYn.eq("Y"))
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
public Iterable<RoleMenuAuth> findAllByRoleId(String roleId) {
|
||||
return repository.findAll(QRoleMenuAuth.roleMenuAuth.id.roleId.eq(roleId));
|
||||
}
|
||||
|
||||
public List<String> findAllServiceTypeByRoleIds(List<String> roleIds) {
|
||||
|
||||
QRoleMenuAuth qRoleMenuAuth = QRoleMenuAuth.roleMenuAuth;
|
||||
QRole qRole = QRole.role;
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qRoleMenuAuth.id.serviceType)
|
||||
.distinct()
|
||||
.from(qRoleMenuAuth)
|
||||
.join(qRole).on(qRoleMenuAuth.id.roleId.eq(qRole.roleId))
|
||||
.where(qRoleMenuAuth.id.roleId.in(roleIds),
|
||||
qRole.useYn.eq("Y"))
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetch();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import javax.persistence.QueryHint;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.repository.QueryHints;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.querydsl.core.types.Predicate;
|
||||
|
||||
@EMSDataSource
|
||||
public interface RoleRepository extends BaseRepository<Role, String> {
|
||||
|
||||
@QueryHints({ @QueryHint(name = org.hibernate.annotations.QueryHints.CACHEABLE, value = "true") })
|
||||
@Override
|
||||
Iterable<Role> findAll(Predicate predicate, Sort sort);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.eactive.eai.rms.data.entity.man.role;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.role.RoleUI;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class RoleService extends AbstractEMSDataSerivce<Role, String, RoleRepository> {
|
||||
|
||||
public List<String> getRoleScreenId(List<String> roleIds) {
|
||||
QRole qRole = QRole.role;
|
||||
BooleanExpression predicate = qRole.roleId.in(roleIds);
|
||||
Iterable<Role> roles = repository.findAll(predicate, Sort.by(Sort.Direction.DESC, "menuId"));
|
||||
return StreamSupport.stream(roles.spliterator(), false).map(Role::getMenuId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Page<Role> findAll(Pageable pageable, RoleUI roleUI) {
|
||||
QRole qRole = QRole.role;
|
||||
|
||||
BooleanExpression predicate = qRole.roleId.containsIgnoreCase(roleUI.getSearchRoleId());
|
||||
|
||||
if (StringUtils.isNotBlank(roleUI.getSearchRoleName())) {
|
||||
predicate = predicate.and(qRole.roleName.containsIgnoreCase(roleUI.getSearchRoleName()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(roleUI.getSearchUseYn())) {
|
||||
predicate = predicate.and(qRole.useYn.eq(roleUI.getSearchUseYn()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> selectRole(String searchUseYn) {
|
||||
List<Map<String, Object>> roleMaps = new ArrayList<>();
|
||||
|
||||
findAllRolesByUseYn(searchUseYn).forEach(role -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("ROLEID", role.getRoleId());
|
||||
map.put("ROLENAME", role.getRoleName());
|
||||
roleMaps.add(map);
|
||||
});
|
||||
return roleMaps;
|
||||
}
|
||||
|
||||
public Iterable<Role> findAllRolesByUseYn(String useStatus) {
|
||||
return repository.findAll(QRole.role.useYn.containsIgnoreCase(useStatus));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.JoinColumn;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
|
||||
|
||||
@Entity
|
||||
@Table(name = "TSEAIRM22")
|
||||
public class JobData extends AbstractEntity<JobDataId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private JobDataId id;
|
||||
|
||||
@Column(name = "DATAVALUE")
|
||||
private String dataValue;
|
||||
|
||||
@ManyToOne
|
||||
@JoinColumn(name = "JOBNAME", insertable = false, updatable = false)
|
||||
@ToString.Exclude
|
||||
private JobInfo jobInfo;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class JobDataId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(name = "JOBNAME")
|
||||
private String jobName;
|
||||
|
||||
@Column(name = "DATAKEY")
|
||||
private String dataKey;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
interface JobDataRepository extends BaseRepository<JobData, JobDataId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class JobDataService extends AbstractDataService<JobData, JobDataId, JobDataRepository> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm20")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm20", comment = "스케쥴러 Job 실행 History")
|
||||
public class JobHistory extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
private String uuid;
|
||||
|
||||
private String jobName;
|
||||
|
||||
private String instanceName;
|
||||
|
||||
private String startDate;
|
||||
|
||||
private String endDate;
|
||||
|
||||
private String status;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return uuid;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
interface JobHistoryRepository extends BaseRepository<JobHistory, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.util.UUIDGenerator;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class JobHistoryService extends AbstractEMSDataSerivce<JobHistory, String, JobHistoryRepository> {
|
||||
|
||||
private JobInfoService jobInfoService;
|
||||
|
||||
@Autowired
|
||||
public JobHistoryService(JobInfoService jobInfoService) {
|
||||
this.jobInfoService = jobInfoService;
|
||||
}
|
||||
|
||||
public String findRecentStatus(String jobName, String instanceName) {
|
||||
QJobHistory qJobHistory = QJobHistory.jobHistory;
|
||||
|
||||
JPAQuery<String> maxEndDateQuery = getJPAQueryFactory()
|
||||
.select(qJobHistory.endDate.max())
|
||||
.from(qJobHistory)
|
||||
.where(qJobHistory.jobName.eq(jobName).and(qJobHistory.instanceName.eq(instanceName)));
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.select(qJobHistory.status)
|
||||
.from(qJobHistory)
|
||||
.where(qJobHistory.endDate.eq(maxEndDateQuery))
|
||||
.fetchOne();
|
||||
}
|
||||
|
||||
public void updateStatus(String jobName, String startDate, String endDate, String status) throws Exception {
|
||||
String instanceName = System.getProperty("inst.Name");
|
||||
String uuid = UUIDGenerator.getUUID();
|
||||
|
||||
JobInfo jobInfo = jobInfoService.getById(jobName);
|
||||
|
||||
if (StringUtils.equalsAnyIgnoreCase(jobInfo.getChkStatus(), "Y", "E")) {
|
||||
|
||||
String rctStatus = findRecentStatus(jobName, instanceName); // 최근 Data 조회
|
||||
|
||||
log.info("[DHJEONG]1_rctStatus-->{}, jobName-->{}, instanceName-->{}", rctStatus, jobName, instanceName);
|
||||
|
||||
if (!status.equals(rctStatus) || !"E".equals(jobInfo.getChkStatus())) {
|
||||
// 'Y' 이면 무조건 등록, 'E' 이면 ==> Status 바뀌면 등록
|
||||
JobHistory jobHistory = new JobHistory();
|
||||
jobHistory.setUuid(uuid);
|
||||
jobHistory.setJobName(jobName);
|
||||
jobHistory.setStartDate(startDate);
|
||||
jobHistory.setEndDate(endDate);
|
||||
jobHistory.setStatus(status);
|
||||
jobHistory.setInstanceName(instanceName);
|
||||
|
||||
save(jobHistory);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public Page<JobHistory> findAll(Pageable pageable, String searchStartTime, String searchEndTime,
|
||||
String searchJobName, String searchInstanceName) {
|
||||
|
||||
QJobHistory qJobHistory = QJobHistory.jobHistory;
|
||||
BooleanExpression predicate = qJobHistory.startDate
|
||||
.between(searchStartTime, searchEndTime)
|
||||
.or(qJobHistory.endDate.between(searchStartTime, searchEndTime));
|
||||
|
||||
if (StringUtils.isNotBlank(searchJobName)) {
|
||||
predicate = predicate.and(qJobHistory.jobName.containsIgnoreCase(searchJobName));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(searchInstanceName)) {
|
||||
predicate = predicate.and(qJobHistory.instanceName.containsIgnoreCase(searchInstanceName));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = false)
|
||||
|
||||
@Entity
|
||||
@Table(name = "TSEAIRM21")
|
||||
@org.hibernate.annotations.Table(appliesTo = "TSEAIRM21", comment = "스케쥴러 Job 정보")
|
||||
public class JobInfo extends AbstractEntity<String> implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(name = "JOBNAME")
|
||||
private String id;
|
||||
|
||||
@Column(name = "CRONEXP")
|
||||
private String cronExp;
|
||||
|
||||
@Column(name = "INSTANCENAME")
|
||||
private String instanceName;
|
||||
|
||||
@Column(name = "JOBCLASSNAME")
|
||||
private String jobClassName;
|
||||
|
||||
@Column(name = "USEYN")
|
||||
private String useYn;
|
||||
|
||||
@Column(name = "JOBDESC")
|
||||
private String jobDesc;
|
||||
|
||||
@Column(name = "CHKSTATUS")
|
||||
private String chkStatus;
|
||||
|
||||
@OneToMany(mappedBy = "jobInfo", cascade = CascadeType.ALL, orphanRemoval = true)
|
||||
private List<JobData> jobDatas;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
interface JobInfoRepository extends BaseRepository<JobInfo, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.eai.rms.data.entity.man.scheduler;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.scheduler.ui.SchedulerUISearch;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class JobInfoService extends AbstractEMSDataSerivce<JobInfo, String, JobInfoRepository> {
|
||||
|
||||
public Page<JobInfo> findAll(Pageable pageable, SchedulerUISearch schedulerUISearch) {
|
||||
QJobInfo qJobInfo = QJobInfo.jobInfo;
|
||||
BooleanExpression predicate = QJobInfo.jobInfo.isNotNull();
|
||||
|
||||
if (StringUtils.isNotBlank(schedulerUISearch.getSearchJobName())) {
|
||||
predicate = predicate.and(qJobInfo.id.containsIgnoreCase(schedulerUISearch.getSearchJobName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(schedulerUISearch.getSearchJobDesc())) {
|
||||
predicate = predicate.and(qJobInfo.jobDesc.containsIgnoreCase(schedulerUISearch.getSearchJobDesc()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(schedulerUISearch.getSearchJobClass())) {
|
||||
predicate = predicate.and(qJobInfo.jobClassName.containsIgnoreCase(schedulerUISearch.getSearchJobClass()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(schedulerUISearch.getSearchJobUseYn())) {
|
||||
predicate = predicate.and(qJobInfo.useYn.equalsIgnoreCase(schedulerUISearch.getSearchJobUseYn()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(schedulerUISearch.getSearchJobInst())) {
|
||||
predicate = predicate.and(qJobInfo.instanceName.equalsIgnoreCase(schedulerUISearch.getSearchJobInst()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.springframework.data.annotation.CreatedBy;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "TB_APIMS_USER_ATHR_ROLE_CHG_H")
|
||||
@org.hibernate.annotations.Table(appliesTo = "TB_APIMS_USER_ATHR_ROLE_CHG_H", comment = "사용자 권한 ROLE 변경 이력")
|
||||
public class UserAthrRoleChgHistory extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "CHG_LOG_ID", unique = true, nullable = false)
|
||||
@Comment("사용자 정보 변경 로그 식별 ID")
|
||||
private int chgLogId;
|
||||
|
||||
@Column(name = "USER_ID", length = 20, nullable = false)
|
||||
@Comment("사용자 식별자(사번)")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "CHG_GB", length = 4, nullable = false)
|
||||
@Comment("사용자 변경 구분")
|
||||
private String chgGb;
|
||||
|
||||
@Column(name = "CHG_DTL", length = 4000, nullable = false)
|
||||
@Comment("변경 상세 내역")
|
||||
private String chgDtl;
|
||||
|
||||
@Column(name = "AMDR_ID", length = 20, nullable = false)
|
||||
@Comment("수정자 식별자(사번)")
|
||||
@CreatedBy
|
||||
private String amdrId;
|
||||
|
||||
@Column(name = "CCTN_IP", length = 32)
|
||||
@Comment("수정자 접속IP 주소")
|
||||
private String cctnIp;
|
||||
|
||||
@Column(name = "CRTN_DTTM", length = 20)
|
||||
@Comment("레코드 생성일시")
|
||||
@CreatedDate
|
||||
private LocalDateTime crtnDttm;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return Integer.toString(chgLogId);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
@EMSDataSource
|
||||
public interface UserAthrRoleChgHistoryRepository extends BaseRepository<UserAthrRoleChgHistory, String> {
|
||||
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class UserAthrRoleChgHistoryService
|
||||
extends AbstractEMSDataSerivce<UserAthrRoleChgHistory, String, UserAthrRoleChgHistoryRepository> {
|
||||
|
||||
public Page<UserAthrRoleChgHistory> findAll(Pageable pageable, String userId) {
|
||||
|
||||
BooleanExpression predicate = QUserAthrRoleChgHistory.
|
||||
userAthrRoleChgHistory.userId.eq(userId);
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface UserInfoRepository extends BaseRepository<UserInfo, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.apim.portal.user.entity.QUserInfo;
|
||||
import com.eactive.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserUISearch;
|
||||
import com.eactive.eai.rms.data.entity.man.role.QRole;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.annotations.QueryHints;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class UserInfoService extends
|
||||
AbstractEMSDataSerivce<UserInfo, String, UserInfoRepository> {
|
||||
|
||||
public List<UserInfo> selectUserById(String userId) {
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.selectFrom(qUserInfo)
|
||||
.where(qUserInfo.userid.eq(userId))
|
||||
.fetch();
|
||||
}
|
||||
|
||||
public Optional<UserInfo> findByOfctelno(String ofctelno) {
|
||||
BooleanExpression predicate = QUserInfo.userInfo.ofctelno.eq(ofctelno);
|
||||
return repository.findOne(predicate);
|
||||
}
|
||||
|
||||
public boolean isEAITeam(String empno, List<String> roleId) {
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
QRole qRole = QRole.role;
|
||||
|
||||
List<UserInfo> result = getJPAQueryFactory()
|
||||
.selectFrom(qUserInfo)
|
||||
.join(qRole)
|
||||
.on(qUserInfo.roleidnfiname.eq(qRole.roleId))
|
||||
.where(qUserInfo.userid.eq(empno)
|
||||
.and(qRole.roleId.in(roleId)))
|
||||
.limit(1)
|
||||
.fetch();
|
||||
|
||||
return !result.isEmpty();
|
||||
}
|
||||
|
||||
public Page<UserInfo> findAll(Pageable pageable,
|
||||
UserUISearch userUiSearch) {
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(userUiSearch.getSearchUserId())) {
|
||||
predicate.and(qUserInfo.userid.containsIgnoreCase(userUiSearch.getSearchUserId()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(userUiSearch.getSearchUserName())) {
|
||||
predicate.and(qUserInfo.username.containsIgnoreCase(userUiSearch.getSearchUserName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(userUiSearch.getSearchRoleName())) {
|
||||
List<String> userId = getJPAQueryFactory()
|
||||
.selectDistinct(qUserRole.id.userId)
|
||||
.from(qUserRole)
|
||||
.where(qUserRole.id.roleId.contains(userUiSearch.getSearchRoleName()))
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetch();
|
||||
|
||||
predicate.and(qUserInfo.userid.in(userId));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> selectAdminRoleUser(String roleId) {
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
|
||||
List<Tuple> results = getJPAQueryFactory()
|
||||
.select(qUserInfo.userid, qUserRole.id.roleId)
|
||||
.from(qUserInfo)
|
||||
.join(qUserRole)
|
||||
.on(qUserInfo.userid.eq(qUserRole.id.userId))
|
||||
.where(qUserRole.id.roleId.eq(roleId))
|
||||
.setHint(QueryHints.CACHEABLE, true)
|
||||
.fetch();
|
||||
|
||||
return results.stream().map(tuple -> {
|
||||
Map<String, Object> userRoleMap = new HashMap<>();
|
||||
userRoleMap.put("USERID", tuple.get(qUserInfo.userid));
|
||||
userRoleMap.put("ROLEID", tuple.get(qUserRole.id.roleId));
|
||||
return userRoleMap;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public Page<UserInfo> findByUsername(Pageable pageable, String username) {
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
BooleanExpression predicate = qUserInfo.isNotNull();
|
||||
|
||||
if(StringUtils.isNotBlank(username)) {
|
||||
predicate = QUserInfo.userInfo.username.containsIgnoreCase(username);
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserInfoVo {
|
||||
|
||||
private String userid;
|
||||
|
||||
private String username;
|
||||
|
||||
private String roleidnfiname;
|
||||
|
||||
private String pafiarinfobrncd;
|
||||
|
||||
private String cphnno;
|
||||
|
||||
private String ofctelno;
|
||||
|
||||
private String emad;
|
||||
|
||||
private String jobclcd;
|
||||
|
||||
private String jobtlname;
|
||||
|
||||
private String lastamndyms;
|
||||
|
||||
private String dvsnname;
|
||||
|
||||
private String teamname;
|
||||
|
||||
private String intnloutsrcdsticname;
|
||||
|
||||
private String eaigroupcodstcd;
|
||||
|
||||
private String spotprxyname;
|
||||
|
||||
private String spotprxyempid;
|
||||
|
||||
private String lastloginyms;
|
||||
|
||||
private String lastloginip;
|
||||
|
||||
private String secondmentbrncd;
|
||||
|
||||
private String secondmentstdt;
|
||||
|
||||
private String secondmentendt;
|
||||
|
||||
private String password;
|
||||
|
||||
private String allowip;
|
||||
|
||||
private String status;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.GeneratedValue;
|
||||
import javax.persistence.GenerationType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
import org.springframework.data.annotation.CreatedDate;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "TB_APIMS_LOIN_L")
|
||||
@org.hibernate.annotations.Table(appliesTo = "TB_APIMS_LOIN_L", comment = "사용자 로그인 로그")
|
||||
public class UserLoginHistory extends AbstractEntity<String> implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name="LOIN_LOG_ID", unique = true, nullable = false)
|
||||
@Comment("로그인 로그 식별자")
|
||||
private int loginLogId;
|
||||
|
||||
@Column(name="USER_ID", length = 20, nullable = false)
|
||||
@Comment("사용자 식별자(사번)")
|
||||
private String userId;
|
||||
|
||||
@Column(name="LOIN_DTTM", length = 14, nullable = false)
|
||||
@Comment("로그인 일시")
|
||||
@CreatedDate
|
||||
private LocalDateTime loginDttm;
|
||||
|
||||
@Column(name="LOIN_IP", length = 32, nullable = false)
|
||||
@Comment("로그인 IP")
|
||||
private String loginIp;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return Integer.toString(loginLogId);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface UserLoginHistoryRepository extends BaseRepository<UserLoginHistory, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserLoginHistoryUI;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import com.eactive.apim.portal.user.entity.QUserInfo;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class UserLoginHistoryService extends AbstractEMSDataSerivce<UserLoginHistory, String, UserLoginHistoryRepository> {
|
||||
|
||||
final String START_HHmmss = " 00:00:00";
|
||||
final String END_HHmmss = " 23:59:59";
|
||||
|
||||
public Page<UserLoginHistory> findAll(Pageable pageable, UserLoginHistoryUI userLoginHistoryUI) {
|
||||
QUserLoginHistory qUserLoginHistory = QUserLoginHistory.userLoginHistory;
|
||||
QUserInfo qUserInfo = QUserInfo.userInfo;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if(StringUtils.isNotBlank(userLoginHistoryUI.getSearchUserId())) {
|
||||
predicate = predicate.and(qUserLoginHistory.userId.containsIgnoreCase(userLoginHistoryUI.getSearchUserId()));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(userLoginHistoryUI.getSearchUserName())) {
|
||||
predicate = predicate.and(qUserInfo.username.containsIgnoreCase(userLoginHistoryUI.getSearchUserName()));
|
||||
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(userLoginHistoryUI.getSearchStartDate())
|
||||
&& StringUtils.isNotBlank(userLoginHistoryUI.getSearchEndDate())) {
|
||||
|
||||
String startDateStr = userLoginHistoryUI.getSearchStartYYYYMMDD() + START_HHmmss;
|
||||
String endDateStr = userLoginHistoryUI.getSearchEndYYYYMMDD() + END_HHmmss;
|
||||
|
||||
LocalDateTime startDate = LocalDateTime.parse(startDateStr, LocalDateTimeFormatters.FORMATTER_YYYY_MM_DD_HH_MM_SS_19);
|
||||
LocalDateTime endDate = LocalDateTime.parse(endDateStr, LocalDateTimeFormatters.FORMATTER_YYYY_MM_DD_HH_MM_SS_19);
|
||||
|
||||
predicate = predicate.and(qUserLoginHistory.loginDttm.between(startDate, endDate));
|
||||
}
|
||||
|
||||
List<UserLoginHistory> content = getJPAQueryFactory()
|
||||
.selectFrom(qUserLoginHistory)
|
||||
.join(qUserInfo).on(qUserLoginHistory.userId.eq(qUserInfo.userid))
|
||||
.where(predicate)
|
||||
.orderBy(qUserLoginHistory.loginLogId.desc())
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
long total = getJPAQueryFactory()
|
||||
.select(qUserLoginHistory.countDistinct())
|
||||
.from(qUserLoginHistory)
|
||||
.where(predicate)
|
||||
.join(qUserInfo).on(qUserLoginHistory.userId.eq(qUserInfo.userid))
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm04")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm04", comment = "user role")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class UserRole extends AbstractEntity<UserRoleId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private UserRoleId id;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class UserRoleId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false, length = 20)
|
||||
@Comment("사용자ID")
|
||||
private String userId;
|
||||
|
||||
@Column(nullable = false, length = 40)
|
||||
@Comment("역할ID")
|
||||
private String roleId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface UserRoleRepository extends BaseRepository<UserRole, UserRoleId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class UserRoleService extends AbstractEMSDataSerivce<UserRole, UserRoleId, UserRoleRepository> {
|
||||
|
||||
public String getRoleId(String empno) {
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
return repository.findOne(qUserRole.id.userId.eq(empno))
|
||||
.map(userRole -> userRole.getId().getRoleId())
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
public void deleteAllByUserId(String userId) {
|
||||
repository.deleteAll(findByUserId(userId));
|
||||
}
|
||||
|
||||
public List<UserRole> findByUserId(String userId) {
|
||||
QUserRole qUserRole = QUserRole.userRole;
|
||||
List<UserRole> list = new ArrayList<>();
|
||||
repository.findAll(qUserRole.id.userId.eq(userId)).forEach(list::add);
|
||||
return list;
|
||||
}
|
||||
|
||||
public void deleteOrSave(String userId, List<UserRole> userRoles) {
|
||||
List<UserRole> existUserRoles = findByUserId(userId);
|
||||
existUserRoles.removeAll(userRoles);
|
||||
deleteAll(existUserRoles);
|
||||
|
||||
userRoles.stream().forEach(userRole -> {
|
||||
if (!existsById(userRole.getId())) {
|
||||
repository.save(userRole);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseairm07")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseairm07", comment = "사용자 서비스타입")
|
||||
@Cacheable
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
public class UserServiceType extends AbstractEntity<UserServiceTypeId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private UserServiceTypeId id;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class UserServiceTypeId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false, length = 20)
|
||||
@Comment("사용자ID")
|
||||
private String userId;
|
||||
|
||||
@Column(nullable = false, length = 8)
|
||||
@Comment("사용자 서비스타입")
|
||||
private String useServiceType;
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface UserServiceTypeRepository extends BaseRepository<UserServiceType, UserServiceTypeId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
package com.eactive.eai.rms.data.entity.man.user;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class UserServiceTypeService
|
||||
extends
|
||||
AbstractDataService<UserServiceType, UserServiceTypeId, UserServiceTypeRepository> {
|
||||
|
||||
public void insertUserServiceType(String userId, String serviceType) {
|
||||
UserServiceTypeId id = new UserServiceTypeId(userId, serviceType);
|
||||
Optional<UserServiceType> existingServiceType = repository.findById(id);
|
||||
|
||||
if (!existingServiceType.isPresent()) {
|
||||
UserServiceType userServiceType = new UserServiceType();
|
||||
userServiceType.setId(id);
|
||||
repository.save(userServiceType);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public void deleteAllByUserId(String userId) {
|
||||
repository.deleteAll(findByUserId(userId));
|
||||
|
||||
}
|
||||
|
||||
|
||||
public String selectLoginUseServiceTypes(String userId) {
|
||||
List<UserServiceType> serviceTypes = selectUserServiceTypeList(userId);
|
||||
|
||||
return serviceTypes.stream()
|
||||
.map(userServiceType -> userServiceType.getId()
|
||||
.getUseServiceType())
|
||||
.sorted(Comparator.reverseOrder())
|
||||
.collect(Collectors.joining(","));
|
||||
}
|
||||
|
||||
|
||||
public List<UserServiceType> findByUserId(String userId) {
|
||||
QUserServiceType qUserServiceType = QUserServiceType.userServiceType;
|
||||
List<UserServiceType> list = new ArrayList<>();
|
||||
repository.findAll(qUserServiceType.id.userId.eq(userId))
|
||||
.forEach(list::add);
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
public List<UserServiceType> selectUserServiceTypeList(String userId) {
|
||||
return StreamSupport
|
||||
.stream(repository.findAll(
|
||||
QUserServiceType.userServiceType.id.userId
|
||||
.eq(userId))
|
||||
.spliterator(), false)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.Adapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterId;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface AdapterEMSRepository extends BaseRepository<Adapter, AdapterId> {
|
||||
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterGroup;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface AdapterGroupEMSRepository extends BaseRepository<AdapterGroup, String> {
|
||||
|
||||
List<AdapterGroup> findByAdptrcd(String adptrcd, Sort by);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,236 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import javax.transaction.Transactional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.Adapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterProp;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterPropGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
import com.eactive.eai.rms.onl.manage.adapter.adapter.ui.AdapterGroupUISearch;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
import com.querydsl.core.types.dsl.Expressions;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdapterGroupService extends AbstractDataService<AdapterGroup, String, AdapterGroupEMSRepository> {
|
||||
|
||||
@Autowired
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
public Page<AdapterGroup> findPage(Pageable pageable, AdapterGroupUISearch adapterGroupUISearch) {
|
||||
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
|
||||
List<String> userBusiness = userBusinessService.getCurrentUserBusinessCodes();
|
||||
BooleanExpression predicate = qAdapterGroup.eaibzwkdstcd.in(userBusiness);
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrMsgPtrnCd())) {
|
||||
predicate = predicate.and(qAdapterGroup.adptrmsgptrncd.eq(adapterGroupUISearch.getSearchAdptrMsgPtrnCd()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrUseYn())) {
|
||||
predicate = predicate.and(qAdapterGroup.adptruseyn.eq(adapterGroupUISearch.getSearchAdptrUseYn()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrBzwkGroupName())) {
|
||||
predicate = predicate
|
||||
.and(qAdapterGroup.adptrbzwkgroupname
|
||||
.containsIgnoreCase(adapterGroupUISearch.getSearchAdptrBzwkGroupName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrBzwkGroupDesc())) {
|
||||
predicate = predicate
|
||||
.and(qAdapterGroup.adptrbzwkgroupdesc
|
||||
.containsIgnoreCase(adapterGroupUISearch.getSearchAdptrBzwkGroupDesc()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrIoDstCd())) {
|
||||
predicate = predicate.and(qAdapterGroup.adptriodstcd.eq(adapterGroupUISearch.getSearchAdptrIoDstCd()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchEaiBzwkDstcd())) {
|
||||
predicate = predicate.and(qAdapterGroup.eaibzwkdstcd.eq(adapterGroupUISearch.getSearchEaiBzwkDstcd()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(adapterGroupUISearch.getSearchAdptrMsgDstCd())) {
|
||||
predicate = predicate.and(qAdapterGroup.adptrmsgdstcd.eq(adapterGroupUISearch.getSearchAdptrMsgDstCd()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public Iterable<AdapterGroup> findByAdptrIoDstcd(String adptrIoDstcd) {
|
||||
QAdapterGroup ag = QAdapterGroup.adapterGroup;
|
||||
BooleanExpression ex1 = ag.adptrbzwkgroupname.contains("_IO_");
|
||||
BooleanExpression ex2 = ag.adptrbzwkgroupname.contains("_IO{");
|
||||
BooleanExpression ex3 = ag.adptrbzwkgroupname.contains("_" + adptrIoDstcd + "_");
|
||||
|
||||
return repository.findAll(ex1.or(ex2).or(ex3));
|
||||
}
|
||||
|
||||
public List<Adapter> updateSingleNode(String node) {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
|
||||
List<AdapterGroup> adpaterGroups = getJPAQueryFactory()
|
||||
.select(qAdapterGroup)
|
||||
.from(qAdapterGroup)
|
||||
.join(qAdapter)
|
||||
.where(qAdapterGroup.adptrbzwkgroupname
|
||||
.contains("NET_AsC")
|
||||
.or(qAdapterGroup.adptrbzwkgroupname.contains("NET_SyC")))
|
||||
.where(qAdapterGroup.adptruseyn.eq("1"))
|
||||
.where(qAdapter.eaisevrinstncname.ne("ALL"))
|
||||
.fetch();
|
||||
|
||||
List<Adapter> adpaters = new ArrayList<>();
|
||||
|
||||
adpaterGroups.stream().flatMap(adpaterGroup -> adpaterGroup.getAdapters().stream()).forEach(adapter -> {
|
||||
String eaisevrinstncname = adapter.getEaisevrinstncname();
|
||||
eaisevrinstncname = StringUtils.substring(eaisevrinstncname, 0, 9) + node
|
||||
+ StringUtils.substring(eaisevrinstncname, 10, 11);
|
||||
adapter.setEaisevrinstncname(eaisevrinstncname);
|
||||
|
||||
adpaters.add(adapter);
|
||||
});
|
||||
|
||||
return adpaters;
|
||||
}
|
||||
|
||||
public List<AdapterGroup> findByAdptrcd(String adptrcd) {
|
||||
return repository.findByAdptrcd(adptrcd, Sort.by("adptrbzwkgroupname"));
|
||||
}
|
||||
|
||||
public Optional<String> getSocketMonitorPort(String eaisevrinstncname) {
|
||||
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
QAdapterPropGroup qAdapterPropGroup = QAdapterPropGroup.adapterPropGroup;
|
||||
QAdapterProp qAdapterProp = QAdapterProp.adapterProp;
|
||||
|
||||
JPAQuery<String> query = getJPAQueryFactory()
|
||||
.select(qAdapterProp.prpty2val)
|
||||
.from(qAdapterGroup)
|
||||
.innerJoin(qAdapterGroup.adapters, qAdapter)
|
||||
.innerJoin(qAdapter.adapterPropGroup, qAdapterPropGroup)
|
||||
.innerJoin(qAdapterPropGroup.adapterProps, qAdapterProp);
|
||||
|
||||
query.where(qAdapter.eaisevrinstncname.eq(eaisevrinstncname));
|
||||
query.where(qAdapterProp.id.prptyname.eq("port.number"));
|
||||
query.where(qAdapterGroup.adptrbzwkgroupname.contains("SOCKET_MONITOR"));
|
||||
|
||||
return Optional.ofNullable(query.fetchFirst());
|
||||
|
||||
//
|
||||
//
|
||||
// AdapterGroup socketMonitorAdapterGroup = repository.getReferenceById("SOCKET_MONITOR");
|
||||
//
|
||||
// Optional<Adapter> adapterOptional = socketMonitorAdapterGroup
|
||||
// .getAdapters()
|
||||
// .stream()
|
||||
// .filter(adapter -> StringUtils.equals(adapter.getEaisevrinstncname(), eaisevrinstncname))
|
||||
// .findAny();
|
||||
//
|
||||
// if (!adapterOptional.isPresent()) {
|
||||
// return Optional.ofNullable(null);
|
||||
// }
|
||||
//
|
||||
// // socket port number set
|
||||
// return adapterOptional
|
||||
// .get()
|
||||
// .getAdapterPropGroup()
|
||||
// .getAdapterProps()
|
||||
// .stream()
|
||||
// .filter(prop -> "port.number".equals(prop.getId().getPrptyname()))
|
||||
// .findAny()
|
||||
// .map(AdapterProp::getPrpty2val);
|
||||
|
||||
}
|
||||
|
||||
public List<String> findAdptrBzwkGroupNamesByPort(String searchAdptrBzwkGroupName, String searchPortNum) {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
QAdapterPropGroup qAdapterPropGroup = QAdapterPropGroup.adapterPropGroup;
|
||||
QAdapterProp qAdapterProp = QAdapterProp.adapterProp;
|
||||
|
||||
JPAQuery<String> query = getJPAQueryFactory()
|
||||
.selectDistinct(qAdapterGroup.adptrbzwkgroupname)
|
||||
.from(qAdapterGroup)
|
||||
.innerJoin(qAdapterGroup.adapters, qAdapter)
|
||||
.innerJoin(qAdapter.adapterPropGroup, qAdapterPropGroup)
|
||||
.innerJoin(qAdapterPropGroup.adapterProps, qAdapterProp);
|
||||
|
||||
query.where(qAdapterProp.id.prptyname.eq("port.number"));
|
||||
|
||||
if (StringUtils.isNotBlank(searchAdptrBzwkGroupName)) {
|
||||
query.where(qAdapterGroup.adptrbzwkgroupname.containsIgnoreCase(searchAdptrBzwkGroupName));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(searchPortNum)) {
|
||||
query.where(qAdapterProp.prpty2val.contains(searchPortNum));
|
||||
}
|
||||
|
||||
return query.fetch();
|
||||
}
|
||||
|
||||
public List<AdapterGroup> findByAdptruseyn(boolean useYn) {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
JPAQuery<AdapterGroup> query = getJPAQueryFactory().selectFrom(qAdapterGroup);
|
||||
|
||||
if (useYn) {
|
||||
query.where(qAdapterGroup.adptruseyn.eq("1"));
|
||||
} else {
|
||||
query.where(qAdapterGroup.adptruseyn.ne("1"));
|
||||
}
|
||||
|
||||
query.orderBy(qAdapterGroup.adptrbzwkgroupname.asc());
|
||||
|
||||
return query.fetch();
|
||||
}
|
||||
|
||||
public List<String> findAdptrNode() {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
|
||||
JPAQuery<String> query = getJPAQueryFactory().selectDistinct(qAdapterGroup.adptrbzwkgroupname.substring(1, 4))
|
||||
.from(qAdapterGroup)
|
||||
.where(qAdapterGroup.adptrmsgptrncd.eq("N")
|
||||
.and(qAdapterGroup.adptrbzwkgroupname.ne("SOCKET_MONITOR")
|
||||
.or(qAdapterGroup.adptrbzwkgroupname.like("_SIM%"))))
|
||||
.orderBy(qAdapterGroup.adptrbzwkgroupname.substring(1, 4).asc());
|
||||
|
||||
return query.fetch();
|
||||
}
|
||||
|
||||
public List<String> findAdptrNodeChnl(String chnnl) {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
|
||||
JPAQuery<String> query = getJPAQueryFactory()
|
||||
// .selectDistinct(qAdapterGroup.adptrbzwkgroupname.substring(qAdapterGroup.adptrbzwkgroupname.indexOf("_").add(1),
|
||||
// qAdapterGroup.adptrbzwkgroupname.indexOf("_").add(4)))
|
||||
.selectDistinct(qAdapterGroup.adptrbzwkgroupname.substring(1, 4)).from(qAdapterGroup)
|
||||
.where(qAdapterGroup.adptrmsgptrncd.eq("N")
|
||||
.and(qAdapterGroup.adptrbzwkgroupname.ne("SOCKET_MONITOR")
|
||||
.or(qAdapterGroup.adptrbzwkgroupname.like("_SIM%"))))
|
||||
.where(Expressions.stringTemplate("UPPER({0})", qAdapterGroup.adptrbzwkgroupname.substring(2, 4))
|
||||
.likeIgnoreCase("%" + chnnl + "%"))
|
||||
.orderBy(qAdapterGroup.adptrbzwkgroupname.substring(1, 4).asc());
|
||||
|
||||
return query.fetch();
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterProp;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterPropId;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface AdapterPropEMSRepository extends BaseRepository<AdapterProp, AdapterPropId> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterProp;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterPropId;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterProp;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterPropGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.querydsl.core.Tuple;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdapterPropService extends AbstractDataService<AdapterProp, AdapterPropId, AdapterPropEMSRepository> {
|
||||
|
||||
public List<Map<String, String>> findSnaAppcodeProps(String searchPrptygroupName) {
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
QAdapterPropGroup qAdapterPropGroup = QAdapterPropGroup.adapterPropGroup;
|
||||
QAdapterProp qAdapterProp = QAdapterProp.adapterProp;
|
||||
|
||||
JPAQuery<Tuple> query = getJPAQueryFactory()
|
||||
.select(qAdapter.id.adptrbzwkname, qAdapterProp.prpty2val)
|
||||
.from(qAdapterGroup)
|
||||
.join(qAdapterGroup.adapters, qAdapter)
|
||||
.join(qAdapter.adapterPropGroup, qAdapterPropGroup)
|
||||
.join(qAdapterPropGroup.adapterProps, qAdapterProp)
|
||||
.where(qAdapterGroup.adptrcd.eq("SNA"), qAdapterProp.id.prptyname.eq("APP_CODE"));
|
||||
|
||||
if (searchPrptygroupName != null && !searchPrptygroupName.isEmpty()) {
|
||||
query.where(qAdapterProp.id.prptygroupname.eq(searchPrptygroupName));
|
||||
}
|
||||
|
||||
query.orderBy(qAdapterGroup.adptrbzwkgroupname.asc());
|
||||
|
||||
List<Tuple> result = query.fetch();
|
||||
|
||||
return result.stream().map(t -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("ADPTRBZWKNAME", t.get(qAdapter.id.adptrbzwkname));
|
||||
map.put("PRPTY2VAL", t.get(qAdapterProp.prpty2val));
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageImpl;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.Adapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterId;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapter;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterProp;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterPropGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service("adapterEMSService")
|
||||
@Transactional
|
||||
public class AdapterService extends AbstractDataService<Adapter, AdapterId, AdapterEMSRepository> {
|
||||
|
||||
public Page<Adapter> selectList(Pageable pageable, OsidinstiSearch osidinstiSearch) {
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
QAdapterPropGroup qAdapterPropGroup = QAdapterPropGroup.adapterPropGroup;
|
||||
QAdapterGroup qAdapterGroup = QAdapterGroup.adapterGroup;
|
||||
QAdapterProp qAdapterProp = QAdapterProp.adapterProp;
|
||||
|
||||
BooleanExpression predicate = buildPredicate(osidinstiSearch);
|
||||
|
||||
List<Adapter> content = getJPAQueryFactory()
|
||||
.selectFrom(qAdapter)
|
||||
.join(qAdapter.adapterPropGroup, qAdapterPropGroup)
|
||||
.join(qAdapter.adapterPropGroup.adapterProps, qAdapterProp)
|
||||
.join(qAdapter.adapterGroup, qAdapterGroup)
|
||||
.where(predicate)
|
||||
.distinct()
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.fetch();
|
||||
|
||||
long total = getJPAQueryFactory()
|
||||
.select(qAdapter.countDistinct())
|
||||
.from(qAdapter)
|
||||
.where(predicate)
|
||||
.join(qAdapter.adapterPropGroup, qAdapterPropGroup)
|
||||
.join(qAdapter.adapterPropGroup.adapterProps, qAdapterProp)
|
||||
.join(qAdapter.adapterGroup, qAdapterGroup)
|
||||
.fetchOne();
|
||||
|
||||
return new PageImpl<>(content, pageable, total);
|
||||
}
|
||||
|
||||
public List<Adapter> findAllAdapter(OsidinstiSearch osidinstiSearch) {
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
|
||||
BooleanExpression predicate = buildPredicate(osidinstiSearch);
|
||||
|
||||
return getJPAQueryFactory().selectFrom(qAdapter)
|
||||
.where(predicate)
|
||||
.leftJoin(qAdapter.adapterPropGroup).fetchJoin()
|
||||
.leftJoin(qAdapter.adapterGroup).fetchJoin()
|
||||
.distinct()
|
||||
.fetch();
|
||||
}
|
||||
|
||||
private BooleanExpression buildPredicate(OsidinstiSearch osidinstiSearch) {
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
QAdapterProp qAdapterProp = QAdapterProp.adapterProp;
|
||||
|
||||
BooleanExpression predicate = qAdapterProp.adapterPropGroup.adapterProps.isNotEmpty()
|
||||
.and(qAdapterProp.id.prptyname.in("port.number", "URL", "host.name"));
|
||||
|
||||
if (StringUtils.isNotBlank(osidinstiSearch.getSearchAdptrBzwkGroupName())) {
|
||||
predicate = predicate.and(qAdapter.id.adptrbzwkgroupname.containsIgnoreCase(osidinstiSearch.getSearchAdptrBzwkGroupName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(osidinstiSearch.getSearchIp())) {
|
||||
predicate = predicate.and(qAdapterProp.id.prptyname.in("host.name", "URL")
|
||||
.and(qAdapterProp.prpty2val.containsIgnoreCase(osidinstiSearch.getSearchIp())));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(osidinstiSearch.getSearchPortNum())) {
|
||||
predicate = predicate.and(qAdapterProp.id.prptyname.in("port.number", "URL")
|
||||
.and(qAdapterProp.prpty2val.containsIgnoreCase(osidinstiSearch.getSearchPortNum())));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(osidinstiSearch.getSearchInstiName())) {
|
||||
predicate = predicate.and(qAdapter.adapterGroup.adptrbzwkgroupdesc.containsIgnoreCase(osidinstiSearch.getSearchInstiName()));
|
||||
}
|
||||
|
||||
return predicate;
|
||||
}
|
||||
|
||||
public Adapter findAdapter(String adptrBzwkGroupName) {
|
||||
QAdapter qAdapter = QAdapter.adapter;
|
||||
|
||||
return getJPAQueryFactory()
|
||||
.selectFrom(qAdapter)
|
||||
.distinct()
|
||||
.where(qAdapter.adapterGroup.adptrbzwkgroupname.eq(adptrBzwkGroupName))
|
||||
.fetchFirst();
|
||||
}
|
||||
|
||||
public Iterable<Adapter> findByIdAdptrbzwkgroupname(String gstatsysadptrbzwkgroupname) {
|
||||
return repository.findAll(QAdapter.adapter.id.adptrbzwkgroupname.eq(gstatsysadptrbzwkgroupname));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Entity
|
||||
@Table(name = "tseaiad04")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseaiad04", comment = "어댑터 타입에 해당 하는 프로퍼티의 정보(프로퍼티 설명, 도메인명 등)")
|
||||
public class AdapterTypeProperty extends AbstractEntity<AdapterTypePropertyId> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@EmbeddedId
|
||||
private AdapterTypePropertyId id;
|
||||
|
||||
@Column(length = 200, name = "ADPTRPRPTYDESC")
|
||||
@Comment("프라퍼티설명")
|
||||
private String adptrPrptyDesc;
|
||||
|
||||
@Column(length = 20, name = "DMNKND")
|
||||
@Comment("도메인명")
|
||||
private String dmnKnd;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
|
||||
@Embeddable
|
||||
public class AdapterTypePropertyId implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false, length = 3, name = "ADPTRCD")
|
||||
@Comment("어댑터 유형")
|
||||
private String adptrCd;
|
||||
|
||||
@Column(nullable = false, length = 1, name = "ADPTRIODSTCD")
|
||||
@Comment("입출력 구분")
|
||||
private String adptrIoDstcd;
|
||||
|
||||
@Column(nullable = false, length = 100, name = "ADPTRPRPTYNAME")
|
||||
@Comment("어댑터 프라퍼티 명")
|
||||
private String adptrPrptyName;
|
||||
|
||||
}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface AdapterTypePropertyRepository extends BaseRepository<AdapterTypeProperty, AdapterTypePropertyId> {
|
||||
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterGroup;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdapterTypePropertyService extends AbstractDataService<AdapterTypeProperty, AdapterTypePropertyId, AdapterTypePropertyRepository> {
|
||||
|
||||
public Iterable<AdapterTypeProperty> findByAdapterGroup(AdapterGroup adapterGroup) {
|
||||
return findByIdAdptrCdAndAdptrIoDstcd(adapterGroup.getAdptrcd(), adapterGroup.getAdptriodstcd());
|
||||
}
|
||||
|
||||
public Iterable<AdapterTypeProperty> findByIdAdptrCdAndAdptrIoDstcd(String adptrCd, String adptrIoDstcd) {
|
||||
QAdapterTypePropertyId id = QAdapterTypeProperty.adapterTypeProperty.id;
|
||||
BooleanExpression predicate = id.adptrCd.eq(adptrCd).and(id.adptrIoDstcd.eq(adptrIoDstcd));
|
||||
return repository.findAll(predicate, Sort.by("id.adptrPrptyName"));
|
||||
}
|
||||
|
||||
public Iterable<AdapterTypeProperty> findByAdptrCd(String adptrCd) {
|
||||
QAdapterTypePropertyId id = QAdapterTypeProperty.adapterTypeProperty.id;
|
||||
return repository.findAll(id.adptrCd.eq(adptrCd), Sort.by("id.adptrCd", "id.adptrIoDstcd", "id.adptrPrptyName"));
|
||||
}
|
||||
|
||||
public void deleteOrSave(String adptrCd, List<AdapterTypeProperty> newAdapterTypeProperties) {
|
||||
Iterable <AdapterTypeProperty> existingProperties = findByAdptrCd(adptrCd);
|
||||
|
||||
List<AdapterTypeProperty> propertiesToDelete = new ArrayList<>();
|
||||
existingProperties.forEach(propertiesToDelete::add);
|
||||
propertiesToDelete.removeAll(newAdapterTypeProperties);
|
||||
deleteAll(propertiesToDelete);
|
||||
|
||||
saveOrUpdateProperties(existingProperties, newAdapterTypeProperties);
|
||||
}
|
||||
|
||||
private void saveOrUpdateProperties(Iterable <AdapterTypeProperty> existingProperties, List<AdapterTypeProperty> newProperties) {
|
||||
|
||||
Map<AdapterTypePropertyId, AdapterTypeProperty> existingPropertiesMap = StreamSupport
|
||||
.stream(existingProperties.spliterator(), false)
|
||||
.collect(Collectors.toMap(AdapterTypeProperty::getId, property -> property));
|
||||
|
||||
newProperties.forEach(newProperty -> {
|
||||
AdapterTypeProperty existingProperty = existingPropertiesMap.get(newProperty.getId());
|
||||
|
||||
if(existingProperty != null) { // update
|
||||
existingProperty.setDmnKnd(newProperty.getDmnKnd());
|
||||
existingProperty.setAdptrPrptyDesc(newProperty.getAdptrPrptyDesc());
|
||||
repository.save(existingProperty);
|
||||
} else { // insert
|
||||
repository.save(newProperty);
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
public void deleteByIdAdptrCd(String adptrCd) {
|
||||
QAdapterTypePropertyId id = QAdapterTypeProperty.adapterTypeProperty.id;
|
||||
repository.deleteAll(repository.findAll(id.adptrCd.eq(adptrCd)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import javax.persistence.Cacheable;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Table;
|
||||
|
||||
import org.hibernate.annotations.Cache;
|
||||
import org.hibernate.annotations.CacheConcurrencyStrategy;
|
||||
import org.hibernate.annotations.Comment;
|
||||
|
||||
import com.eactive.eai.data.entity.AbstractEntity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(onlyExplicitlyIncluded = true, callSuper = true)
|
||||
|
||||
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
|
||||
@Cacheable
|
||||
@Entity
|
||||
@Table(name = "tseaicm23")
|
||||
@org.hibernate.annotations.Table(appliesTo = "tseaicm23", comment = "코드정의 도메인, 프로퍼티의 UI 표현을 위한 domain 정보(RADIO_YN, SELECT_YN 등)")
|
||||
public class CommonDomain extends AbstractEntity<String> implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id
|
||||
@Column(unique = true, nullable = false, length = 20)
|
||||
@Comment("도메인명")
|
||||
private String domainNm;
|
||||
|
||||
@Column(length = 10)
|
||||
@Comment("도메인 옵션")
|
||||
private String domainOption;
|
||||
|
||||
@Column(length = 10)
|
||||
@Comment("도메인 타입")
|
||||
private String domainType;
|
||||
|
||||
@Column(length = 1000)
|
||||
@Comment("도메인 값")
|
||||
private String domainVal;
|
||||
|
||||
@Override
|
||||
public @NonNull String getId() {
|
||||
return domainNm;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
public interface CommonDomainRepository extends BaseRepository<CommonDomain, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.common.comDomain.CommonDomainUI;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class CommonDomainService extends AbstractDataService<CommonDomain, String, CommonDomainRepository> {
|
||||
|
||||
public Page<CommonDomain> findAll(Pageable pageable, CommonDomainUI commonDomainUI) {
|
||||
QCommonDomain qCommonDomain = QCommonDomain.commonDomain;
|
||||
BooleanExpression predicate = qCommonDomain.domainNm.containsIgnoreCase(commonDomainUI.getSearchDomainNM());
|
||||
|
||||
if (StringUtils.isNotBlank(commonDomainUI.getSearchDomType())) {
|
||||
predicate = predicate.and(qCommonDomain.domainType.eq(commonDomainUI.getSearchDomType()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(commonDomainUI.getSearchDomOpt())) {
|
||||
predicate = predicate.and(qCommonDomain.domainOption.eq(commonDomainUI.getSearchDomOpt()));
|
||||
}
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adapter;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class OsidinstiSearch {
|
||||
|
||||
private String searchAdptrBzwkGroupName;
|
||||
|
||||
private String searchInstiName;
|
||||
|
||||
private String searchPortNum;
|
||||
|
||||
private String searchIp;
|
||||
|
||||
}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adaptertype;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterType;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
interface AdapterTypeRepository extends BaseRepository<AdapterType, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.adaptertype;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.adapter.AdapterType;
|
||||
import com.eactive.eai.data.entity.onl.adapter.QAdapterType;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class AdapterTypeService extends AbstractDataService<AdapterType, String, AdapterTypeRepository> {
|
||||
|
||||
public Page<AdapterType> findAll(Pageable pageable, String searchAdptrCd) {
|
||||
QAdapterType qAdapterType = QAdapterType.adapterType;
|
||||
return repository.findAll(qAdapterType.adptrcd.containsIgnoreCase(searchAdptrCd), pageable);
|
||||
}
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.apigroup;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.ApiGroup;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
|
||||
|
||||
public interface ApiGroupRepository extends BaseRepository<ApiGroup, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.apigroup;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.ApiGroup;
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.ApiGroupApi;
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroup;
|
||||
import com.eactive.eai.data.entity.onl.apim.apigroup.QApiGroupApi;
|
||||
import com.eactive.eai.data.jpa.AbstractDataService;
|
||||
import com.eactive.eai.rms.onl.apim.apigroup.ui.ApiGroupUISearch;
|
||||
import com.querydsl.core.types.dsl.BooleanExpression;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.hibernate.Hibernate;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class ApiGroupService extends AbstractDataService<ApiGroup, String, ApiGroupRepository> {
|
||||
|
||||
public Page<ApiGroup> selectList(ApiGroupUISearch apiGroupUISearch, Pageable pageable) {
|
||||
QApiGroup qApiGroup = QApiGroup.apiGroup;
|
||||
BooleanExpression predicate = qApiGroup.groupName.containsIgnoreCase(apiGroupUISearch.getSearchGroupName());
|
||||
|
||||
if (StringUtils.isNotBlank(apiGroupUISearch.getSearchGroupDesc())) {
|
||||
predicate = predicate.and(qApiGroup.groupDesc.containsIgnoreCase(apiGroupUISearch.getSearchGroupDesc()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(apiGroupUISearch.getSearchDisplayYn())) {
|
||||
predicate = predicate.and(qApiGroup.displayYn.eq(apiGroupUISearch.getSearchDisplayYn()));
|
||||
}
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public Optional<ApiGroup> findByIdWithApiList(String id) {
|
||||
return repository.findById(id)
|
||||
.map(apiGroup -> {
|
||||
Hibernate.initialize(apiGroup.getApiGroupApiList());
|
||||
return apiGroup;
|
||||
});
|
||||
}
|
||||
|
||||
public void deleteApiGroupApiByApiId(String apiId) {
|
||||
List<ApiGroup> apiGroups = repository.findAll();
|
||||
for (ApiGroup apiGroup : apiGroups) {
|
||||
List<ApiGroupApi> apiGroupApis = apiGroup.getApiGroupApiList();
|
||||
apiGroupApis.removeIf(apiGroupApi -> apiGroupApi.getId().getApiId().equals(apiId));
|
||||
repository.save(apiGroup);
|
||||
}
|
||||
}
|
||||
|
||||
public List<ApiGroup> findByApiId(String apiId) {
|
||||
QApiGroup qApiGroup = QApiGroup.apiGroup;
|
||||
QApiGroupApi qApiGroupApi = QApiGroupApi.apiGroupApi;
|
||||
|
||||
return getJPAQueryFactory().selectFrom(qApiGroup)
|
||||
.leftJoin(qApiGroup.apiGroupApiList, qApiGroupApi)
|
||||
.where(qApiGroupApi.id.apiId.eq(apiId))
|
||||
.distinct()
|
||||
.fetch();
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.approval;
|
||||
|
||||
import com.eactive.apim.portal.approval.entity.Approval;
|
||||
import com.eactive.apim.portal.approval.entity.ApprovalStatusUserType;
|
||||
import com.eactive.apim.portal.approval.entity.ApprovalType;
|
||||
import com.eactive.apim.portal.approval.entity.QApproval;
|
||||
import com.eactive.apim.portal.approval.repository.ApprovalRepository;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service(value = "approvalService")
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@RequiredArgsConstructor
|
||||
public class ApprovalService extends AbstractEMSDataSerivce<Approval, String, ApprovalRepository> {
|
||||
|
||||
public Page<Approval> findAll(Pageable pageable, PortalApprovalUISearch portalApprovalUISearch) {
|
||||
QApproval qApproval = QApproval.approval;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if(StringUtils.isNotEmpty(portalApprovalUISearch.getSearchApprovalType())) {
|
||||
predicate.and(qApproval.approvalType.eq(ApprovalType.valueOf(portalApprovalUISearch.getSearchApprovalType())));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotEmpty(portalApprovalUISearch.getSearchApprovalStatus())) {
|
||||
predicate.and(qApproval.approvalStatus.eq(
|
||||
ApprovalStatusUserType.createState(portalApprovalUISearch.getSearchApprovalStatus())
|
||||
));
|
||||
}
|
||||
|
||||
if(StringUtils.isNotEmpty(portalApprovalUISearch.getSearchApprovalSubject())) {
|
||||
predicate.and(qApproval.approvalSubject.containsIgnoreCase(portalApprovalUISearch.getSearchApprovalSubject()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
}
|
||||
+14
@@ -0,0 +1,14 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.approval;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortalApprovalUISearch {
|
||||
|
||||
private String searchApprovalType;
|
||||
|
||||
private String searchApprovalStatus;
|
||||
|
||||
private String searchApprovalSubject;
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalfaq;
|
||||
|
||||
import com.eactive.apim.portal.portalfaq.entity.PortalFaq;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalFaqRepository extends BaseRepository<PortalFaq, String> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalfaq;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortalFaqSearch {
|
||||
|
||||
private String searchUseYn;
|
||||
private String searchSubjectDetail;
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalfaq;
|
||||
|
||||
import com.eactive.apim.portal.portalfaq.entity.PortalFaq;
|
||||
import com.eactive.apim.portal.portalfaq.entity.QPortalFaq;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalFaqService extends AbstractEMSDataSerivce<PortalFaq, String, PortalFaqRepository> {
|
||||
|
||||
public Page<PortalFaq> findAll(Pageable pageable, PortalFaqSearch portalFaqSearch) {
|
||||
QPortalFaq qPortalFaq = QPortalFaq.portalFaq;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(portalFaqSearch.getSearchUseYn())) {
|
||||
predicate.and(qPortalFaq.useYn.eq(portalFaqSearch.getSearchUseYn()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalFaqSearch.getSearchSubjectDetail())) {
|
||||
predicate.and(qPortalFaq.faqQuestion.containsIgnoreCase(portalFaqSearch.getSearchSubjectDetail())
|
||||
.or(qPortalFaq.faqAnswer.containsIgnoreCase(portalFaqSearch.getSearchSubjectDetail())));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalinquiry;
|
||||
|
||||
import com.eactive.apim.portal.qna.entity.Inquiry;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalInquiryRepository extends BaseRepository<Inquiry, String> {
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalinquiry;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortalInquirySearch {
|
||||
private String searchSubjectDetail;
|
||||
|
||||
private String searchInquiryStatus;
|
||||
|
||||
private String searchInquiryUserName;
|
||||
|
||||
private String searchOrgId;
|
||||
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalinquiry;
|
||||
|
||||
import com.eactive.apim.portal.qna.entity.Inquiry;
|
||||
import com.eactive.apim.portal.qna.entity.QInquiry;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalInquiryService extends AbstractEMSDataSerivce<Inquiry, String, PortalInquiryRepository> {
|
||||
|
||||
public Page<Inquiry> findAll(Pageable pageable, PortalInquirySearch portalInquirySearch) {
|
||||
QInquiry qInquiry = QInquiry.inquiry;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(portalInquirySearch.getSearchInquiryStatus())) {
|
||||
predicate.and(qInquiry.inquiryStatus.eq(portalInquirySearch.getSearchInquiryStatus()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalInquirySearch.getSearchSubjectDetail())) {
|
||||
predicate.and(qInquiry.inquirySubject.containsIgnoreCase(portalInquirySearch.getSearchSubjectDetail())
|
||||
.or(qInquiry.inquiryDetail.containsIgnoreCase(portalInquirySearch.getSearchSubjectDetail())));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalInquirySearch.getSearchInquiryUserName())) {
|
||||
predicate.and(qInquiry.inquirer.userName.containsIgnoreCase(portalInquirySearch.getSearchInquiryUserName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalInquirySearch.getSearchOrgId())) {
|
||||
predicate.and(qInquiry.inquirer.portalOrg.id.eq(portalInquirySearch.getSearchOrgId()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalnotice;
|
||||
|
||||
import com.eactive.apim.portal.portalNotice.entity.PortalNotice;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalNoticeRepository extends BaseRepository<PortalNotice, String> {
|
||||
|
||||
}
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalnotice;
|
||||
|
||||
import com.eactive.apim.portal.portalNotice.entity.PortalNotice;
|
||||
import com.eactive.apim.portal.portalNotice.entity.QPortalNotice;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalNoticeService extends AbstractEMSDataSerivce<PortalNotice, String, PortalNoticeRepository> {
|
||||
|
||||
public Page<PortalNotice> findAll(Pageable pageable, PortalNoticeUISearch portalNoticeUISearch) {
|
||||
QPortalNotice qPortalNotice = QPortalNotice.portalNotice;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(portalNoticeUISearch.getSearchUseYn())) {
|
||||
predicate.and(qPortalNotice.useYn.eq(portalNoticeUISearch.getSearchUseYn()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalNoticeUISearch.getSearchSubjectDetail())) {
|
||||
predicate.and(qPortalNotice.noticeSubject.containsIgnoreCase(portalNoticeUISearch.getSearchSubjectDetail())
|
||||
.or(qPortalNotice.noticeDetail.containsIgnoreCase(portalNoticeUISearch.getSearchSubjectDetail())));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalnotice;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortalNoticeUISearch {
|
||||
|
||||
private String searchUseYn;
|
||||
private String searchSubjectDetail;
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalorg;
|
||||
|
||||
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalOrgRepository extends BaseRepository<PortalOrg, String> {
|
||||
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalorg;
|
||||
|
||||
import com.eactive.apim.portal.portalorg.entity.PortalOrg;
|
||||
import com.eactive.apim.portal.portalorg.entity.PortalOrgEnums;
|
||||
import com.eactive.apim.portal.portalorg.entity.QPortalOrg;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalOrgService extends AbstractEMSDataSerivce<PortalOrg, String, PortalOrgRepository> {
|
||||
|
||||
public Page<PortalOrg> findAll(Pageable pageable, PortalOrgUISearch portalOrgUISearch) {
|
||||
QPortalOrg qPortalOrg = QPortalOrg.portalOrg;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
// 기본 list 조회시엔 REMOVED 상태 아닌 데이터만 조회
|
||||
if (StringUtils.isNotBlank(portalOrgUISearch.getSearchOrgStatus())){
|
||||
predicate.and(qPortalOrg.orgStatus.eq(PortalOrgEnums.OrgStatus.valueOf(portalOrgUISearch.getSearchOrgStatus())));
|
||||
} else {
|
||||
predicate.and(qPortalOrg.orgStatus.ne(PortalOrgEnums.OrgStatus.REMOVED));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalOrgUISearch.getSearchOrgName())) {
|
||||
predicate.and(qPortalOrg.orgName.containsIgnoreCase(portalOrgUISearch.getSearchOrgName()));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalOrgUISearch.getSearchApprovalStatus())) {
|
||||
predicate.and(qPortalOrg.approvalStatus.eq(PortalOrgEnums.ApprovalStatus.valueOf(portalOrgUISearch.getSearchApprovalStatus())));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(portalOrgUISearch.getSearchOrgCompRegNo())) {
|
||||
predicate.and(qPortalOrg.compRegNo.containsIgnoreCase(portalOrgUISearch.getSearchOrgCompRegNo()));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
|
||||
public List<PortalOrg> findByOrgStatusAndApprovalStatus(String orgStatus, String approvalStatus){
|
||||
QPortalOrg qPortalOrg = QPortalOrg.portalOrg;
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(orgStatus)) {
|
||||
predicate.and(qPortalOrg.orgStatus.eq(PortalOrgEnums.OrgStatus.valueOf(orgStatus)));
|
||||
}
|
||||
|
||||
if (StringUtils.isNotBlank(approvalStatus)) {
|
||||
predicate.and(qPortalOrg.approvalStatus.eq(PortalOrgEnums.ApprovalStatus.valueOf(approvalStatus)));
|
||||
}
|
||||
|
||||
return StreamSupport.stream(
|
||||
repository.findAll(predicate).spliterator(), false)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalorg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PortalOrgUISearch {
|
||||
|
||||
private String searchApprovalStatus;
|
||||
private String searchOrgStatus;
|
||||
|
||||
private String searchOrgType;
|
||||
private String searchOrgName;
|
||||
private String searchOrgCompRegNo;
|
||||
|
||||
private String searchStartYYYYMMDD;
|
||||
private String searchEndYYYYMMDD;
|
||||
private String searchStartDate;
|
||||
private String searchEndDate;
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalpartnerslhip;
|
||||
|
||||
import com.eactive.apim.portal.partnershipapplication.entity.PartnershipApplication;
|
||||
import com.eactive.eai.data.jpa.BaseRepository;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
|
||||
@EMSDataSource
|
||||
public interface PortalPartnershipRepository extends BaseRepository<PartnershipApplication, String> {
|
||||
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.rms.data.entity.onl.apim.portalpartnerslhip;
|
||||
|
||||
import com.eactive.apim.portal.partnershipapplication.entity.PartnershipApplication;
|
||||
import com.eactive.apim.portal.partnershipapplication.entity.QPartnershipApplication;
|
||||
import com.eactive.eai.rms.data.jpa.AbstractEMSDataSerivce;
|
||||
import com.querydsl.core.BooleanBuilder;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class PortalPartnershipService extends AbstractEMSDataSerivce<PartnershipApplication, String, PortalPartnershipRepository> {
|
||||
|
||||
public Page<PartnershipApplication> findAll(Pageable pageable, String searchBizSubject, String searchBizDetail) {
|
||||
QPartnershipApplication qPartnershipApplication = QPartnershipApplication.partnershipApplication;
|
||||
|
||||
BooleanBuilder predicate = new BooleanBuilder();
|
||||
|
||||
if (StringUtils.isNotBlank(searchBizSubject)) {
|
||||
predicate.and(qPartnershipApplication.bizSubject.containsIgnoreCase(searchBizSubject));
|
||||
}
|
||||
if (StringUtils.isNotBlank(searchBizDetail)) {
|
||||
predicate.and(qPartnershipApplication.bizDetail.containsIgnoreCase(searchBizDetail));
|
||||
}
|
||||
|
||||
return repository.findAll(predicate, pageable);
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user