init
This commit is contained in:
+84
@@ -0,0 +1,84 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.web.method.HandlerMethod;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.IsAuditableUsecase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SaveAuditLogUseCase;
|
||||
import com.eactive.eai.rms.common.login.LoginVo;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RequiredArgsConstructor
|
||||
public class AuditLogInterceptor implements HandlerInterceptor {
|
||||
|
||||
private final SaveAuditLogUseCase saveAuditLogUseCase;
|
||||
|
||||
private final IsAuditableUsecase isAuditableUsecase;
|
||||
|
||||
@Override
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) {
|
||||
try {
|
||||
if (handler instanceof HandlerMethod) {
|
||||
String logType = ((HandlerMethod) handler).getBeanType().getSimpleName();
|
||||
LoginVo loginVo = (LoginVo) request.getSession().getAttribute(CommonConstants.LOGIN);
|
||||
if (loginVo != null) {
|
||||
String userId = loginVo.getUserId();
|
||||
String command = request.getParameter("cmd");
|
||||
String systemCode = request.getParameter("serviceType");
|
||||
String remoteAddress = request.getRemoteAddr();
|
||||
|
||||
if (isAuditableUsecase.isAuditable(userId, command, logType, systemCode)) {
|
||||
String parameters = getParametersAsString(request);
|
||||
log
|
||||
.debug("audit log save : logType={}, cmd={}, user={}, parameters={}", logType, command,
|
||||
userId, parameters);
|
||||
saveAuditLogUseCase.log(systemCode, logType, command, remoteAddress, userId, parameters);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("AuditLogInterceptor error", e);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private String getParametersAsString(HttpServletRequest request) {
|
||||
Map<String, String[]> parameterMap = request.getParameterMap();
|
||||
StringJoiner joiner = new StringJoiner("&");
|
||||
int totalLength = 0;
|
||||
int maxLength = 1000;
|
||||
|
||||
for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
String value = String.join(",", entry.getValue());
|
||||
String keyValue = key + "=" + value;
|
||||
int entryLength = keyValue.length();
|
||||
|
||||
if (totalLength + entryLength > maxLength) {
|
||||
int remainingLength = maxLength - totalLength;
|
||||
if (remainingLength > 0) {
|
||||
joiner.add(StringUtils.substring(keyValue, 0, remainingLength));
|
||||
}
|
||||
break;
|
||||
} else {
|
||||
joiner.add(keyValue);
|
||||
totalLength += entryLength;
|
||||
}
|
||||
}
|
||||
|
||||
return joiner.toString();
|
||||
}
|
||||
|
||||
}
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectDetailAuditLogUseCase;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
class AuditLogManDetailController {
|
||||
|
||||
private final SelectDetailAuditLogUseCase selectDetailAuditLogUseCase;
|
||||
|
||||
private final AuditLogManMapper auditLogManDetailUIMapper;
|
||||
|
||||
@GetMapping(value = "/common/acl/audit/auditLogMan.view", params = "cmd=DETAIL")
|
||||
public String viewDetail(HttpServletRequest request) {
|
||||
return "/common/acl/audit/auditLogManDetail";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/audit/auditLogMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<AuditLogManDetailUI> selectDetail(@RequestParam("logSeqNo") Long id) {
|
||||
AuditLog auditLog = selectDetailAuditLogUseCase.selectDetail(id);
|
||||
AuditLogManDetailUI auditLogManDetailUI = auditLogManDetailUIMapper.toUi(auditLog);
|
||||
return ResponseEntity.ok(auditLogManDetailUI);
|
||||
}
|
||||
|
||||
}
|
||||
+32
@@ -0,0 +1,32 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
||||
public class AuditLogManDetailUI {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String systemCode;
|
||||
|
||||
private String logTypeText;
|
||||
|
||||
private String command;
|
||||
|
||||
private String remoteAddress;
|
||||
|
||||
private String message;
|
||||
|
||||
private String parameters;
|
||||
|
||||
private String userId;
|
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastModifiedDate;
|
||||
|
||||
}
|
||||
+52
@@ -0,0 +1,52 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.SessionAttribute;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogUseCase;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.login.LoginVo;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class AuditLogManListController {
|
||||
|
||||
private final SelectListAuditLogUseCase selectListAuditLogUseCase;
|
||||
|
||||
private final AuditLogManMapper auditLogManMapper;
|
||||
|
||||
private final ComboService comboService;
|
||||
|
||||
@GetMapping(value = "/common/acl/audit/auditLogMan.view")
|
||||
public String viewList(@SessionAttribute(name = CommonConstants.LOGIN) LoginVo loginVo, Model model) {
|
||||
List<ComboVo> serviceTypeCombos = comboService.getFromServiceType(loginVo.getUseServiceTypes());
|
||||
model.addAttribute("serviceTypeCombos", serviceTypeCombos);
|
||||
|
||||
return "/common/acl/audit/auditLogMan";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/audit/auditLogMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<AuditLogManSelectListUI>> selectList(Pageable pageable,
|
||||
SelectListAuditLogCommand selectListAuditLogCommand) {
|
||||
|
||||
Page<AuditLogManSelectListUI> page = selectListAuditLogUseCase
|
||||
.selectList(pageable, selectListAuditLogCommand)
|
||||
.map(auditLogManMapper::map);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.data.mapper.EMSMapperConfig;
|
||||
|
||||
@Mapper(config = EMSMapperConfig.class)
|
||||
interface AuditLogManMapper {
|
||||
|
||||
AuditLogManSelectListUI map(AuditLog auditLog);
|
||||
|
||||
AuditLogManDetailUI toUi(AuditLog auditLog);
|
||||
|
||||
}
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.in.web;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AuditLogManSelectListUI {
|
||||
|
||||
private Long id;
|
||||
|
||||
@JsonProperty("LOGAMNDHMS")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime lastModifiedDate;
|
||||
|
||||
private String systemCode;
|
||||
|
||||
@JsonProperty("USERID")
|
||||
private String userId;
|
||||
|
||||
@JsonProperty("LOGTYPETEXT")
|
||||
private String logTypeText;
|
||||
|
||||
@JsonProperty("REMOTEADDRESS")
|
||||
private String remoteAddress;
|
||||
|
||||
private String command;
|
||||
|
||||
@JsonProperty("LOGMSG")
|
||||
private String message;
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.file;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.ServletContext;
|
||||
|
||||
import org.springframework.beans.factory.FactoryBean;
|
||||
import org.springframework.web.context.ServletContextAware;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditPoint;
|
||||
|
||||
public class AuditPointsFactoryBean implements FactoryBean<Map<String, AuditPoint>>, ServletContextAware {
|
||||
|
||||
private Map<String, AuditPoint> points = new HashMap<>();
|
||||
private String filePath;
|
||||
private ServletContext servletContext;
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setServletContext(ServletContext servletContext) {
|
||||
this.servletContext = servletContext;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, AuditPoint> getObject() throws Exception {
|
||||
try (BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(servletContext.getResourceAsStream(filePath), "UTF-8"))) {
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
String[] parts = line.split("_");
|
||||
if (parts.length == 4) {
|
||||
String logType = parts[0];
|
||||
String logTypeText = parts[1];
|
||||
String[] systemCodes = parts[2].split(",");
|
||||
String[] commands = parts[3].split(",");
|
||||
for (String systemCode : systemCodes) {
|
||||
for (String command : commands) {
|
||||
AuditPoint point = new AuditPoint(systemCode, logType, command, logTypeText);
|
||||
String key = AuditPoint.generateKey(logType, systemCode, command);
|
||||
points.put(key, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new AuditPointsFileNotExistException("Error reading audit points file", e);
|
||||
}
|
||||
return points;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<?> getObjectType() {
|
||||
return Map.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSingleton() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.file;
|
||||
|
||||
public class AuditPointsFileNotExistException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
public AuditPointsFileNotExistException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public AuditPointsFileNotExistException(String message, Throwable cause, boolean enableSuppression,
|
||||
boolean writableStackTrace) {
|
||||
super(message, cause, enableSuppression, writableStackTrace);
|
||||
}
|
||||
|
||||
public AuditPointsFileNotExistException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public AuditPointsFileNotExistException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public AuditPointsFileNotExistException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.persistence;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.AuditLogEntity;
|
||||
import com.eactive.eai.rms.data.mapper.EMSMapperConfig;
|
||||
|
||||
@Mapper(config = EMSMapperConfig.class)
|
||||
interface AuditLogMapper {
|
||||
|
||||
AuditLog toDomain(AuditLogEntity auditLogEntity);
|
||||
|
||||
AuditLogEntity toEntity(AuditLog auditLog);
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.persistence;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.AuditLogEntity;
|
||||
|
||||
public interface AuditLogPageRepository {
|
||||
Page<AuditLogEntity> findPage(Pageable pageable, SelectListAuditLogCommand command);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.persistence;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
|
||||
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 com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.AuditLogEntity;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.QAuditLogEntity;
|
||||
import com.querydsl.jpa.impl.JPAQuery;
|
||||
import com.querydsl.jpa.impl.JPAQueryFactory;
|
||||
|
||||
@EMSDataSource
|
||||
public class AuditLogPageRepositoryImpl implements AuditLogPageRepository {
|
||||
|
||||
private EntityManager entityManager;
|
||||
|
||||
@PersistenceContext(unitName = "entityManagerFactoryForEMS")
|
||||
public void setEntityManager(EntityManager entityManager) {
|
||||
this.entityManager = entityManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLogEntity> findPage(Pageable pageable, SelectListAuditLogCommand command) {
|
||||
|
||||
QAuditLogEntity qAuditLogEntity = QAuditLogEntity.auditLogEntity;
|
||||
JPAQuery<Long> jpaQuery = new JPAQueryFactory(entityManager)
|
||||
.select(qAuditLogEntity.count())
|
||||
.from(qAuditLogEntity);
|
||||
|
||||
jpaQuery
|
||||
.where(qAuditLogEntity.lastModifiedDate
|
||||
.between(command.getSearchStartDateTime(), command.getSearchEndDateTime()));
|
||||
|
||||
if (StringUtils.isNotBlank(command.getSearchSystemCode())) {
|
||||
jpaQuery.where(qAuditLogEntity.systemCode.eq(command.getSearchSystemCode()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(command.getSearchLogTypeText())) {
|
||||
jpaQuery.where(qAuditLogEntity.logTypeText.containsIgnoreCase(command.getSearchLogTypeText()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(command.getSearchUserId())) {
|
||||
jpaQuery.where(qAuditLogEntity.userId.containsIgnoreCase(command.getSearchUserId()));
|
||||
}
|
||||
if (StringUtils.isNotBlank(command.getSearchRemoteAddress())) {
|
||||
jpaQuery.where(qAuditLogEntity.remoteAddress.containsIgnoreCase(command.getSearchRemoteAddress()));
|
||||
}
|
||||
|
||||
long totalCount = jpaQuery.fetchOne();
|
||||
List<AuditLogEntity> auditLogs = jpaQuery
|
||||
.select(qAuditLogEntity)
|
||||
.offset(pageable.getOffset())
|
||||
.limit(pageable.getPageSize())
|
||||
.orderBy(qAuditLogEntity.lastModifiedDate.desc())
|
||||
.fetch();
|
||||
|
||||
return new PageImpl<>(auditLogs, pageable, totalCount);
|
||||
}
|
||||
}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.persistence;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SaveAuditLogPort;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SelectDetailAuditLogPort;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SelectListAuditLogPort;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.AuditLogEntity;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
class AuditLogPersistenceAdapter implements SelectListAuditLogPort, SelectDetailAuditLogPort, SaveAuditLogPort {
|
||||
|
||||
private final AuditLogRepository auditLogRepository;
|
||||
private final AuditLogMapper auditLogMapper;
|
||||
|
||||
@Override
|
||||
public Page<AuditLog> findPage(Pageable pageable, SelectListAuditLogCommand command) {
|
||||
return auditLogRepository.findPage(pageable, command).map(auditLogMapper::toDomain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuditLog getById(Long id) {
|
||||
return auditLogMapper.toDomain(auditLogRepository.getReferenceById(id));
|
||||
}
|
||||
|
||||
@Override
|
||||
public AuditLog save(AuditLog auditLog) {
|
||||
AuditLogEntity auditLogEntity = auditLogMapper.toEntity(auditLog);
|
||||
Long id = auditLogRepository.save(auditLogEntity).getId();
|
||||
auditLog.setId(id);
|
||||
return auditLog;
|
||||
}
|
||||
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.adapter.out.persistence;
|
||||
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
import com.eactive.eai.rms.data.EMSDataSource;
|
||||
import com.eactive.eai.rms.data.entity.man.audit.AuditLogEntity;
|
||||
|
||||
@EMSDataSource
|
||||
public interface AuditLogRepository extends JpaRepository<AuditLogEntity, Long>, AuditLogPageRepository {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.adapter.in.web.AuditLogInterceptor;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.IsAuditableUsecase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SaveAuditLogUseCase;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@RequiredArgsConstructor
|
||||
@Configuration
|
||||
public class AuditLogConfiguration {
|
||||
|
||||
private final SaveAuditLogUseCase saveAuditLogUseCase;
|
||||
|
||||
private final IsAuditableUsecase isAuditableUsecase;
|
||||
|
||||
@Bean
|
||||
public AuditLogInterceptor auditLogInterceptor() {
|
||||
return new AuditLogInterceptor(saveAuditLogUseCase, isAuditableUsecase);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.domain;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Data
|
||||
@RequiredArgsConstructor
|
||||
public class AuditLog {
|
||||
|
||||
private Long id;
|
||||
|
||||
private final String systemCode;
|
||||
|
||||
private final String logType;
|
||||
|
||||
private final String command;
|
||||
|
||||
private final String userId;
|
||||
|
||||
private final String remoteAddress;
|
||||
|
||||
private String logTypeText;
|
||||
|
||||
private String parameters;
|
||||
|
||||
private LocalDateTime lastModifiedDate;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class AuditPoint {
|
||||
|
||||
private static final String LOGGING_POINT_KEY_FORMAT = "%s_%s_%s";
|
||||
|
||||
private String systemCode;
|
||||
|
||||
private String logType;
|
||||
|
||||
private String command;
|
||||
|
||||
private String logTypeText;
|
||||
|
||||
public static String generateKey(String logType, String systemCode, String command) {
|
||||
return String.format(LOGGING_POINT_KEY_FORMAT, logType, systemCode, command);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.in;
|
||||
|
||||
public interface IsAuditableUsecase {
|
||||
|
||||
public boolean isAuditable(String userId, String command, String logType, String systemCode);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.in;
|
||||
|
||||
public interface SaveAuditLogUseCase {
|
||||
|
||||
public void log(String systemCode, String logType, String command, String remoteAddress, String userId,
|
||||
String parameters);
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.in;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
|
||||
public interface SelectDetailAuditLogUseCase {
|
||||
|
||||
public AuditLog selectDetail(Long id);
|
||||
|
||||
}
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.in;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class SelectListAuditLogCommand {
|
||||
|
||||
private String searchSystemCode;
|
||||
private String searchLogTypeText;
|
||||
|
||||
private String searchUserId;
|
||||
private String searchRemoteAddress;
|
||||
|
||||
@JsonFormat(pattern = "yyyyMMddHHmmss")
|
||||
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
||||
private LocalDateTime searchStartDateTime;
|
||||
|
||||
@JsonFormat(pattern = "yyyyMMddHHmmss")
|
||||
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
||||
private LocalDateTime searchEndDateTime;
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.in;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
|
||||
public interface SelectListAuditLogUseCase {
|
||||
|
||||
public Page<AuditLog> selectList(
|
||||
Pageable pageable, SelectListAuditLogCommand command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.out;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
|
||||
public interface SaveAuditLogPort {
|
||||
|
||||
AuditLog save(AuditLog auditLog);
|
||||
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.out;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
|
||||
public interface SelectDetailAuditLogPort {
|
||||
|
||||
AuditLog getById(Long id);
|
||||
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.port.out;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
|
||||
public interface SelectListAuditLogPort {
|
||||
|
||||
Page<AuditLog> findPage(Pageable pageable, SelectListAuditLogCommand command);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,88 @@
|
||||
package com.eactive.eai.rms.common.acl.audit.service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
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.audit.domain.AuditLog;
|
||||
import com.eactive.eai.rms.common.acl.audit.domain.AuditPoint;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.IsAuditableUsecase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SaveAuditLogUseCase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectDetailAuditLogUseCase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogCommand;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.in.SelectListAuditLogUseCase;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SaveAuditLogPort;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SelectDetailAuditLogPort;
|
||||
import com.eactive.eai.rms.common.acl.audit.port.out.SelectListAuditLogPort;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
class AuditLogService
|
||||
implements SaveAuditLogUseCase, SelectListAuditLogUseCase, SelectDetailAuditLogUseCase, IsAuditableUsecase {
|
||||
|
||||
private final SelectListAuditLogPort selectListAuditLogPort;
|
||||
|
||||
private final SelectDetailAuditLogPort selectDetailAuditLogPort;
|
||||
|
||||
private final SaveAuditLogPort saveAuditLogPort;
|
||||
|
||||
private final Map<String, AuditPoint> auditPoints;
|
||||
|
||||
@Autowired
|
||||
public AuditLogService(SelectListAuditLogPort selectListAuditLogPort,
|
||||
SelectDetailAuditLogPort selectDetailAuditLogPort, SaveAuditLogPort saveAuditLogPort,
|
||||
@Qualifier("auditPoints") Map<String, AuditPoint> auditPoints) {
|
||||
this.selectListAuditLogPort = selectListAuditLogPort;
|
||||
this.selectDetailAuditLogPort = selectDetailAuditLogPort;
|
||||
this.saveAuditLogPort = saveAuditLogPort;
|
||||
this.auditPoints = auditPoints;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<AuditLog> selectList(Pageable pageable, SelectListAuditLogCommand command) {
|
||||
return selectListAuditLogPort.findPage(pageable, command);
|
||||
}
|
||||
|
||||
public AuditLog selectDetail(Long id) {
|
||||
return selectDetailAuditLogPort.getById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void log(String systemCode, String logType, String command, String remoteAddress, String userId,
|
||||
String parameters) {
|
||||
|
||||
AuditLog auditLog = new AuditLog(systemCode, logType, command, userId, remoteAddress);
|
||||
String auditPointKey = AuditPoint.generateKey(logType, systemCode, command);
|
||||
AuditPoint auditPoint = auditPoints.get(auditPointKey);
|
||||
|
||||
auditLog.setLogTypeText(auditPoint.getLogTypeText());
|
||||
auditLog.setLastModifiedDate(LocalDateTime.now());
|
||||
auditLog.setParameters(parameters);
|
||||
|
||||
saveAuditLogPort.save(auditLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAuditable(String userId, String command, String logType, String systemCode) {
|
||||
if (StringUtils.isAnyBlank(userId, command, logType, systemCode)) {
|
||||
log
|
||||
.debug("audit log save : logType={}, cmd={}, user={}, systemCode={}", logType, command, userId,
|
||||
systemCode);
|
||||
return false;
|
||||
}
|
||||
|
||||
String loggingPointKey = AuditPoint.generateKey(logType, systemCode, command);
|
||||
return auditPoints.containsKey(loggingPointKey);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
package com.eactive.eai.rms.common.acl.bizKeyTran;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
@Controller
|
||||
public class BizKeyTranController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
|
||||
@Autowired
|
||||
private BizKeyTranManService bizKeyTranManService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("comboService")
|
||||
private ComboService comboService;
|
||||
|
||||
@GetMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.view", params = "cmd=DETAIL")
|
||||
public String detailView() {
|
||||
return "/common/acl/bizKeyTran/bizKeyTranManDetail";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<BizKeyTranUI>> selectList(@SortDefault("eaibzwkdstcd") Pageable pageable,
|
||||
BizKeyTranUI bizKeyTranUI) {
|
||||
Page<BizKeyTranUI> page = bizKeyTranManService.selectList(pageable, bizKeyTranUI);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> initCombo() {
|
||||
|
||||
List<ComboVo> listEAICode = comboService.getFromBizCode("EAI");// 업무구분코드
|
||||
List<ComboVo> listApCode = comboService.getFromBizCode("APP");// AP코드
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("listEAICodeRows", listEAICode);
|
||||
resultMap.put("listApCodeRows", listApCode);
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<BizKeyTranUI> selectDetail(String eaiBzwkDstcd) {
|
||||
BizKeyTranUI bizKeyTranUI = bizKeyTranManService.selectDetail(eaiBzwkDstcd);
|
||||
return ResponseEntity.ok(bizKeyTranUI);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(BizKeyTranUI bizKeyTranUI) {
|
||||
bizKeyTranManService.insert(bizKeyTranUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(BizKeyTranUI bizKeyTranUI) {
|
||||
bizKeyTranManService.update(bizKeyTranUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String eaiBzwkDstcd) {
|
||||
bizKeyTranManService.delete(eaiBzwkDstcd);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/bizKeyTran/bizKeyTranMan.excel", params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(@RequestParam Map<String, Object> paramMap) throws JsonProcessingException {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
|
||||
String[] headers = objectMapper.readValue((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = objectMapper.readValue((String) paramMap.get("headerTitle"), String[].class);
|
||||
Map<String, Object>[] datas = bizKeyTranManService.selectListToExcel();
|
||||
Map<String, Object>[] lmerge = null;
|
||||
String merge = (String) paramMap.get("merge");
|
||||
|
||||
if (merge != null) {
|
||||
lmerge = objectMapper.readValue(merge, new TypeReference<HashMap<String, Object>[]>(){
|
||||
});
|
||||
}
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", datas);
|
||||
resultMap.put("fileName", paramMap.get("fileName"));
|
||||
resultMap.put("merge", lmerge);
|
||||
return new ModelAndView("excelView", resultMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.rms.common.acl.bizKeyTran;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
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 org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.data.entity.man.bizKeyTran.BizKeyTran;
|
||||
import com.eactive.eai.rms.data.entity.man.bizKeyTran.BizKeyTranService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class BizKeyTranManService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private BizKeyTranService bizKeyTranService;
|
||||
|
||||
@Autowired
|
||||
private BizKeyTranUIMapper bizKeyTranUIMapper;
|
||||
|
||||
public Page<BizKeyTranUI> selectList(Pageable pageable, BizKeyTranUI bizKeyTranUI) {
|
||||
Page<BizKeyTran> page = bizKeyTranService.findAll(pageable, bizKeyTranUI);
|
||||
return page.map(bizKeyTranUIMapper::toVo);
|
||||
}
|
||||
|
||||
public BizKeyTranUI selectDetail(String eaiBzwkDstcd) {
|
||||
BizKeyTran bizKeyTran = bizKeyTranService.getById(eaiBzwkDstcd);
|
||||
return bizKeyTranUIMapper.toVo(bizKeyTran);
|
||||
}
|
||||
|
||||
public void insert(BizKeyTranUI bizKeyTranUI) {
|
||||
if (bizKeyTranService.existsById(bizKeyTranUI.getEaiBzwkDstcd())) {
|
||||
throw new BizException("중복된 업무구분코드가 존재합니다.");
|
||||
}
|
||||
BizKeyTran bizKeyTran = bizKeyTranUIMapper.toEntity(bizKeyTranUI);
|
||||
bizKeyTranService.save(bizKeyTran);
|
||||
}
|
||||
|
||||
public void update(BizKeyTranUI bizKeyTranUI) {
|
||||
BizKeyTran bizKeyTran = bizKeyTranService.getById(bizKeyTranUI.getEaiBzwkDstcd());
|
||||
bizKeyTranUIMapper.updateToEntity(bizKeyTranUI, bizKeyTran);
|
||||
bizKeyTranService.save(bizKeyTran);
|
||||
}
|
||||
|
||||
public void delete(String eaiBzwkDstcd) {
|
||||
bizKeyTranService.deleteById(eaiBzwkDstcd);
|
||||
}
|
||||
|
||||
public String selectBizKeyForApCode(String eaiBzwkDstcd) {
|
||||
Optional<BizKeyTran> bizKeyTran = bizKeyTranService.findById(eaiBzwkDstcd);
|
||||
return bizKeyTran.map(BizKeyTran::getApcode).orElse(eaiBzwkDstcd);
|
||||
}
|
||||
|
||||
public Map<String, Object>[] selectListToExcel() {
|
||||
@SuppressWarnings("unchecked")
|
||||
Map<String, Object>[] mapArray = bizKeyTranService.findAll(Sort.by("eaibzwkdstcd")).stream().map(e -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("EAIBZWKDSTCD", e.getEaibzwkdstcd());
|
||||
map.put("APCODE", e.getApcode());
|
||||
return map;
|
||||
}).toArray(HashMap[]::new);
|
||||
return mapArray;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.eactive.eai.rms.common.acl.bizKeyTran;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class BizKeyTranUI {
|
||||
|
||||
@JsonProperty("EAIBZWKDSTCD")
|
||||
private String eaiBzwkDstcd;
|
||||
|
||||
@JsonProperty("APCODE")
|
||||
private String apCode;
|
||||
|
||||
private String searchEaiBzwkDstcd;
|
||||
|
||||
private String searchApCode;
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.eactive.eai.rms.common.acl.bizKeyTran;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.data.entity.man.bizKeyTran.BizKeyTran;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface BizKeyTranUIMapper extends GenericMapper<BizKeyTranUI, BizKeyTran> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "eaibzwkdstcd", target = "eaiBzwkDstcd")
|
||||
@Mapping(source = "apcode", target = "apCode")
|
||||
BizKeyTranUI toVo(BizKeyTran entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
BizKeyTran toEntity(BizKeyTranUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(BizKeyTranUI bizKeyTranUI, @MappingTarget BizKeyTran bizKeyTran);
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
package com.eactive.eai.rms.common.acl.deploy;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.eactive.eai.rms.onl.loader.service.RuleDeployJobService;
|
||||
|
||||
@Controller
|
||||
public class RuleDeployJobController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private RuleDeployJobService ruleDeployJobService;
|
||||
|
||||
@RequestMapping(value = "/common/acl/deploy/ruleDeployJobMan.view")
|
||||
public String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd)
|
||||
throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/deploy/ruleDeployJobMan.json", params = "cmd=LIST")
|
||||
public ModelAndView selectList(JsonPageVo pageVo, String searchJobTitle, String searchStatus, String sortName,
|
||||
String sortOrder) throws Exception {
|
||||
HashMap<String, Object> map = ruleDeployJobService.selectList(pageVo.getStartNum(), pageVo.getEndNum(),
|
||||
searchJobTitle, searchStatus, sortName, sortOrder);
|
||||
|
||||
pageVo.setTotalCount((Integer) map.get("totalCount"));
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("total", pageVo.getTotal()); // 전체 페이지수
|
||||
resultMap.put("page", pageVo.getPage()); // 현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());// 전체 레코드건수
|
||||
resultMap.put("rows", map.get("list"));
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@RequestMapping(value = "/common/acl/deploy/ruleDeployJobMan.json", params = "cmd=DETAIL")
|
||||
private ModelAndView selectDetail(HttpServletRequest request, HttpServletResponse response, String jobId)
|
||||
throws Exception {
|
||||
HashMap map = ruleDeployJobService.selectJobDetail(jobId);
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", map);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@RequestMapping(value = "/common/acl/deploy/ruleDeployJobMan.json", params = "cmd=DELETE")
|
||||
private String delete(HttpServletRequest request, HttpServletResponse response, String jobId) throws Exception {
|
||||
HashMap paramMap = new HashMap();
|
||||
paramMap.put("jobId", jobId);
|
||||
ruleDeployJobService.delete(paramMap);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.eactive.eai.rms.common.acl.iocm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.BizService;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
//import com.eactive.eai.rms.onl.manage.rule.aurora.AuroraUtil;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
@Controller
|
||||
public class IocmProcController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("iocmService")
|
||||
private IocmProcService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
@Autowired
|
||||
private ComboService comboService;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("bizService")
|
||||
private BizService bizService;
|
||||
|
||||
|
||||
@RequestMapping(value = "/common/acl/iocm/iocmProcMan.view")
|
||||
public String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/iocm/iocmProcMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String, Object> paramMap
|
||||
) throws Exception {
|
||||
HashMap map = service.selectList( pageVo.getStartNum(), pageVo.getEndNum(), paramMap);
|
||||
|
||||
pageVo.setTotalCount((Integer)map.get("totalCount"));
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , map.get("list"));
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@PostMapping(value= "/common/acl/iocm/iocmProcMan.json",params = "cmd=LIST_INIT_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> initCombo(HttpServletRequest request, HttpServletResponse response) throws Exception {
|
||||
List<ComboVo> chmnErrcdList = comboService.getMonitoringCodeSortedByIdCode("IOCM_CHMNERRCD");
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("chmnErrcdRows" , chmnErrcdList);
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/common/acl/iocm/iocmProcMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
String headersStr = (String) paramMap.get("headersStr");
|
||||
headersStr = headersStr.replace("CMDATE", "MODFIMGTMODFIYMS");
|
||||
headersStr = headersStr.substring(0, headersStr.length()-1);
|
||||
paramMap.put("headersStr", headersStr);
|
||||
|
||||
Gson gson = new Gson();
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object> list = service.selectListToExcel(paramMap);
|
||||
|
||||
String jsonStr = gson.toJson(list.get("list"));
|
||||
HashMap<String, String>[] list2 = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
String merge = (String)paramMap.get("merge");
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list2);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value= "/common/acl/iocm/iocmProcMan.json", params = "cmd=LIST_CM")
|
||||
public ModelAndView cmFileList(HttpServletRequest request, HttpServletResponse response,String eaiBzwkDstCd,String pkgNumber) throws Exception {
|
||||
String userId = SessionManager.getUserId(request);
|
||||
Properties prop = monitoringContext.getProperties();
|
||||
if (prop == null || prop.size()==0) {
|
||||
throw new Exception("프라퍼티 정보가 없습니다. - CM_CONFIG");
|
||||
}
|
||||
String auroraIni = (String)prop.getProperty(MonitoringContext.CM_AURORA_INI_PATH,"/fshome/greai/eaiadm/aurora/auroraApi_config.ini");
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
// try {
|
||||
// String groupCoCd = bizService.selectGroupCoCdByEAIBzwkDstCd(eaiBzwkDstCd);
|
||||
// AuroraUtil aurora = new AuroraUtil(auroraIni);
|
||||
// //List cmList = aurora.getCMList(userId, groupCoCd, eaiBzwkDstCd);
|
||||
// List cmFileList = new ArrayList();
|
||||
// if (userId != null && groupCoCd != null && eaiBzwkDstCd != null && pkgNumber != null) {
|
||||
// cmFileList = aurora.getCmFileList(userId, groupCoCd, eaiBzwkDstCd, pkgNumber);
|
||||
//
|
||||
// }
|
||||
// if (cmFileList == null || cmFileList.size() == 0) {
|
||||
// throw new BizException("해당 업무에 대한 파일 리스트가 없습니다.");
|
||||
// }
|
||||
// //resultMap.put("cmList", cmList);
|
||||
// resultMap.put("cmFileList", cmFileList);
|
||||
// } catch (BizException be) {
|
||||
// throw new Exception(be.getMessage());
|
||||
// } catch (Exception e) {
|
||||
// logger.error(e.getMessage());
|
||||
// throw new Exception();
|
||||
// }
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.eactive.eai.rms.common.acl.iocm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientForMonitoringTemplateDao;
|
||||
|
||||
@Repository("iocmProcDao")
|
||||
@SuppressWarnings({"deprecation","unchecked"})
|
||||
public class IocmProcDao extends SqlMapClientForMonitoringTemplateDao {
|
||||
|
||||
public int selectListCount(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (Integer) this.template.queryForObject("IocmProc.selectListCount", paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("IocmProc.selectList", paramMap);
|
||||
}
|
||||
|
||||
public List selectListToExcel(HashMap paramMap) throws Exception {
|
||||
return template.queryForList("IocmProc.selectListToExcel", paramMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.eactive.eai.rms.common.acl.iocm;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
|
||||
@Service("iocmService")
|
||||
@SuppressWarnings("unchecked")
|
||||
public class IocmProcService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private IocmProcDao dao;
|
||||
|
||||
|
||||
public HashMap<String, Object> selectList(int startNum,int endNum,HashMap paramMap) throws Exception {
|
||||
|
||||
|
||||
// 전체 목록수 얻기
|
||||
int totalCount = dao.selectListCount(paramMap);
|
||||
|
||||
paramMap.put("startNum" , startNum);// 시작 record
|
||||
paramMap.put("endNum" , endNum);// 끝 record
|
||||
|
||||
List list = dao.selectList(paramMap);
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("totalCount", totalCount);
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
public HashMap selectListToExcel(HashMap<String, Object> paramMap ) throws Exception {
|
||||
|
||||
List list = dao.selectListToExcel(paramMap);
|
||||
|
||||
HashMap map = new HashMap();
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUISearch;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
|
||||
@Controller
|
||||
@RequiredArgsConstructor
|
||||
public class MenuController extends BaseAnnotationController {
|
||||
|
||||
private final MenuManService menuManService;
|
||||
private final ComboService comboService;
|
||||
|
||||
@GetMapping(value = "/common/acl/menu/menuMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/menu/menuMan.view", params = "cmd=POPUP")
|
||||
public String viewList() {
|
||||
return "/common/acl/menu/menuManPopup";
|
||||
}
|
||||
|
||||
@ResponseBody
|
||||
@RequestMapping(value = "/common/acl/menu/menuMan.json", params = "cmd=LIST_TREE")
|
||||
public ResponseEntity<GridResponse<MenuUI>> selectTree(
|
||||
@RequestParam(name = "nodeid", required = false) String menuId, MenuUISearch menuUISearch) {
|
||||
if (StringUtils.isNotBlank(menuId)) {
|
||||
return ResponseEntity.ok(new GridResponse<>(new ArrayList<>()));
|
||||
}
|
||||
List<MenuUI> list = menuManService.selectTree(menuUISearch);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/menu/menuMan.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> initCombo() {
|
||||
|
||||
List<ComboVo> listUseYnType = comboService.getMonitoringCodeSortedByIdCode("USE_YN_TYPE");
|
||||
List<ComboVo> listDisplayYn = comboService.getMonitoringCodeSortedByIdCode("DISPLAY_YN");
|
||||
List<ComboVo> listMenuAppCd = comboService.getMonitoringCodeSortedByIdCode("MENU_APP_CD");
|
||||
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("displayYnRows", listDisplayYn);
|
||||
resultMap.put("useYnTypeRows", listUseYnType);
|
||||
resultMap.put("menuAppCdRows", listMenuAppCd);
|
||||
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/menu/menuMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(MenuUI menuUI) {
|
||||
menuManService.insert(menuUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/menu/menuMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<Void> update(MenuUI menuUI) {
|
||||
menuManService.update(menuUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/menu/menuMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String menuId) {
|
||||
menuManService.delete(menuId);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUISearch;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
|
||||
@Controller
|
||||
public class MenuDbTableController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private MenuManService menuManService;
|
||||
|
||||
@GetMapping(value = "/common/acl/menu/menuDBTableMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/menu/menuDBTableMan.view", params = "cmd=LIST")
|
||||
public String viewList() {
|
||||
return "/common/acl/menu/menuDBTableMan";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/menu/menuDBTableMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<MenuUI>> selectTree(
|
||||
@SortDefault(sort = { "menuId", "sortOrder" }) Pageable pageable, MenuUISearch menuUISearch) {
|
||||
Page<MenuUI> page = menuManService.selectDbList(pageable, menuUISearch);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUISearch;
|
||||
|
||||
public interface MenuManService {
|
||||
|
||||
public List<MenuUI> selectTree(MenuUISearch menuUISearch);
|
||||
|
||||
public void insert(MenuUI menuUI);
|
||||
|
||||
public void update(MenuUI menuUI);
|
||||
|
||||
public void delete(String menuId);
|
||||
|
||||
/**
|
||||
* 현재위치 가져오기
|
||||
*/
|
||||
public String getPosition(HttpServletRequest request) throws Exception;
|
||||
|
||||
public String getMenuName(HttpServletRequest request) throws Exception;
|
||||
|
||||
/*
|
||||
* 현재 메뉴 에 대한 권한 정보 얻어오기 ( W:readWrite, R:readOnly )
|
||||
*/
|
||||
public String getMenuAuth(HttpServletRequest request) throws Exception;
|
||||
|
||||
public Page<MenuUI> selectDbList(Pageable pageable, MenuUISearch menuUISearch);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUISearch;
|
||||
import com.eactive.eai.rms.common.acl.user.RecordAuthUtil;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.Menu;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.MenuService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
import org.apache.commons.lang.StringEscapeUtils;
|
||||
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 javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Service("menuManService")
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MenuManServiceImpl extends BaseService implements MenuManService {
|
||||
|
||||
@Autowired
|
||||
private MenuUIMapper menuUIMapper;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
public List<MenuUI> selectTree(MenuUISearch menuUISearch) {
|
||||
List<Menu> menu = findRootMenuTree();
|
||||
List<MenuUI> menuUI = new ArrayList<>();
|
||||
for(Menu menus : menu) {
|
||||
buildMenuTree(menus, menuUI, -1, menuUISearch);
|
||||
}
|
||||
return menuUI;
|
||||
}
|
||||
|
||||
private List<Menu> findRootMenuTree() {
|
||||
Menu menu = menuService.getById("ROOT_DEV");
|
||||
return new ArrayList<>(menu.getChildMenus());
|
||||
}
|
||||
|
||||
private void buildMenuTree(Menu menu, List<MenuUI> list, int level, MenuUISearch menuUISearch) {
|
||||
final Integer currentLevel = level + 1;
|
||||
boolean isSearchActive = StringUtils.isNotBlank(menuUISearch.getSearchName())
|
||||
|| StringUtils.isNotBlank(menuUISearch.getSearchUrl())
|
||||
|| StringUtils.isNotBlank(menuUISearch.getSearchId())
|
||||
|| StringUtils.isNotBlank(menuUISearch.getSearchParent());
|
||||
|
||||
MenuUI menuUI = new MenuUI(menu, currentLevel, isSearchActive);
|
||||
|
||||
if (isContains(menu, menuUISearch)) {
|
||||
list.add(menuUI);
|
||||
}
|
||||
menu.getChildMenus().forEach(m -> buildMenuTree(m, list, currentLevel, menuUISearch));
|
||||
|
||||
}
|
||||
|
||||
private boolean isContains(Menu menu, MenuUISearch menuUISearch) {
|
||||
if (StringUtils.isBlank(menuUISearch.getSearchName())
|
||||
&& StringUtils.isBlank(menuUISearch.getSearchUrl())
|
||||
&& StringUtils.isBlank(menuUISearch.getSearchId())
|
||||
&& StringUtils.isBlank(menuUISearch.getSearchParent())) {
|
||||
return true;
|
||||
}
|
||||
|
||||
boolean matchName = matches(menu.getMenuName(), menuUISearch.getSearchName());
|
||||
boolean matchUrl = matches(menu.getMenuUrl(), menuUISearch.getSearchUrl());
|
||||
boolean matchId = matches(menu.getMenuId(), menuUISearch.getSearchId());
|
||||
boolean matchParent = matches(menu.getParentMenuId(), menuUISearch.getSearchParent());
|
||||
|
||||
return matchName && matchUrl && matchId && matchParent
|
||||
|| menu.getChildMenus().stream()
|
||||
.anyMatch(m -> isContains(m, menuUISearch));
|
||||
}
|
||||
|
||||
private boolean matches(String value, String searchValue) {
|
||||
return StringUtils.isBlank(searchValue) || StringUtils.containsIgnoreCase(value, searchValue);
|
||||
}
|
||||
|
||||
public void insert(MenuUI menuUI) {
|
||||
if (menuService.existsById(menuUI.getMenuId())) {
|
||||
throw new BizException("중복된 메뉴 ID가 존재합니다.");
|
||||
}
|
||||
menuUI.setMenuName(StringEscapeUtils.unescapeHtml(menuUI.getMenuName()));
|
||||
Menu menu = menuUIMapper.toEntity(menuUI);
|
||||
menu.setParentMenu(menuService.findById(menuUI.getParentMenuId()).orElse(null));
|
||||
menu.getParentMenu().getChildMenus().add(menu);
|
||||
menuService.save(menu);
|
||||
}
|
||||
|
||||
public void update(MenuUI menuUI) {
|
||||
Menu menu = menuService.getById(menuUI.getMenuId());
|
||||
menuUIMapper.updateToEntity(menuUI, menu);
|
||||
menu.setMenuName(StringEscapeUtils.unescapeHtml(menuUI.getMenuName()));
|
||||
menuService.save(menu);
|
||||
}
|
||||
|
||||
public void delete(String menuId) {
|
||||
Menu menu = menuService.getById(menuId);
|
||||
menu.getParentMenu().getChildMenus().remove(menu);
|
||||
menuService.deleteById(menuId);
|
||||
}
|
||||
|
||||
public String getPosition(HttpServletRequest request) throws Exception {
|
||||
return RecordAuthUtil.getPosition(request.getParameter("menuId"));
|
||||
}
|
||||
|
||||
public String getMenuName(HttpServletRequest request) throws Exception {
|
||||
MenuService menuService = ApplicationContextProvider.getContext().getBean(MenuService.class);
|
||||
return menuService.getMenuName(request.getParameter("menuId"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 메뉴 에 대한 권한 정보 얻어오기 ( W:readWrite, R:readOnly )
|
||||
*/
|
||||
public String getMenuAuth(HttpServletRequest request) throws Exception {
|
||||
String menuId = request.getParameter("menuId");
|
||||
String serviceType = request.getParameter("serviceType");
|
||||
String userId = SessionManager.getUserId(request);
|
||||
return RecordAuthUtil.getMenuAuth(request, userId, menuId, serviceType);
|
||||
}
|
||||
|
||||
public Page<MenuUI> selectDbList(Pageable pageable, MenuUISearch menuUISearch) {
|
||||
Page<Menu> page = menuService.findAll(pageable, menuUISearch);
|
||||
return page.map(menuUIMapper::toVo);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,126 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.LeftMenuUI;
|
||||
import com.eactive.eai.rms.common.acl.role.RoleManService;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.MenuService;
|
||||
|
||||
@Controller
|
||||
public class MenuRenderController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private RoleManService roleManService;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
private MenuRenderService menuRenderService;
|
||||
|
||||
@GetMapping("/left_top.do")
|
||||
public String left_top(HttpServletRequest request, ModelMap modelMap) {
|
||||
return "/common/screen/left_top";
|
||||
}
|
||||
|
||||
@GetMapping("/leftMenu.do")
|
||||
public String leftMenu(HttpServletRequest request, ModelMap modelMap, String menuId) throws Exception {
|
||||
|
||||
String lv3MenuId = menuId.replaceAll("...$", "000");
|
||||
List<String> roleIds = SessionManager.getRoleId(request);
|
||||
List<String> appCodes = DataSourceContextHolder.getRender(request);
|
||||
String serviceType = request.getParameter("serviceType");
|
||||
|
||||
if (StringUtils.isNotBlank(lv3MenuId)) {
|
||||
// 메뉴명 가져오기
|
||||
LeftMenuUI leftMenuUI = menuRenderService.leftMenuList(lv3MenuId, roleIds, appCodes, serviceType);
|
||||
|
||||
modelMap.addAttribute("menuId", menuId);
|
||||
modelMap.addAttribute("menuName", leftMenuUI.getMenuName());
|
||||
modelMap.addAttribute("leftMenuList", leftMenuUI.getMenuList());
|
||||
}
|
||||
return "/common/screen/leftMenu";
|
||||
}
|
||||
|
||||
@GetMapping("/top_title.do")
|
||||
public String top_title(HttpServletRequest request, ModelMap modelMap) {
|
||||
return "/common/screen/top_title";
|
||||
}
|
||||
|
||||
@GetMapping("/top_logo.do")
|
||||
public String top_logo(HttpServletRequest request, ModelMap modelMap) {
|
||||
return "/common/screen/top_logo";
|
||||
}
|
||||
|
||||
/**
|
||||
* 권한에 따른 읽기 가능한 메뉴 가져오기.
|
||||
*
|
||||
* @return 메뉴리스트
|
||||
*/
|
||||
@GetMapping("/top_04.do")
|
||||
public String getMenuList(HttpServletRequest request, String serviceType, ModelMap modelMap) throws Exception {
|
||||
|
||||
List<String> roleIds = SessionManager.getRoleId(request);
|
||||
List<String> appCodes = DataSourceContextHolder.getRender(request);
|
||||
|
||||
List<Map<String, Object>> dataList = menuService.getMenuList(roleIds, appCodes, serviceType);
|
||||
modelMap.addAttribute("topMenuList", dataList);
|
||||
|
||||
// 파라미터로 초기페이지 를 지정한 경우
|
||||
String mainPage = request.getParameter("mainPage");
|
||||
String menuId = request.getParameter("menuId");
|
||||
String id = null;
|
||||
|
||||
List<DataSourceType> roleServiceTypeList = roleManService.selectRoleServiceTypeList(roleIds);
|
||||
modelMap.addAttribute("roleServiceTypeList", roleServiceTypeList);
|
||||
|
||||
if (StringUtils.isNotBlank(mainPage)) {
|
||||
for (Map<String, Object> map : dataList) {
|
||||
String url = (String) map.get("LEV4_URL");
|
||||
id = (String) map.get("LEV4_ID");
|
||||
if (url != null && url.contains(mainPage)) {
|
||||
// 상세대시보드화면에서 선택하여 지정한 초기화면
|
||||
modelMap.addAttribute("roleScreenId", id);
|
||||
modelMap.addAttribute("mainPage", mainPage);
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else if (StringUtils.isNotBlank(menuId)) {
|
||||
if (menuService.isMenuExistInService(appCodes, menuId)) {
|
||||
for (Map<String, Object> map : dataList) {
|
||||
id = (String) map.get("LEV4_ID");
|
||||
if (id != null && id.contains(menuId)) {
|
||||
// 상세대시보드화면에서 선택하여 지정한 초기화면
|
||||
modelMap.addAttribute("roleScreenId", id);
|
||||
modelMap.addAttribute("menuId", menuId);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (id == null) {
|
||||
modelMap.addAttribute("roleScreenId", roleManService.getRoleScreenId(roleIds));
|
||||
}
|
||||
}
|
||||
|
||||
if (id == null && StringUtils.isBlank(mainPage) && StringUtils.isBlank(menuId)) {
|
||||
// 역할권한 관리 화면 에서 지정한 초기화면
|
||||
modelMap.addAttribute("roleScreenId", roleManService.getRoleScreenId(roleIds));
|
||||
}
|
||||
|
||||
return "/common/screen/top_04";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.LeftMenuUI;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.MenuService;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class MenuRenderService {
|
||||
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired
|
||||
public MenuRenderService(MenuService menuService) {
|
||||
this.menuService = menuService;
|
||||
}
|
||||
|
||||
public LeftMenuUI leftMenuList(String lv3MenuId, List<String> roleIds, List<String> appCodes, String serviceType) {
|
||||
LeftMenuUI leftMenuUI = new LeftMenuUI();
|
||||
|
||||
String menuName = menuService.getMenuName(lv3MenuId);
|
||||
leftMenuUI.setMenuName(menuName);
|
||||
|
||||
// 해당 메뉴 리스트 가져오기
|
||||
List<MenuUI> list = menuService.getLeftMenuList(lv3MenuId, roleIds, appCodes, serviceType).stream().map(menu -> {
|
||||
MenuUI menuUI = new MenuUI();
|
||||
menuUI.setMenuUrl(menu.getMenuUrl());
|
||||
menuUI.setMenuId(menu.getMenuId());
|
||||
menuUI.setMenuName(menu.getMenuName());
|
||||
return menuUI;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
leftMenuUI.setMenuList(list);
|
||||
return leftMenuUI;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.menu.ui.MenuUI;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.Menu;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MenuUIMapper extends GenericMapper<MenuUI, Menu> {
|
||||
|
||||
@Override
|
||||
MenuUI toVo(Menu entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
Menu toEntity(MenuUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(MenuUI menuUI, @MappingTarget Menu menu);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.common.acl.menu;
|
||||
|
||||
import java.lang.annotation.Documented;
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Inherited;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
@Target({ ElementType.METHOD })
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Inherited
|
||||
@Documented
|
||||
public @interface RequiresWritePermission {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.eactive.eai.rms.common.acl.menu.ui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
||||
public class LeftMenuUI {
|
||||
|
||||
private String lv3MenuId;
|
||||
private String menuName;
|
||||
private List<MenuUI> menuList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.eactive.eai.rms.common.acl.menu.ui;
|
||||
|
||||
import com.eactive.eai.rms.data.entity.man.menu.Menu;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MenuUI {
|
||||
|
||||
private String id;
|
||||
|
||||
@JsonProperty("MENUID")
|
||||
private String menuId;
|
||||
|
||||
@JsonProperty("PARENTMENUID")
|
||||
private String parentMenuId;
|
||||
|
||||
@JsonProperty("SORTORDER")
|
||||
private Integer sortOrder;
|
||||
|
||||
@JsonProperty("MENUNAME")
|
||||
private String menuName;
|
||||
|
||||
@JsonProperty("MENUURL")
|
||||
private String menuUrl;
|
||||
|
||||
@JsonProperty("MENUIMAGE")
|
||||
private String menuImage;
|
||||
|
||||
@JsonProperty("DISPLAYYN")
|
||||
private String displayYn;
|
||||
|
||||
@JsonProperty("USEYN")
|
||||
private String useYn;
|
||||
|
||||
@JsonProperty("APPPATH")
|
||||
private String appPath;
|
||||
|
||||
@JsonProperty("APPCODE")
|
||||
private String appCode;
|
||||
|
||||
// @JsonProperty("DISPLAYYNNM")
|
||||
// private String displayYNNM;
|
||||
//
|
||||
// @JsonProperty("USEYNNM")
|
||||
// private String useYNNM;
|
||||
|
||||
private String parent;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private String expanded;
|
||||
|
||||
private String isLeaf;
|
||||
|
||||
public MenuUI(Menu menu, Integer level, boolean forceLeaf) {
|
||||
this.id = menu.getId();
|
||||
this.menuId = menu.getId();
|
||||
this.parentMenuId = menu.getParentMenuId();
|
||||
this.parent = menu.getParentMenuId();
|
||||
this.sortOrder = menu.getSortOrder();
|
||||
this.menuName = menu.getMenuName();
|
||||
this.level = level;
|
||||
this.appCode = menu.getAppCode();
|
||||
this.appPath = menu.getAppPath();
|
||||
this.displayYn = menu.getDisplayYn();
|
||||
this.menuImage = menu.getMenuImage();
|
||||
this.menuUrl = menu.getMenuUrl();
|
||||
this.useYn = menu.getUseYn();
|
||||
this.menuName = menu.getMenuName();
|
||||
this.expanded = "true";
|
||||
|
||||
if (menu.getChildMenus().isEmpty()) {
|
||||
this.isLeaf = "true";
|
||||
} else {
|
||||
this.isLeaf = "false";
|
||||
}
|
||||
if (forceLeaf) {
|
||||
this.isLeaf = "true";
|
||||
this.expanded = "true";
|
||||
}
|
||||
}
|
||||
|
||||
public MenuUI() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.eactive.eai.rms.common.acl.menu.ui;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MenuUISearch {
|
||||
|
||||
private String searchId;
|
||||
|
||||
private String searchName;
|
||||
|
||||
private String searchParent;
|
||||
|
||||
private String searchUrl;
|
||||
|
||||
private String searchTblName;
|
||||
}
|
||||
+31
@@ -0,0 +1,31 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeGroup;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUI;
|
||||
|
||||
@Mapper(componentModel = "spring", uses = { MonitoringCodeMapper.class }, unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MonitoringCodeGroupMapper extends GenericMapper<MonitoringCodeGroupUI, MonitoringCodeGroup> {
|
||||
|
||||
@Mapping(source = "codeGroup", target = "cdGroup")
|
||||
@Mapping(source = "description", target = "cdGroupDesc")
|
||||
@Mapping(expression = "java(entity.getMonitoringCodes().size())", target = "childCnt")
|
||||
MonitoringCodeGroupUI toVo(MonitoringCodeGroup entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
MonitoringCodeGroup toEntity(MonitoringCodeGroupUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(MonitoringCodeGroupUI monitoringCodeGroupUI, @MappingTarget MonitoringCodeGroup monitoringCodeGroup);
|
||||
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
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.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUI;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUISearch;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeSearchPOPUI;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeUI;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
|
||||
@Controller
|
||||
public class MonitoringCodeManController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private MonitoringCodeManService monitoringCodeManService;
|
||||
|
||||
@GetMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.view", params = "cmd=GROUP POPUP")
|
||||
public String viewGroupPopup() {
|
||||
return "/common/acl/monitoringCode/monitoringCodeManGroupPopup";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.view", params = "cmd=POPUP")
|
||||
public String viewPopup() {
|
||||
return "/common/acl/monitoringCode/monitoringCodeManPopup";
|
||||
}
|
||||
|
||||
// adapterManDetail 대외기관 설정 검색 POPUP
|
||||
@GetMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.view", params = "cmd=SEARCH POPUP")
|
||||
public String viewSelectPopList() {
|
||||
return "/common/acl/monitoringCode/monitoringCodeManSearchPopup";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<MonitoringCodeGroupUI>> selectList(
|
||||
MonitoringCodeGroupUISearch monitoringCodeGroupUISearch) {
|
||||
List<MonitoringCodeGroupUI> list = monitoringCodeManService.selectCodeGroupList(monitoringCodeGroupUISearch);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=LIST_TREE")
|
||||
public ResponseEntity<GridResponse<MonitoringCodeUI>> selectCodeTreeList(
|
||||
@RequestParam(name = "nodeid", required = false) String codeGroup,
|
||||
MonitoringCodeGroupUISearch codeGroupUISearch) {
|
||||
|
||||
if (!StringUtils.isBlank(codeGroup)) {
|
||||
return ResponseEntity.ok(new GridResponse<>(new ArrayList<>()));
|
||||
}
|
||||
List<MonitoringCodeUI> list = monitoringCodeManService.selectCodeTreeList(codeGroupUISearch);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=INSERT_GROUP")
|
||||
public ResponseEntity<String> insertGroup(MonitoringCodeGroupUI monitoringCodeGroupUI) {
|
||||
monitoringCodeManService.insertGroup(monitoringCodeGroupUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(MonitoringCodeUI monitoringCodeUI) {
|
||||
monitoringCodeManService.insert(monitoringCodeUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=UPDATE_GROUP")
|
||||
public ResponseEntity<String> updateGroup(MonitoringCodeGroupUI monitoringCodeGroupUI) {
|
||||
monitoringCodeManService.updateGroup(monitoringCodeGroupUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(MonitoringCodeUI monitoringCodeUI) {
|
||||
monitoringCodeManService.update(monitoringCodeUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=DELETE_GROUP")
|
||||
public ResponseEntity<String> deleteGroup(String cdGroup) {
|
||||
monitoringCodeManService.deleteGroup(cdGroup);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<String> delete(MonitoringCodeUI monitoringCodeUI) {
|
||||
monitoringCodeManService.delete(monitoringCodeUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/monitoringCode/monitoringCodeMan.json", params = "cmd=LIST_POP")
|
||||
public ResponseEntity<GridResponse<MonitoringCodeSearchPOPUI>> selectPopList(
|
||||
@SortDefault("id.code") Pageable pageable, MonitoringCodeSearchPOPUI monitoringCodePOPUI) {
|
||||
Page<MonitoringCodeSearchPOPUI> page = monitoringCodeManService.selectPopList(pageable, monitoringCodePOPUI);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
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.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeGroup;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUI;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeGroupUISearch;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeSearchPOPUI;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeUI;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.spring.LocaleMessage;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringCode.service.MonitoringCodeGroupService;
|
||||
import com.eactive.eai.rms.data.entity.man.monitoringCode.service.MonitoringCodeService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@RequiredArgsConstructor
|
||||
public class MonitoringCodeManService extends BaseService {
|
||||
|
||||
private final MonitoringCodeService monitoringCodeService;
|
||||
private final MonitoringCodeGroupService monitoringCodeGroupService;
|
||||
private final MonitoringCodeMapper monitoringCodeMapper;
|
||||
private final MonitoringCodeGroupMapper monitoringCodeGroupMapper;
|
||||
private final LocaleMessage localeMessage;
|
||||
|
||||
public List<MonitoringCodeGroupUI> selectCodeGroupList(MonitoringCodeGroupUISearch monitoringCodeGroupUISearch) {
|
||||
return monitoringCodeGroupService.selectCodeGroupList(monitoringCodeGroupUISearch).stream()
|
||||
.map(monitoringCodeGroupMapper::toVo).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<MonitoringCodeUI> selectCodeTreeList(MonitoringCodeGroupUISearch search) {
|
||||
List<MonitoringCodeGroup> groupList = monitoringCodeGroupService.selectCodeGroupList(search.getSearchCodeGroup());
|
||||
List<MonitoringCodeUI> codeTreeList = new ArrayList<>();
|
||||
|
||||
for (MonitoringCodeGroup group : groupList) {
|
||||
if (group.getCodeGroup().equals(search.getSearchCodeGroup())) {
|
||||
codeTreeList.add(createRootCodeUI(group));
|
||||
}
|
||||
List<MonitoringCode> codeList = monitoringCodeService.findByIdCodegroup(group.getCodeGroup(), "id.code");
|
||||
codeTreeList.addAll(codeList.stream()
|
||||
.filter(code -> isCodeMatched(code, search))
|
||||
.map(code -> createCodeUI(code, 1)).collect(Collectors.toList()));
|
||||
}
|
||||
return codeTreeList;
|
||||
}
|
||||
|
||||
/* rootCode */
|
||||
public MonitoringCodeUI createRootCodeUI(MonitoringCodeGroup group) {
|
||||
MonitoringCodeUI rootCodeUI = new MonitoringCodeUI();
|
||||
rootCodeUI.setCode(group.getCodeGroup());
|
||||
rootCodeUI.setLevel(0);
|
||||
rootCodeUI.setUseYn("N");
|
||||
rootCodeUI.setUseYnName("");
|
||||
rootCodeUI.setCodeGroup(group.getCodeGroup());
|
||||
rootCodeUI.setId(group.getCodeGroup());
|
||||
rootCodeUI.setCodeName("");
|
||||
rootCodeUI.setSeq(0);
|
||||
return rootCodeUI;
|
||||
}
|
||||
|
||||
/* findByIdCodegroup level=1 */
|
||||
private MonitoringCodeUI createCodeUI(MonitoringCode code, int level) {
|
||||
MonitoringCodeUI codeUI = new MonitoringCodeUI(code, level);
|
||||
|
||||
if ("Y".equals(code.getUseYn())) {
|
||||
codeUI.setUseYnName(localeMessage.getString("combo.usey"));
|
||||
} else if ("N".equals(code.getUseYn())) {
|
||||
codeUI.setUseYnName(localeMessage.getString("combo.usen"));
|
||||
}
|
||||
return codeUI;
|
||||
}
|
||||
|
||||
private boolean isCodeMatched(MonitoringCode code, MonitoringCodeGroupUISearch search) {
|
||||
return (StringUtils.isBlank(search.getSearchCode())
|
||||
|| StringUtils.containsIgnoreCase(code.getId().getCode(), search.getSearchCode()))
|
||||
&& (StringUtils.isBlank(search.getSearchCodeName())
|
||||
|| StringUtils.containsIgnoreCase(code.getCodeName(), search.getSearchCodeName()));
|
||||
}
|
||||
|
||||
/* Start CODEGROUP 입력,수정,삭제 */
|
||||
public void insertGroup(MonitoringCodeGroupUI monitoringCodeGroupUI) {
|
||||
if (monitoringCodeGroupService.existsById(monitoringCodeGroupUI.getCdGroup())) {
|
||||
throw new BizException(localeMessage.getString("monitoringCode.codeGroupExists"));
|
||||
}
|
||||
MonitoringCodeGroup monitoringCodeGroup = monitoringCodeGroupMapper.toEntity(monitoringCodeGroupUI);
|
||||
monitoringCodeGroupService.save(monitoringCodeGroup);
|
||||
}
|
||||
|
||||
public void updateGroup(MonitoringCodeGroupUI monitoringCodeGroupUI) {
|
||||
MonitoringCodeGroup monitoringCodeGroup = monitoringCodeGroupService.getById(monitoringCodeGroupUI.getCdGroup());
|
||||
monitoringCodeGroupMapper.updateToEntity(monitoringCodeGroupUI, monitoringCodeGroup);
|
||||
monitoringCodeGroupService.save(monitoringCodeGroup);
|
||||
}
|
||||
|
||||
public void deleteGroup(String cdGroup) {
|
||||
monitoringCodeGroupService.deleteById(cdGroup);
|
||||
}
|
||||
|
||||
/* Start CODE 입력,수정,삭제 */
|
||||
public void insert(MonitoringCodeUI monitoringCodeUI) {
|
||||
if (monitoringCodeService.existsById(monitoringCodeMapper.toId(monitoringCodeUI))) {
|
||||
throw new BizException(localeMessage.getString("monitoringCode.codeExists"));
|
||||
}
|
||||
MonitoringCode monitoringCode = monitoringCodeMapper.toEntity(monitoringCodeUI);
|
||||
monitoringCodeService.save(monitoringCode);
|
||||
}
|
||||
|
||||
public void update(MonitoringCodeUI monitoringCodeUI) {
|
||||
MonitoringCode monitoringCode = monitoringCodeService.getById(monitoringCodeMapper.toId(monitoringCodeUI));
|
||||
monitoringCodeMapper.updateToEntity(monitoringCodeUI, monitoringCode);
|
||||
monitoringCodeService.save(monitoringCode);
|
||||
}
|
||||
|
||||
public void delete(MonitoringCodeUI monitoringCodeUI) {
|
||||
MonitoringCode monitoringCode = monitoringCodeService.getById(monitoringCodeMapper.toId(monitoringCodeUI));
|
||||
MonitoringCodeGroup monitoringCodeGroup = monitoringCode.getMonitoringCodeGroup();
|
||||
|
||||
if (monitoringCodeGroup != null) {
|
||||
monitoringCodeGroup.getMonitoringCodes().remove(monitoringCode);
|
||||
monitoringCodeService.deleteById(monitoringCode.getId());
|
||||
}
|
||||
}
|
||||
|
||||
public Page<MonitoringCodeSearchPOPUI> selectPopList(Pageable pageable,
|
||||
MonitoringCodeSearchPOPUI monitoringCodePOPUI) {
|
||||
Page<MonitoringCode> page = monitoringCodeService.findAll(pageable, monitoringCodePOPUI.getCodeGroup(),
|
||||
monitoringCodePOPUI.getSearchCodeName());
|
||||
return page.map(code -> {
|
||||
MonitoringCodeSearchPOPUI ui = new MonitoringCodeSearchPOPUI();
|
||||
ui.setCode(code.getId().getCode());
|
||||
ui.setCodeName(code.getCodeName());
|
||||
return ui;
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCodeId;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.monitoringCode.UI.MonitoringCodeUI;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface MonitoringCodeMapper extends GenericMapper<MonitoringCodeUI, MonitoringCode> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "id.codeGroup", target = "codeGroup")
|
||||
@Mapping(source = "id.codeGroup", target = "id")
|
||||
@Mapping(source = "id.code", target = "code")
|
||||
MonitoringCodeUI toVo(MonitoringCode entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
@Mapping(source = "codeGroup", target = "id.codeGroup")
|
||||
@Mapping(source = "code", target = "id.code")
|
||||
MonitoringCode toEntity(MonitoringCodeUI vo);
|
||||
|
||||
MonitoringCodeId toId(MonitoringCodeUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(MonitoringCodeUI monitoringCodeUI, @MappingTarget MonitoringCode monitoringCode);
|
||||
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode.UI;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MonitoringCodeGroupUI {
|
||||
|
||||
@JsonProperty("CDGROUP")
|
||||
private String cdGroup;
|
||||
|
||||
@JsonProperty("CDGROUPDESC")
|
||||
private String cdGroupDesc;
|
||||
|
||||
@JsonProperty("CHILDCNT")
|
||||
private Integer childCnt;
|
||||
|
||||
}
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode.UI;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
|
||||
public class MonitoringCodeGroupUISearch {
|
||||
|
||||
private String searchCodeGroup;
|
||||
|
||||
private String searchGroupDesc;
|
||||
|
||||
private String searchCode;
|
||||
|
||||
private String searchCodeName;
|
||||
|
||||
}
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode.UI;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MonitoringCodeSearchPOPUI {
|
||||
|
||||
@JsonProperty("CODE")
|
||||
private String code;
|
||||
|
||||
@JsonProperty("CODEGROUP")
|
||||
private String codeGroup;
|
||||
|
||||
@JsonProperty("CODENAME")
|
||||
private String codeName;
|
||||
|
||||
private String searchCodeName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
package com.eactive.eai.rms.common.acl.monitoringCode.UI;
|
||||
|
||||
import com.eactive.apim.portal.monitoringcode.entity.MonitoringCode;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class MonitoringCodeUI {
|
||||
|
||||
private String id;
|
||||
|
||||
@JsonProperty("CODEGROUP")
|
||||
private String codeGroup;
|
||||
|
||||
@JsonProperty("CODE")
|
||||
private String code;
|
||||
|
||||
@JsonProperty("CODENAME")
|
||||
private String codeName;
|
||||
|
||||
@JsonProperty("SEQ")
|
||||
private Integer seq;
|
||||
|
||||
@JsonProperty("PARENTCODE")
|
||||
private String parentCode;
|
||||
|
||||
@JsonProperty("USEYN")
|
||||
private String useYn;
|
||||
|
||||
@JsonProperty("USEYNNAME")
|
||||
private String useYnName;
|
||||
|
||||
private String parent;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private String expanded = "true";
|
||||
|
||||
private String isLeaf = "false";
|
||||
|
||||
public MonitoringCodeUI(MonitoringCode monitoringCode, Integer level) {
|
||||
this.level = level;
|
||||
this.id = monitoringCode.getId().getCode();
|
||||
this.parent = monitoringCode.getParentCode();
|
||||
this.code = monitoringCode.getId().getCode();
|
||||
this.codeGroup = monitoringCode.getId().getCodeGroup();
|
||||
this.parentCode = monitoringCode.getParentCode();
|
||||
this.codeName = monitoringCode.getCodeName();
|
||||
this.seq = monitoringCode.getSeq();
|
||||
this.useYn = monitoringCode.getUseYn();
|
||||
|
||||
if (level > 0) {
|
||||
this.isLeaf = "true";
|
||||
}
|
||||
}
|
||||
|
||||
public MonitoringCodeUI(String code, String codeName) {
|
||||
this.code = code;
|
||||
this.codeName = codeName;
|
||||
}
|
||||
|
||||
public MonitoringCodeUI() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,106 @@
|
||||
//package com.eactive.eai.rms.common.acl.openacl;
|
||||
//
|
||||
//
|
||||
//
|
||||
//import java.util.HashMap;
|
||||
//
|
||||
//import javax.servlet.http.HttpServletRequest;
|
||||
//
|
||||
//import org.apache.log4j.Logger;
|
||||
//import org.springframework.beans.factory.annotation.Autowired;
|
||||
//import org.springframework.beans.factory.annotation.Qualifier;
|
||||
//import org.springframework.stereotype.Controller;
|
||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
||||
//import org.springframework.web.servlet.ModelAndView;
|
||||
//
|
||||
//import com.eactive.eai.rms.common.acl.user.BizService;
|
||||
//import com.eactive.eai.rms.common.acl.user.UserService;
|
||||
//import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
//import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
//import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
//import com.eactive.eai.rms.common.interceptor.InterceptorSkipController;
|
||||
//
|
||||
//@Controller
|
||||
//public class OpenAclForProdController implements InterceptorSkipController {
|
||||
//
|
||||
// private static final Logger logger = Logger.getLogger(OpenAclForProdController.class);
|
||||
// private static final String resultView ="common/loadResult";
|
||||
//
|
||||
// @Autowired
|
||||
// @Qualifier("bizService")
|
||||
// private BizService bizService;
|
||||
//
|
||||
// @Autowired
|
||||
// @Qualifier("userService")
|
||||
// private UserService userService;
|
||||
//
|
||||
//
|
||||
// @RequestMapping("/deleteUserAuthforProd.do")
|
||||
// private ModelAndView delete(HttpServletRequest request ) throws Exception {
|
||||
//
|
||||
// HashMap<String,String> result = new HashMap<String,String>();
|
||||
//
|
||||
// HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
// for (String key : request.getParameterMap().keySet()){
|
||||
// String [] datas= request.getParameterValues(key);
|
||||
// StringBuffer resultS = new StringBuffer();
|
||||
// for(String data : datas){
|
||||
// resultS.append(data);
|
||||
// }
|
||||
// paramMap.put(key, resultS.toString());
|
||||
// }
|
||||
//
|
||||
// for(DataSourceType d : DataSourceTypeManager.getDynamicDataSourceTypes() ) {
|
||||
// DataSourceContextHolder.setDataSourceType(d);
|
||||
// paramMap.put("schemaId", d.getSchema());
|
||||
// if(logger.isInfoEnabled()) logger.info("deleteUserAuthforProd param : " +paramMap.toString());
|
||||
//
|
||||
// bizService.deleteUserBizCode(paramMap);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// result.put("status", "success");
|
||||
// return new ModelAndView(resultView, "result", result.toString());
|
||||
// }
|
||||
//
|
||||
// @RequestMapping("/insertUserAuthforProd.do")
|
||||
// private ModelAndView insert(HttpServletRequest request) throws Exception {
|
||||
//
|
||||
// HashMap<String,String> result = new HashMap<String,String>();
|
||||
//
|
||||
// HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
// for (String key : request.getParameterMap().keySet()){
|
||||
// String [] datas= request.getParameterValues(key);
|
||||
// StringBuffer resultS = new StringBuffer();
|
||||
// for(String data : datas){
|
||||
// resultS.append(data);
|
||||
// }
|
||||
// paramMap.put(key, resultS.toString());
|
||||
// }
|
||||
//
|
||||
// for(DataSourceType d : DataSourceTypeManager.getDynamicDataSourceTypes() ) {
|
||||
// DataSourceContextHolder.setDataSourceType(d);
|
||||
// paramMap.put("schemaId", d.getSchema());
|
||||
// if(logger.isInfoEnabled()) logger.info("insertAppBizforProd param : " +paramMap.toString());
|
||||
//
|
||||
// try{
|
||||
// bizService.insertUserBiz(paramMap);
|
||||
// //선택한 업무코드 + 그 업무코드로 조회되는 EAI업무구분코드 에 대해서 권한 부여 추가 2020.02.05
|
||||
// bizService.insertMergeRM06(paramMap);
|
||||
// }catch(Exception e){
|
||||
// logger.warn("중복 데이터가 존재합니다 ");
|
||||
// }
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //권한 변경 (모니터링용)
|
||||
// HashMap<String, Object> uMap = new HashMap<String, Object>();
|
||||
// uMap.put("userId", paramMap.get("userId"));
|
||||
// userService.updateChangeRole(uMap);
|
||||
//
|
||||
// result.put("status", "success");
|
||||
// return new ModelAndView(resultView, "result", result.toString());
|
||||
// }
|
||||
//
|
||||
//
|
||||
//}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@AllArgsConstructor
|
||||
public class AuthByService {
|
||||
|
||||
private String serviceType;
|
||||
private String auth;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.combo.ComboService;
|
||||
import com.eactive.eai.rms.common.combo.ComboVo;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class RoleController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private RoleManService roleManService;
|
||||
|
||||
@Autowired
|
||||
private ComboService comboService;
|
||||
|
||||
private final ObjectMapper menuReadMapper = new ObjectMapper();
|
||||
|
||||
@GetMapping(value = "/common/acl/role/roleMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/role/roleMan.view", params = "cmd=DETAIL")
|
||||
public String detailView() {
|
||||
return "/common/acl/role/roleManDetail";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/role/roleMan.view", params = "cmd=POPUP")
|
||||
public String popuplView() { // 역할변경
|
||||
return "/common/acl/role/roleManPopup";
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/role/roleMan.view", params = "cmd=POPUP2")
|
||||
public String popuplSearchView() { // 초기화면 지정 검색
|
||||
return "/common/acl/role/roleManPopup2";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<RoleUI>> excute(@SortDefault("roleId") Pageable pageable, RoleUI roleUI) {
|
||||
Page<RoleUI> page = roleManService.selectList(pageable, roleUI);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<RoleUI> selectDetail(String roleId) {
|
||||
RoleUI roleUI = roleManService.selectDetail(roleId);
|
||||
return ResponseEntity.ok(roleUI);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> initCombo() {
|
||||
List<ComboVo> listUseYnType = comboService.getFromCode("USE_YN_TYPE");
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("useYnTypeRows", listUseYnType);
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(RoleUI roleUI) {
|
||||
roleManService.insert(roleUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(RoleUI roleUI) {
|
||||
roleManService.update(roleUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String roleId) {
|
||||
roleManService.delete(roleId);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/role/roleMan.json", params = "cmd=LIST_INIT_POPUP")
|
||||
public ResponseEntity<Map<String, List<String>>> popUpInit() {
|
||||
List<String> columnList = roleManService.getServiceTypesForMenuRendering();
|
||||
Map<String, List<String>> map = new HashMap<>();
|
||||
map.put("columnList", columnList);
|
||||
return ResponseEntity.ok(map);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=LIST_TREE")
|
||||
public ResponseEntity<GridResponse<RoleMenuTreeUI>> selectTree(
|
||||
@RequestParam(name = "roleId", required = false) String roleId) {
|
||||
List<RoleMenuTreeUI> list = roleManService.selectRoleMenuTree(roleId);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/role/roleMan.json", params = "cmd=TRANSACTION_ROLE_MENU")
|
||||
public ResponseEntity<String> update(String roleId, String gridData) throws Exception {
|
||||
List<Map<String, String>> roleMenuList = menuReadMapper.readValue(gridData, new TypeReference<List<Map<String, String>>>() {});
|
||||
roleManService.transactionRoleMenu(roleId, roleMenuList);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
// @RequestMapping(value= "/common/acl/role/roleMan.json",params = "cmd=CLONETOSTG")
|
||||
// private ModelAndView clone(HttpServletRequest request,HttpServletResponse response, @RequestParam HashMap<String,Object> map ) throws Exception {
|
||||
//
|
||||
// String message = "스테이징에 복사 완료하였습니다.";
|
||||
// String roleId = (String) map.get("roleId");
|
||||
//
|
||||
// //스테이징에 프라퍼티그룹이 존재하는지 체크
|
||||
// HashMap paramMap = new HashMap();
|
||||
// paramMap.put("roleId", roleId);
|
||||
// int stgChkCnt = roleService.selectRoleIdChkCount(paramMap);
|
||||
//
|
||||
// if(stgChkCnt > 0){
|
||||
// //스테이징 역할ID 수정
|
||||
// roleService.updateRoleId(map);
|
||||
//
|
||||
// }else{
|
||||
// //스테이징 역할ID 등록
|
||||
// roleService.insertRoleId(map);
|
||||
//
|
||||
// }
|
||||
//
|
||||
// //role menu
|
||||
// List<HashMap<String, Object>> detailMap = roleService.selectRoleMenu(roleId);
|
||||
//
|
||||
// roleService.transactionStgRoleMenu(roleId, detailMap);
|
||||
//
|
||||
// Map resultMap = new HashMap();
|
||||
// resultMap.put("message" , message);
|
||||
// ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
// return modelAndView;
|
||||
//
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.util.StringUtils;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.Menu;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.MenuService;
|
||||
import com.eactive.eai.rms.data.entity.man.role.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
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.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.StreamSupport;
|
||||
|
||||
import static com.eactive.eai.rms.common.context.MonitoringContext.MENU_RENDER_ADDITIONAL_SERVICES;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class RoleManService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private RoleService roleService;
|
||||
|
||||
@Autowired
|
||||
private RoleMenuAuthService roleMenuAuthService;
|
||||
|
||||
@Autowired
|
||||
private RoleUIMapper roleUIMapper;
|
||||
|
||||
@Autowired
|
||||
private MenuService menuService;
|
||||
|
||||
@Autowired @Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
public Page<RoleUI> selectList(Pageable pageable, RoleUI roleUI) {
|
||||
Page<Role> page = roleService.findAll(pageable, roleUI);
|
||||
return page.map(roleUIMapper::toVo);
|
||||
}
|
||||
|
||||
public RoleUI selectDetail(String roleId) {
|
||||
Role role = roleService.getById(roleId);
|
||||
return roleUIMapper.toVo(role);
|
||||
}
|
||||
|
||||
public void insert(RoleUI roleUI) {
|
||||
Role role = roleUIMapper.toEntity(roleUI);
|
||||
roleService.save(role);
|
||||
}
|
||||
|
||||
public void update(RoleUI roleUI) {
|
||||
Role role = roleService.getById(roleUI.getRoleId());
|
||||
roleUIMapper.updateToEntity(roleUI, role);
|
||||
roleService.save(role);
|
||||
}
|
||||
|
||||
public void delete(String roleId) {
|
||||
roleService.deleteById(roleId);
|
||||
}
|
||||
|
||||
/* START selectRoleMenuTree */
|
||||
public List<RoleMenuTreeUI> selectRoleMenuTree(String roleId) {
|
||||
Menu rootMenu = menuService.getById("ROOT_DEV");
|
||||
List<Menu> rootMenus = new ArrayList<>(rootMenu.getChildMenus());
|
||||
|
||||
Map<String, List<AuthByService>> authsByServiceByMenuId =
|
||||
StreamSupport.stream(roleMenuAuthService.findAllByRoleId(roleId).spliterator(), false)
|
||||
.collect(Collectors.groupingBy(
|
||||
roleMenuAuth -> roleMenuAuth.getId().getMenuId(),
|
||||
Collectors.mapping(
|
||||
roleMenuAuth -> new AuthByService(roleMenuAuth.getId().getServiceType(), roleMenuAuth.getAuth()),
|
||||
Collectors.toList()
|
||||
)
|
||||
));
|
||||
|
||||
Set<String> additionalRenderServices = Arrays.stream(monitoringContext.getStringProperty(MENU_RENDER_ADDITIONAL_SERVICES, "").split(","))
|
||||
.map(String::trim)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<RoleMenuTreeUI> menuTreeUI = new ArrayList<>();
|
||||
rootMenus.forEach(menu -> buildMenuTree(menu, menuTreeUI, 0, authsByServiceByMenuId, additionalRenderServices));
|
||||
|
||||
return menuTreeUI;
|
||||
}
|
||||
|
||||
private void buildMenuTree(Menu menu, List<RoleMenuTreeUI> menuTreeUI, int level, Map<String, List<AuthByService>> authsByServiceByMenuId, Set<String> additionalRenderServices) {
|
||||
if (menu == null || !"Y".equals(menu.getUseYn())) {
|
||||
return;
|
||||
}
|
||||
|
||||
List<String> renderTarget;
|
||||
if (additionalRenderServices.contains(menu.getAppCode())) {
|
||||
renderTarget = new ArrayList<String>() {{ add(menu.getAppCode()); }};
|
||||
} else {
|
||||
renderTarget = DataSourceTypeManager.getDynamicDataSourceTypes().stream().filter(dt -> dt.getRender().contains(menu.getAppCode())).map(DataSourceType::getName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<AuthByService> authsByService = Optional.ofNullable(authsByServiceByMenuId.get(menu.getId())).orElse(new ArrayList<>());
|
||||
|
||||
menuTreeUI.add(new RoleMenuTreeUI(menu, level, renderTarget, authsByService));
|
||||
menu.getChildMenus().forEach(childMenu -> buildMenuTree(childMenu, menuTreeUI, level + 1, authsByServiceByMenuId, additionalRenderServices));
|
||||
}
|
||||
/* END selectRoleMenuTree */
|
||||
|
||||
public void transactionRoleMenu(String roleId, List<Map<String, String>> roleMenuList) {
|
||||
Role role = roleService.getById(roleId);
|
||||
role.getRoleMenuAuths().clear();
|
||||
|
||||
for (Map<String, String> roleMenuMap : roleMenuList) {
|
||||
|
||||
String auth = roleMenuMap.get("value");
|
||||
|
||||
if (StringUtils.equals(auth, "N")) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// map.get("name") like "radio_0101001_MCC"
|
||||
String[] name = roleMenuMap.get("name").split("_");
|
||||
|
||||
RoleMenuAuth roleMenuAuth = new RoleMenuAuth();
|
||||
roleMenuAuth.setId(new RoleMenuAuthId(roleId, name[1], name[2]));
|
||||
roleMenuAuth.setAuth(auth);
|
||||
role.getRoleMenuAuths().add(roleMenuAuth);
|
||||
}
|
||||
|
||||
roleService.save(role);
|
||||
}
|
||||
|
||||
// 역할 권한 상세 결과 가져오기(DB)
|
||||
public String getRoleScreenId(List<String> roleIds) {
|
||||
List<String> menuId = roleService.getRoleScreenId(roleIds);
|
||||
return menuId.stream().findFirst().orElse("");
|
||||
}
|
||||
|
||||
public List<String> getServiceTypesForMenuRendering() {
|
||||
|
||||
List<String> serviceTypesForMenuRendering =
|
||||
DataSourceTypeManager.getDynamicDataSourceTypes().stream().map(DataSourceType::getName).collect(Collectors.toList());
|
||||
|
||||
serviceTypesForMenuRendering.addAll(
|
||||
Arrays.asList(monitoringContext.getStringProperty(MENU_RENDER_ADDITIONAL_SERVICES, "").split(",")));
|
||||
|
||||
return serviceTypesForMenuRendering.stream()
|
||||
.map(String::trim)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public List<DataSourceType> selectRoleServiceTypeList(List<String> roleIds) {
|
||||
return DataSourceTypeManager.getDynamicDataSourceTypes().stream()
|
||||
.filter(dt -> roleMenuAuthService.findAllServiceTypeByRoleIds(roleIds).contains(dt.getName()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
import com.eactive.eai.rms.data.entity.man.menu.Menu;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class RoleMenuTreeUI {
|
||||
|
||||
private String id;
|
||||
|
||||
@JsonProperty("MENUID")
|
||||
private String menuId;
|
||||
|
||||
private String parent;
|
||||
|
||||
@JsonProperty("SORTORDER")
|
||||
private Integer sortOrder;
|
||||
|
||||
@JsonProperty("MENUNAME")
|
||||
private String menuName;
|
||||
|
||||
@JsonProperty("USEYN")
|
||||
private String useYn;
|
||||
|
||||
@JsonProperty("DISPLAYYN")
|
||||
private String displayYn;
|
||||
|
||||
private Integer level;
|
||||
|
||||
private String expanded;
|
||||
|
||||
private String isLeaf;
|
||||
|
||||
private String auth;
|
||||
|
||||
@JsonProperty("renderTarget")
|
||||
private List<String> renderTarget;
|
||||
|
||||
@JsonProperty("serviceType")
|
||||
private List<AuthByService> authsByService;
|
||||
|
||||
public RoleMenuTreeUI(Menu menu, Integer level, List<String> renderTarget, List<AuthByService> authsByService) {
|
||||
this.id = menu.getId();
|
||||
this.menuId = menu.getId();
|
||||
this.parent = menu.getParentMenuId();
|
||||
this.sortOrder = menu.getSortOrder();
|
||||
this.level = level;
|
||||
this.displayYn = menu.getDisplayYn();
|
||||
this.useYn = menu.getUseYn();
|
||||
this.menuName = menu.getMenuName();
|
||||
this.expanded = "true";
|
||||
this.isLeaf = menu.getChildMenus().isEmpty() ? "true" : "false";
|
||||
this.renderTarget = renderTarget;
|
||||
this.authsByService = authsByService;
|
||||
}
|
||||
|
||||
public RoleMenuTreeUI() {
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class RoleUI {
|
||||
|
||||
@JsonProperty("ROLEID")
|
||||
private String roleId;
|
||||
|
||||
@JsonProperty("ROLENAME")
|
||||
private String roleName;
|
||||
|
||||
@JsonProperty("ROLEDESC")
|
||||
private String roleDesc;
|
||||
|
||||
@JsonProperty("USEYN")
|
||||
private String useYn;
|
||||
|
||||
@JsonProperty("ROLESCREEN")
|
||||
private String roleScreen;
|
||||
|
||||
private String searchRoleId;
|
||||
|
||||
private String searchUseYn;
|
||||
|
||||
private String searchRoleName;
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.role;
|
||||
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritConfiguration;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.data.entity.man.role.Role;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface RoleUIMapper extends GenericMapper<RoleUI, Role> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "menuId", target = "roleScreen")
|
||||
RoleUI toVo(Role entity);
|
||||
|
||||
@Override
|
||||
@InheritConfiguration
|
||||
Role toEntity(RoleUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(RoleUI roleUI, @MappingTarget Role role);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.eactive.eai.rms.common.acl.scpEnc;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.common.seed.Seed;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.onl.manage.comm.property.PropertyGroupUI;
|
||||
import com.eactive.eai.rms.onl.manage.comm.property.PropertyManService;
|
||||
import com.eactive.eai.rms.onl.manage.comm.property.PropertyUI;
|
||||
|
||||
@Controller
|
||||
public class EmsScpEncController {
|
||||
|
||||
@Autowired
|
||||
private PropertyManService propertyManService;
|
||||
|
||||
@RequestMapping(value = "/common/acl/scpEnc/emsScpEnc.view")
|
||||
private String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd)
|
||||
throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/scpEnc/emsScpEnc.json", params = "cmd=UPDATE_ENCODE")
|
||||
public ModelAndView detail(HttpServletRequest request, String command, String orgText, String module)
|
||||
throws Exception {
|
||||
|
||||
String resultTxt = "";
|
||||
if ("scp".equals(module)) {
|
||||
// 프라퍼티 조회
|
||||
String prptyGroupName = "EXT_MODULE";
|
||||
String path = "";
|
||||
String key = "";
|
||||
|
||||
PropertyGroupUI propertyGroupForm = propertyManService.selectDetail(prptyGroupName);
|
||||
|
||||
if (propertyGroupForm != null) {
|
||||
for (PropertyUI propertyForm : propertyGroupForm.getGridData()) {
|
||||
if ("SCP_PATH".equals(propertyForm.getPrptyName())) {
|
||||
path = propertyForm.getPrpty2Val();
|
||||
} else if ("SCP_KEY".equals(propertyForm.getPrptyName())) {
|
||||
key = propertyForm.getPrpty2Val();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resultTxt = encode(orgText, path, key);
|
||||
} else if ("seed".equals(module) && orgText != null) {
|
||||
resultTxt = Seed.encrypt(orgText);
|
||||
}
|
||||
HashMap<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("resultTxt", resultTxt);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
|
||||
}
|
||||
|
||||
public String encode(String data, String path, String key) {
|
||||
String encData = null;
|
||||
|
||||
return encData;
|
||||
}
|
||||
|
||||
public String decode(String data, String path, String key) {
|
||||
String decData = null;
|
||||
// ScpDbAgent agt = new ScpDbAgent();
|
||||
// decData = agt.ScpDecB64(path, key, data);
|
||||
return decData;
|
||||
}
|
||||
|
||||
}
|
||||
+172
@@ -0,0 +1,172 @@
|
||||
package com.eactive.eai.rms.common.acl.sendsmslog;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.util.CamelCaseUtil;
|
||||
import com.eactive.eai.rms.common.vo.JsonPageVo;
|
||||
import com.google.gson.Gson;
|
||||
|
||||
|
||||
@Controller
|
||||
public class TranErrorSmsLogController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
@Qualifier("tranErrorSmsLogService")
|
||||
private TranErrorSmsLogService service;
|
||||
|
||||
@Autowired
|
||||
@Qualifier("monitoringContext")
|
||||
private MonitoringContext monitoringContext;
|
||||
|
||||
@RequestMapping(value = "/common/acl/sendsmslog/tranErrorSmsLogMan.view")
|
||||
public String viewList(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
|
||||
//에러건수
|
||||
String errCount = monitoringContext.getStringProperty(MonitoringContext.SMS_ERROR_COUNT,"0");
|
||||
|
||||
request.setAttribute("errCount", errCount);
|
||||
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/sendsmslog/recvTranErrorSmsSendLogMan.view")
|
||||
public String viewList2(HttpServletRequest request, @RequestParam(value = "cmd", required = false) String cmd) throws Exception {
|
||||
if (cmd == null || "LIST".equals(cmd.toUpperCase())) {
|
||||
cmd = "";
|
||||
} else {
|
||||
cmd = CamelCaseUtil.converCamelCase(cmd);
|
||||
}
|
||||
String path = request.getServletPath();
|
||||
return path.split("[.]")[0] + cmd;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/common/acl/sendsmslog/tranErrorSmsLogMan.json", params = "cmd=LIST")
|
||||
private ModelAndView selectList(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String, Object> paramMap
|
||||
) throws Exception {
|
||||
HashMap map = service.selectList( pageVo.getStartNum(), pageVo.getEndNum(), paramMap);
|
||||
|
||||
pageVo.setTotalCount((Integer)map.get("totalCount"));
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , map.get("list"));
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/sendsmslog/tranErrorSmsLogMan.json", params = "cmd=LIST2")
|
||||
private ModelAndView selectList2(HttpServletRequest request,
|
||||
JsonPageVo pageVo ,@RequestParam HashMap<String, Object> paramMap
|
||||
) throws Exception {
|
||||
HashMap map = service.selectRecvTranList( pageVo.getStartNum(), pageVo.getEndNum(), paramMap);
|
||||
|
||||
pageVo.setTotalCount((Integer)map.get("totalCount"));
|
||||
|
||||
Map resultMap = new HashMap();
|
||||
resultMap.put("total" , pageVo.getTotal()); //전체 페이지수
|
||||
resultMap.put("page" , pageVo.getPage()); //현재 페이지수
|
||||
resultMap.put("records", pageVo.getTotalCount());//전체 레코드건수
|
||||
resultMap.put("rows" , map.get("list"));
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value= "/common/acl/sendsmslog/tranErrorSmsLogMan.excel",params = "cmd=LIST_GRID_TO_EXCEL")
|
||||
public ModelAndView listGridToExcel(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
HashMap<String, String>[] list2 ;
|
||||
Gson gson = new Gson();
|
||||
String headersStr = (String) paramMap.get("headersStr");
|
||||
headersStr = headersStr.substring(0, headersStr.length()-1);
|
||||
paramMap.put("headersStr", headersStr);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object> list = service.selectListToExcel(request,paramMap);
|
||||
|
||||
String jsonStr = gson.toJson(list.get("list"));
|
||||
list2 = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
String merge = (String)paramMap.get("merge");
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list2);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value= "/common/acl/sendsmslog/tranErrorSmsLogMan.excel",params = "cmd=LIST_GRID_TO_EXCEL2")
|
||||
public ModelAndView listGridToExcel2(HttpServletRequest request, HttpServletResponse response, @RequestParam HashMap<String,Object> paramMap) throws Exception {
|
||||
HashMap<String,Object> resultMap = new HashMap<String,Object>();
|
||||
|
||||
|
||||
HashMap<String, String>[] list2 ;
|
||||
Gson gson = new Gson();
|
||||
String headersStr = (String) paramMap.get("headersStr");
|
||||
headersStr = headersStr.substring(0, headersStr.length()-1);
|
||||
paramMap.put("headersStr", headersStr);
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
HashMap<String, Object> list = service.selectListToExcel2(request,paramMap);
|
||||
|
||||
String jsonStr = gson.toJson(list.get("list"));
|
||||
list2 = gson.fromJson(jsonStr, HashMap[].class);
|
||||
|
||||
String[] headers = gson.fromJson((String) paramMap.get("header"), String[].class);
|
||||
String[] headerTitles = gson.fromJson((String)paramMap.get("headerTitle"), String[].class);
|
||||
|
||||
HashMap<String, Object>[] lmerge = null;
|
||||
String merge = (String)paramMap.get("merge");
|
||||
if (merge !=null){
|
||||
lmerge = gson.fromJson(merge, HashMap[].class);
|
||||
}
|
||||
|
||||
resultMap.put("headers", headers);
|
||||
resultMap.put("headerTitles", headerTitles);
|
||||
resultMap.put("datas", list2);
|
||||
resultMap.put("fileName", (String)paramMap.get("fileName"));
|
||||
resultMap.put("merge", lmerge);
|
||||
ModelAndView modelAndView = new ModelAndView("excelView",resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.eactive.eai.rms.common.acl.sendsmslog;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientForMonitoringTemplateDao;
|
||||
|
||||
@Repository("tranErrorSmsLogDao")
|
||||
@SuppressWarnings({"deprecation","unchecked"})
|
||||
public class TranErrorSmsLogDao extends SqlMapClientForMonitoringTemplateDao {
|
||||
|
||||
public int selectListCount(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (Integer) this.template.queryForObject("TranErrorSmsLog.selectListCount", paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("TranErrorSmsLog.selectList", paramMap);
|
||||
}
|
||||
|
||||
public int selectRecvTranListCount(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (Integer) this.template.queryForObject("TranErrorSmsLog.selectRecvTranListCount", paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectRecvTranList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("TranErrorSmsLog.selectRecvTranList", paramMap);
|
||||
}
|
||||
|
||||
public List selectListToExcel(HashMap param) throws Exception {
|
||||
return template.queryForList("TranErrorSmsLog.selectListToExcel", param);
|
||||
}
|
||||
|
||||
public List selectListToExcel2(HashMap param) throws Exception {
|
||||
return template.queryForList("TranErrorSmsLog.selectListToExcel2", param);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.eactive.eai.rms.common.acl.sendsmslog;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
|
||||
@Service("tranErrorSmsLogService")
|
||||
@SuppressWarnings("unchecked")
|
||||
public class TranErrorSmsLogService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private TranErrorSmsLogDao dao;
|
||||
|
||||
|
||||
public HashMap<String, Object> selectList(int startNum,int endNum,HashMap paramMap) throws Exception {
|
||||
|
||||
// 전체 목록수 얻기
|
||||
int totalCount = dao.selectListCount(paramMap);
|
||||
|
||||
paramMap.put("startNum" , startNum);// 시작 record
|
||||
paramMap.put("endNum" , endNum);// 끝 record
|
||||
|
||||
List list = dao.selectList(paramMap);
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("totalCount", totalCount);
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
public HashMap<String, Object> selectRecvTranList(int startNum,int endNum,HashMap paramMap) throws Exception {
|
||||
|
||||
// 전체 목록수 얻기
|
||||
int totalCount = dao.selectRecvTranListCount(paramMap);
|
||||
|
||||
paramMap.put("startNum" , startNum);// 시작 record
|
||||
paramMap.put("endNum" , endNum);// 끝 record
|
||||
|
||||
List list = dao.selectRecvTranList(paramMap);
|
||||
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("totalCount", totalCount);
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public HashMap selectListToExcel(HttpServletRequest request,HashMap<String, Object> paramMap ) throws Exception {
|
||||
|
||||
List list = dao.selectListToExcel(paramMap);
|
||||
|
||||
HashMap map = new HashMap();
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public HashMap selectListToExcel2(HttpServletRequest request,HashMap<String, Object> paramMap ) throws Exception {
|
||||
|
||||
List list = dao.selectListToExcel2(paramMap);
|
||||
|
||||
HashMap map = new HashMap();
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientTemplateDao;
|
||||
|
||||
@Repository
|
||||
@SuppressWarnings("deprecation")
|
||||
public class BizDao extends SqlMapClientTemplateDao {
|
||||
|
||||
public int selectListCount(HashMap<String, Object> param) throws Exception {
|
||||
return (Integer)template.queryForObject("Biz.selectListCount", param);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<Map<String, Object>> selectList(HashMap<String, Object> param) throws Exception {
|
||||
return (List<Map<String, Object>>)template.queryForList("Biz.selectList", param);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public HashMap<String, Object> selectDetail(HashMap<String, Object> param) throws Exception {
|
||||
return (HashMap<String, Object>)template.queryForObject("Biz.selectDetail", param);
|
||||
}
|
||||
|
||||
public void insert(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.insert("Biz.insert", paramMap);
|
||||
}
|
||||
|
||||
public void update(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.update("Biz.update", paramMap);
|
||||
}
|
||||
|
||||
public void delete(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.delete("Biz.delete", paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBizList(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.delete("Biz.deleteUserBizList", paramMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectUserBizList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectUserBizList", paramMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectBizList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectBizList", paramMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectEaiBizList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectEaiBizList", paramMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectExtBizList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectExtBizList", paramMap);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectAdapterBizList(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectAdapterBizList", paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBiz(HashMap<String, Object> paramMap) throws Exception {
|
||||
this.template.delete("Biz.deleteUserBiz", paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBizCode(HashMap<String, Object> paramMap) throws Exception {
|
||||
this.template.delete("Biz.deleteUserBizCode", paramMap);
|
||||
}
|
||||
|
||||
public void insertUserBiz(HashMap<String, Object> paramMap) throws Exception {
|
||||
this.template.insert("Biz.insertUserBiz", paramMap);
|
||||
}
|
||||
|
||||
public void mergeRM06(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.insert("Biz.mergeRM06", paramMap);
|
||||
}
|
||||
|
||||
public void insertMergeRM06(HashMap<String, Object> paramMap) throws Exception{
|
||||
this.template.insert("Biz.insertMergeRM06", paramMap);
|
||||
}
|
||||
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<HashMap<String, Object>> selectUserBizCodes(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectUserBizCodes", paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectChgAdptUserBizCodes(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("Biz.selectChgAdptUserBizCodes", paramMap);
|
||||
}
|
||||
|
||||
|
||||
public String selectGroupCoCdByEAIBzwkDstCd(HashMap<String, Object> paramMap) {
|
||||
return (String)this.template.queryForObject("Biz.selectGroupCoCdByEAIBzwkDstCd", paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBizCodeRole(HashMap<String, Object> paramMap) throws Exception {
|
||||
this.template.delete("Biz.deleteUserBizCodeRole", paramMap);
|
||||
}
|
||||
|
||||
|
||||
public int selectChgAdptUserBizCode(HashMap<String, Object> param) throws Exception {
|
||||
return (Integer)template.queryForObject("Biz.selectChgAdptUserBizCode", param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,174 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.mapper.UserBizUIMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.unifbwk.UnifBwkTp;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.AdminLoginVo;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserBizUI;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessId;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class BizManService extends BaseService {
|
||||
|
||||
private static final String ADMIN_ROLE = "admin";
|
||||
private static final String DEFAULT_SAVE_TYPE = "R";
|
||||
|
||||
@Autowired
|
||||
private BizDao dao;
|
||||
|
||||
@Autowired
|
||||
private UnifBwkTpService unifBwkTpService;
|
||||
|
||||
@Autowired
|
||||
private UserBusinessService userBusinessService;
|
||||
|
||||
@Autowired
|
||||
private UserBizUIMapper userBizUIMapper;
|
||||
|
||||
@Autowired
|
||||
private UserManService userManService;
|
||||
|
||||
public List<UserBizUI> selectUserBizList(UserBizUI requestUserBizUI) {
|
||||
Iterable<UnifBwkTp> unifBwkTps = unifBwkTpService.findAllwithSearch(requestUserBizUI.getSearchBzwkName());
|
||||
List<UnifBwkTp> unifBwkTpList = new ArrayList<>();
|
||||
unifBwkTps.forEach(unifBwkTpList::add);
|
||||
|
||||
return unifBwkTpList.stream()
|
||||
.map(mapToUserBizUi(requestUserBizUI))
|
||||
.filter(predicate(requestUserBizUI.getTargetGridYn()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private Predicate<UserBizUI> predicate(String targetGridYn) {
|
||||
return userBizUI -> {
|
||||
if ("Y".equalsIgnoreCase(targetGridYn)) {
|
||||
return "true".equals(userBizUI.getChk());
|
||||
} else {
|
||||
return "false".equalsIgnoreCase(userBizUI.getChk());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
private Function<UnifBwkTp, UserBizUI> mapToUserBizUi(UserBizUI ui) {
|
||||
return unifBwkTp -> {
|
||||
Optional<UserBusiness> userBusinessOptional =
|
||||
userBusinessService.findById(new UserBusinessId(ui.getUserId(), unifBwkTp.getEaibzwkdstcd()));
|
||||
|
||||
UserBizUI userBizUI = userBizUIMapper.toVo(unifBwkTp);
|
||||
userBizUI.setUserId(ui.getUserId());
|
||||
userBizUI.setTargetGridYn(ui.getTargetGridYn());
|
||||
|
||||
if (userBusinessOptional.isPresent()) {
|
||||
userBizUI.setChk("true");
|
||||
userBizUI.setSaveType(userBusinessOptional.get().getSaveType());
|
||||
|
||||
} else {
|
||||
userBizUI.setChk("false");
|
||||
}
|
||||
|
||||
return userBizUI;
|
||||
};
|
||||
}
|
||||
|
||||
public void transactionUserBiz(String userId, List<UserBizUI> userBizUIs, AdminLoginVo adminLoginVo) {
|
||||
|
||||
List<UserBusiness> userBusinesses = userBizUIs.stream()
|
||||
.filter(ui -> "true".equals(ui.getChk()))
|
||||
.map(ui -> {
|
||||
ui.setUserId(userId);
|
||||
UserBusiness userBusiness = userBizUIMapper.toEntity(ui);
|
||||
UserBusinessId id = new UserBusinessId(userId, ui.getBizCode());
|
||||
userBusiness.setId(id);
|
||||
return userBusiness;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
userBusinessService.deleteOrSave(userId, userBusinesses);
|
||||
|
||||
String userBusinessServiceLists = userBusinesses.stream()
|
||||
.map(e -> e.getId().getEaiBzwkDstcd())
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
userManService.insertUserAthrRoleChgHistory(userId, CommonConstants.CHANGE_TYPE_ATHR,
|
||||
userBusinessServiceLists, adminLoginVo.getLoginId(), adminLoginVo.getLoginIp());
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> selectBizList() {
|
||||
return unifBwkTpService.findAll().stream()
|
||||
.map(e -> {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
map.put("BIZCODE", e.getEaibzwkdstcd());
|
||||
map.put("BIZNAME", e.getBzwkdsticname());
|
||||
map.put("BIZDESC", e.getBzwkdsticdesc());
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public void insertUserBiz(UserBizUI userBizUI, String saveType) {
|
||||
UserBusiness userBusiness = userBizUIMapper.toEntity(userBizUI);
|
||||
userBusiness.setSaveType(saveType);
|
||||
userBusinessService.save(userBusiness);
|
||||
}
|
||||
|
||||
public String selectGroupCoCdByEAIBzwkDstCd(String eaiBzwkDstCd) {
|
||||
return unifBwkTpService.getById(eaiBzwkDstCd).getGroupcocd();
|
||||
}
|
||||
|
||||
/*
|
||||
* 사용자 의 계정 및 서비스에 해당하는 업무코드 리스트를 리턴한다.
|
||||
*/
|
||||
public List<HashMap<String, Object>> selectUserBizCodes(String userId) {
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("userId", userId);
|
||||
return dao.selectUserBizCodes(map);
|
||||
}
|
||||
|
||||
/*
|
||||
* 업무코드 추가 시 Admin 계정 권한 추가
|
||||
*/
|
||||
public void transactionAdminBiz(String bzwkDstCd) {
|
||||
|
||||
List<Map<String, Object>> adminUserList = new ArrayList<>();
|
||||
|
||||
try {
|
||||
// 모니터링 TSEAIRM02,04 admin 계정 USERID 배열 만들기
|
||||
adminUserList = userManService.selectAdminRoleUser(ADMIN_ROLE);
|
||||
} catch (Exception e) {
|
||||
logger.error("Error retrieving admin user list: ", e);
|
||||
return;
|
||||
}
|
||||
|
||||
for (Map<String, Object> userMap : adminUserList) {
|
||||
|
||||
UserBizUI userBizUI = new UserBizUI();
|
||||
userBizUI.setUserId(String.valueOf(userMap.get("USERID")));
|
||||
userBizUI.setSearchBzwkName("");
|
||||
userBizUI.setTargetGridYn("N");
|
||||
userBizUI.setBizCode(bzwkDstCd);
|
||||
|
||||
try {
|
||||
insertUserBiz(userBizUI, DEFAULT_SAVE_TYPE);
|
||||
} catch (Exception e) {
|
||||
logger.warn("admin role TSEAIRM06 bizCode insert failed", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
|
||||
@Service("bizService")
|
||||
public class BizService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private BizDao dao;
|
||||
|
||||
public HashMap<String, Object> selectList(int startNum,int endNum, String searchBzwkDstcd) throws Exception {
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
//검색 조건
|
||||
|
||||
paramMap.put("searchBzwkDstcd", searchBzwkDstcd.toUpperCase());
|
||||
|
||||
// 전체 목록수 얻기
|
||||
int totalCount = dao.selectListCount(paramMap);
|
||||
|
||||
paramMap.put("startNum" , startNum);// 시작 record
|
||||
paramMap.put("endNum" , endNum);// 끝 record
|
||||
|
||||
List<Map<String, Object>> list = dao.selectList(paramMap);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("totalCount", totalCount);
|
||||
|
||||
map.put("list", list);
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
public HashMap<String, Object> selectDetail(String bzwkDstcd) throws Exception {
|
||||
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("bzwkDstcd", bzwkDstcd);
|
||||
|
||||
HashMap<String, Object> detail = dao.selectDetail(paramMap);
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
|
||||
map.put("detail", detail);
|
||||
|
||||
return map;
|
||||
|
||||
}
|
||||
|
||||
public void insert(HashMap<String, Object> paramMap, HashMap<String, Object>[] list) throws Exception {
|
||||
dao.insert(paramMap);
|
||||
}
|
||||
|
||||
public void update(HashMap<String, Object> paramMap, HashMap<String, Object>[] list) throws Exception {
|
||||
dao.update(paramMap);
|
||||
}
|
||||
|
||||
public void delete(HashMap<String, Object> paramMap) throws Exception {
|
||||
dao.delete(paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectUserBizList(HashMap<String, Object> paramMap ) throws Exception {
|
||||
List searchList = new ArrayList();
|
||||
|
||||
String searchBzwkName = (String)paramMap.get("searchBzwkName");
|
||||
String targetGridYn = (String)paramMap.get("targetGridYn");
|
||||
|
||||
searchList = Arrays.asList(searchBzwkName.split(","));
|
||||
|
||||
paramMap.put("searchBzwkName", "Y".equals(targetGridYn) ? "" : searchList);
|
||||
|
||||
List<HashMap<String, Object>> list = dao.selectUserBizList(paramMap);
|
||||
List<HashMap<String, Object>> resultList = new ArrayList<HashMap<String, Object>>();
|
||||
|
||||
// 사용자에게 등록된 업무권한 목록
|
||||
if("Y".equals(targetGridYn))
|
||||
{
|
||||
for(HashMap<String, Object> m : list)
|
||||
{
|
||||
if("true".equals(m.get("CHK")))
|
||||
{
|
||||
resultList.add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // 사용자에게 등록되지 않은 업무권한 목록
|
||||
for(HashMap<String, Object> m : list)
|
||||
{
|
||||
if("false".equals(m.get("CHK")))
|
||||
{
|
||||
resultList.add(m);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
public void transactionUserBiz(String userId, HashMap<String, Object>[] list) throws Exception {
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("userId", userId);
|
||||
dao.deleteUserBiz(paramMap);
|
||||
|
||||
for (HashMap<String, Object> map : list) {
|
||||
map.put("BIZCODE", ((String)map.get("BIZCODE")).trim());
|
||||
map.put("userId", userId);
|
||||
if("".equals(map.get("SAVETYPE")) || map.get("SAVETYPE") == null){
|
||||
map.put("SAVETYPE","R");
|
||||
}else{
|
||||
map.put("SAVETYPE",map.get("SAVETYPE"));
|
||||
}
|
||||
String check = (String) map.get("CHK");
|
||||
|
||||
if ("true".equals(check)) {
|
||||
try{
|
||||
dao.insertUserBiz(map);
|
||||
map.put("EAIBZWKDSTCD", map.get("BIZCODE"));
|
||||
//선택한 업무코드 + 그 업무코드로 조회되는 EAI업무구분코드 에 대해서 권한 부여 추가 2020.02.05
|
||||
dao.insertMergeRM06(map);
|
||||
}catch(Exception e){
|
||||
logger.warn("업무코드["+ map.get("BIZCODE")+"]"+" 중복입니다");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* 사용자 의 계정 및 서비스에 해당하는 업무코드 리스트를 리턴한다.
|
||||
*/
|
||||
public List<HashMap<String, Object>> selectUserBizCodes(String userId) {
|
||||
|
||||
HashMap<String, Object> map = new HashMap<String, Object>();
|
||||
map.put("userId", userId);
|
||||
return dao.selectUserBizCodes(map);
|
||||
}
|
||||
|
||||
public String selectBizCodesString(DataSourceType serviceType, String userId) {
|
||||
// 사용자 권한별 업무코드 리스트를 code1,code2,code3 ... 형태로 구한다.
|
||||
List<HashMap<String, Object>> codeList = selectUserBizCodes(userId);
|
||||
StringBuffer buf = new StringBuffer();
|
||||
for (int i = 0; i < codeList.size(); i++) {
|
||||
HashMap<String, Object> map = codeList.get(i);
|
||||
buf.append(map.get("BIZCODE"));
|
||||
buf.append(",");
|
||||
}
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectBizList() throws Exception {
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
return dao.selectBizList(paramMap);
|
||||
}
|
||||
|
||||
public void deleteRmsUserBiz(HashMap<String, Object> paramMap) throws Exception {
|
||||
dao.deleteUserBiz(paramMap);
|
||||
}
|
||||
|
||||
public void mergeRM06(HashMap<String,Object> paramMap) throws Exception{
|
||||
dao.mergeRM06(paramMap);
|
||||
}
|
||||
|
||||
public void insertMergeRM06(HashMap<String,Object> paramMap) throws Exception{
|
||||
dao.insertMergeRM06(paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBizCodeRole(HashMap<String, Object> paramMap) throws Exception {
|
||||
dao.deleteUserBizCodeRole(paramMap);
|
||||
}
|
||||
|
||||
public void insertUserBiz(HashMap<String,Object> paramMap) throws Exception{
|
||||
dao.insertUserBiz(paramMap);
|
||||
}
|
||||
|
||||
public String selectGroupCoCdByEAIBzwkDstCd(String eaiBzwkDstCd) {
|
||||
HashMap<String, Object> paramMap = new HashMap<String, Object>();
|
||||
paramMap.put("eaiBzwkDstCd", eaiBzwkDstCd);
|
||||
return dao.selectGroupCoCdByEAIBzwkDstCd(paramMap);
|
||||
}
|
||||
|
||||
public void deleteUserBizCode(HashMap<String, Object> paramMap) throws Exception {
|
||||
dao.deleteUserBizCode(paramMap);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,145 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import com.eactive.eai.common.util.ApplicationContextProvider;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.eai.rms.data.entity.man.menu.MenuService;
|
||||
import com.eactive.eai.rms.data.entity.man.role.RoleMenuAuthService;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserInfoService;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserRoleService;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessId;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
||||
|
||||
public class RecordAuthUtil {
|
||||
|
||||
/**
|
||||
* record 제어를 위해 해당 아이디의 모든 업무권한 가져오기
|
||||
*/
|
||||
public static List<String> getRecordAuthList(String empno) throws Exception {
|
||||
List<String> list = new ArrayList<>();
|
||||
UnifBwkTpService unifBwkTpService = ApplicationContextProvider.getContext().getBean(UnifBwkTpService.class);
|
||||
UserBusinessService userBusinessService = ApplicationContextProvider.getContext().getBean(UserBusinessService.class);
|
||||
|
||||
List<Map<String, Object>> dataList = userBusinessService.getRecordAuthList(empno);
|
||||
|
||||
if (!dataList.isEmpty() && "* ".equals((dataList.get(0)).get("BZCD"))) {
|
||||
dataList = unifBwkTpService.getRecordAuthListALL();
|
||||
}
|
||||
for (Map<String, Object> map : dataList) {
|
||||
list.add((String) map.get("BZCD"));
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* record 제어를 위해 해당 아이디, 업무권한이 등록되었는지 확인 - 등록되었으면 Y를 return
|
||||
*/
|
||||
public static String getRecordAuthYn(String empno, String bzCd) throws Exception {
|
||||
|
||||
UserBusinessService userBusinessService = ApplicationContextProvider.getContext().getBean(UserBusinessService.class);
|
||||
UserInfoService userInfoService = ApplicationContextProvider.getContext().getBean(UserInfoService.class);
|
||||
List<String> roleId = Arrays.asList(CommonConstants.EAI_APPROVER, CommonConstants.EAI_MANAGER);
|
||||
|
||||
if (StringUtils.isEmpty(bzCd)) { // 업무코드가 없는 ui일경우 -> EAI 운영자와 승인자만 진행
|
||||
// EAI 팀인지 확인 - EAI팀이면 true "Y"
|
||||
return userInfoService.isEAITeam(empno, roleId) ? "Y" : "N";
|
||||
} else {
|
||||
return userBusinessService.findById(new UserBusinessId(empno, bzCd)).isPresent() ? "Y" : "N";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 권한그룹이 admin, eai_manager 인 경우에는 업무그룹 필드가 공백이 항목까지 모두 조회한다.
|
||||
*/
|
||||
public static String getRecordAuthQuery2(HttpServletRequest request, String empno) throws Exception {
|
||||
List<String> list = getRecordAuthList(empno);
|
||||
StringBuffer st = new StringBuffer();
|
||||
String separator = "";
|
||||
|
||||
if (!list.isEmpty()) {
|
||||
for(String bzcd : list) {
|
||||
st.append(separator);
|
||||
st.append("'").append(bzcd).append("'");
|
||||
separator = ", ";
|
||||
}
|
||||
|
||||
MonitoringContext monitoringContext = ApplicationContextProvider.getContext().getBean(MonitoringContext.class);
|
||||
String tranTrackingPeriod = monitoringContext.getStringProperty(MonitoringContext.RMS_ALL_ROLE_ID, "admin");
|
||||
|
||||
if (tranTrackingPeriod.contains(SessionManager.getRoleIdString(request)) ) {
|
||||
st.append(", ").append("''");
|
||||
}
|
||||
}
|
||||
|
||||
return st.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 제어를 위한 쿼리조건 생성 ( 업무그룹 코드 ) - 사용자 그룹이 admin, eai_manager 중의 하나인 경우 업무그룹코드가
|
||||
* null 인 것도 포함해서 조회한다.
|
||||
*/
|
||||
public static String getRecordAuthQuery2(HttpServletRequest request) throws Exception {
|
||||
String userId = SessionManager.getUserId(request);
|
||||
|
||||
if (StringUtils.isEmpty(userId)) {
|
||||
throw new Exception("로그인 되지 않았습니다.");
|
||||
}
|
||||
|
||||
return RecordAuthUtil.getRecordAuthQuery2(request, userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* empno으로 roleId 가져오기
|
||||
*/
|
||||
public static String getRoleId(String empno) throws Exception {
|
||||
UserRoleService userRoleService = ApplicationContextProvider.getContext().getBean(UserRoleService.class);
|
||||
return userRoleService.getRoleId(empno);
|
||||
}
|
||||
|
||||
/**
|
||||
* 현재 메뉴위치 - 메뉴 아이디로 현재 메뉴위치구하기
|
||||
*/
|
||||
public static String getPosition(String menuId) throws Exception {
|
||||
MenuService menuService = ApplicationContextProvider.getContext().getBean(MenuService.class);
|
||||
return menuService.getPosition(menuId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메뉴 권한 가져오기
|
||||
*/
|
||||
public static String getMenuAuth(HttpServletRequest request, String empno, String menuId, String serviceType)
|
||||
throws Exception {
|
||||
RoleMenuAuthService roleMenuAuthService = ApplicationContextProvider
|
||||
.getContext()
|
||||
.getBean(RoleMenuAuthService.class);
|
||||
String authCode = roleMenuAuthService.getRoleList(empno, menuId, serviceType);
|
||||
return noCheckRole(request, authCode);
|
||||
}
|
||||
|
||||
/**
|
||||
* 메뉴 권한 가져오기
|
||||
* @return 권한코드
|
||||
*/
|
||||
public static String getMenuUrlAuth(HttpServletRequest request, String empno, String url, String serviceType)
|
||||
throws Exception {
|
||||
MenuService menuService = ApplicationContextProvider.getContext().getBean(MenuService.class);
|
||||
String authCode = menuService.getUrlAuth(empno, url, serviceType);
|
||||
return noCheckRole(request, authCode);
|
||||
}
|
||||
|
||||
public static String noCheckRole(HttpServletRequest request,String authCode){
|
||||
return StringUtils.isNotEmpty(authCode) ? authCode : "R"; // 읽기권한
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserServicetypeUI;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceType;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceTypeId;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceTypeService;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
public class ServiceTypeManService extends BaseService {
|
||||
|
||||
@Autowired
|
||||
private UserServiceTypeService userServiceTypeService;
|
||||
|
||||
public List<UserServicetypeUI> selectUserServiceTypeList(String userId, String targetGridYn) {
|
||||
List<UserServiceType> userServiceTypeList = userServiceTypeService.selectUserServiceTypeList(userId);
|
||||
List<UserServicetypeUI> allServiceTypes = getDatasourceList();
|
||||
|
||||
return allServiceTypes.stream().filter(ui -> isMatchTargetServiceTypes(userServiceTypeList, ui, targetGridYn))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private List<UserServicetypeUI> getDatasourceList() {
|
||||
|
||||
return DataSourceTypeManager.getDynamicDataSourceTypes().stream()
|
||||
.map(datasource -> {
|
||||
|
||||
UserServicetypeUI ui = new UserServicetypeUI();
|
||||
ui.setUseServiceType(datasource.getName());
|
||||
ui.setDesc(datasource.getText());
|
||||
return ui;
|
||||
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
private boolean isMatchTargetServiceTypes(List<UserServiceType> userServiceTypeList, UserServicetypeUI ui,
|
||||
String targetGridYn) {
|
||||
boolean userHasServiceType = userServiceTypeList.stream()
|
||||
.anyMatch(serviceType -> serviceType.getId().getUseServiceType().equals(ui.getUseServiceType()));
|
||||
|
||||
return "Y".equals(targetGridYn) ? userHasServiceType : !userHasServiceType;
|
||||
}
|
||||
|
||||
public void transactionUserServiceType(String userId, List<UserServicetypeUI> userServicetypeUIs) {
|
||||
userServicetypeUIs.forEach(ui -> {
|
||||
UserServiceTypeId userServiceTypeId = new UserServiceTypeId(userId, ui.getUseServiceType());
|
||||
|
||||
if ("true".equals(ui.getChk())) {
|
||||
UserServiceType userServiceType = new UserServiceType();
|
||||
userServiceType.setId(userServiceTypeId);
|
||||
userServiceTypeService.save(userServiceType);
|
||||
|
||||
} else if ("false".equals(ui.getChk())) {
|
||||
userServiceTypeService.deleteById(userServiceTypeId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
|
||||
public class UserAccountLockJob implements Job {
|
||||
|
||||
private static final Logger logger = Logger.getLogger(UserAccountLockJob.class);
|
||||
|
||||
private UserAccountLockService userAccountLockService;
|
||||
|
||||
@Autowired
|
||||
public UserAccountLockJob(UserAccountLockService userAccountLockService) {
|
||||
this.userAccountLockService=userAccountLockService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
if (logger.isInfoEnabled()) logger.info("START USER ACCOUNT LOCK JOB");
|
||||
|
||||
ApplicationContext appContext = null;
|
||||
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("applicationContext get module error", e);
|
||||
return;
|
||||
}
|
||||
|
||||
userAccountLockService=(UserAccountLockService)appContext.getBean("userAccountLockService");
|
||||
|
||||
// APIMS USER ACCCOUNT LOCK
|
||||
try {
|
||||
logger.info("START USER ACCOUNT LOCK SERVICE SCHECULER ...");
|
||||
|
||||
DataSourceType dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING);
|
||||
DataSourceContextHolder.setDataSourceType(dataSourceType);
|
||||
|
||||
userAccountLockService.updateUserAccountLock(dataSourceType.getSchema());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("USER ACCOUNT LOCK SERVICE ERROR",e);
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled()) logger.info("PORTAL USER ACCOUNT LOCK JOB");
|
||||
|
||||
// API PORTAL USER ACCCOUNT LOCK
|
||||
try {
|
||||
logger.info("START PORTAL USER ACCOUNT LOCK SERVICE SCHECULER ...");
|
||||
|
||||
DataSourceType dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING);
|
||||
DataSourceContextHolder.setDataSourceType(dataSourceType);
|
||||
|
||||
userAccountLockService.updatePortalUserAccountLock(dataSourceType.getSchema());
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("USER ACCOUNT LOCK SERVICE ERROR",e);
|
||||
}
|
||||
|
||||
if (logger.isInfoEnabled()) logger.info("END USER ACCOUNT LOCK JOB");
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class UserAccountLockService extends BaseService {
|
||||
|
||||
private UserDao userDao;
|
||||
|
||||
@Autowired
|
||||
public UserAccountLockService(UserDao userDao) {
|
||||
this.userDao = userDao;
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> updateUserAccountLock(String schemaId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
return userDao.updateUserAccountLock(paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> updatePortalUserAccountLock(String schemaId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", schemaId);
|
||||
return userDao.updatePortalUserAccountLock(paramMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import com.eactive.eai.rms.common.base.SqlMapClientForMonitoringTemplateDao;
|
||||
|
||||
@Repository
|
||||
@SuppressWarnings({ "deprecation", "unchecked" })
|
||||
public class UserDao extends SqlMapClientForMonitoringTemplateDao {
|
||||
public HashMap<String, Object> selectDetail(HashMap<String, Object> paramMap) throws Exception {
|
||||
return (HashMap<String, Object>) this.template.queryForObject("User.selectDetail", paramMap);
|
||||
}
|
||||
|
||||
/* userSyncJob */
|
||||
public List<HashMap<String, Object>> selectCompanyList(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("User.selectCompanyList", paramMap);
|
||||
}
|
||||
public List<HashMap<String, Object>> selectDeleteCompanyList(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("User.selectDeleteCompanyList", paramMap);
|
||||
}
|
||||
|
||||
/* updateUserAccountLockJob */
|
||||
public List<HashMap<String, Object>> updateUserAccountLock(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("User.updateUserAccountLock", paramMap);
|
||||
}
|
||||
|
||||
/* updateUserAccountLockJob */
|
||||
public List<HashMap<String, Object>> updatePortalUserAccountLock(HashMap<String, Object> paramMap) {
|
||||
return (List<HashMap<String, Object>>) this.template.queryForList("User.updatePortalUserAccountLock", paramMap);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
|
||||
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.Direction;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserLoginHistoryUI;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
|
||||
@Controller
|
||||
public class UserLoginHistoryManController extends BaseAnnotationController {
|
||||
|
||||
private final UserManService userManService;
|
||||
|
||||
|
||||
@Autowired
|
||||
public UserLoginHistoryManController(UserManService userManService) {
|
||||
this.userManService = userManService;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/common/acl/user/userLoginHistoryMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userLoginHistoryMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<UserLoginHistoryUI>> selectList( Pageable pageable, UserLoginHistoryUI userLoginHistoryUI) {
|
||||
|
||||
Page<UserLoginHistoryUI> page = userManService.selectList(pageable, userLoginHistoryUI);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.web.SortDefault;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.ui.AdminLoginVo;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserAthrRoleChgHistoryUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserBizUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserRoleUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserServicetypeUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserUISearch;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.eactive.eai.rms.common.vo.GridResponse;
|
||||
import com.eactive.eai.rms.data.entity.onl.unifbwk.UnifBwkTpService;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.core.type.TypeReference;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
|
||||
@Controller
|
||||
public class UserManController extends BaseAnnotationController {
|
||||
|
||||
private final UserManService userManService;
|
||||
private final BizManService bizManService;
|
||||
private final ServiceTypeManService serviceTypeManService;
|
||||
private final UnifBwkTpService unifBwkTpService;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
|
||||
@Autowired
|
||||
public UserManController(UserManService userManService,
|
||||
BizManService bizManService,
|
||||
ServiceTypeManService serviceTypeManService,
|
||||
UnifBwkTpService unifBwkTpService,
|
||||
ObjectMapper objectMapper ) {
|
||||
this.userManService = userManService;
|
||||
this.bizManService = bizManService;
|
||||
this.serviceTypeManService = serviceTypeManService;
|
||||
this.unifBwkTpService = unifBwkTpService;
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/common/acl/user/userMan.view")
|
||||
public void view() {
|
||||
// view
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/common/acl/user/userMan.view", params = "cmd=DETAIL")
|
||||
public String detailView() {
|
||||
return "/common/acl/user/userManDetail";
|
||||
}
|
||||
|
||||
|
||||
/* 상세 팝업 - 역할변경 */
|
||||
@GetMapping(value = "/common/acl/user/userMan.view", params = "cmd=POPUP")
|
||||
public String detailPopup() {
|
||||
return "/common/acl/user/userManPopup";
|
||||
}
|
||||
|
||||
|
||||
/* 상세 팝업 - 권한변경 */
|
||||
@GetMapping(value = "/common/acl/user/userMan.view", params = "cmd=POPUP2")
|
||||
public String detailPopup2() {
|
||||
return "/common/acl/user/userManPopup2";
|
||||
}
|
||||
|
||||
|
||||
/* 상세 팝업 - 사용서비스 */
|
||||
@GetMapping(value = "/common/acl/user/userMan.view", params = "cmd=POPUP3")
|
||||
public String detailPopup3() {
|
||||
return "/common/acl/user/userManPopup3";
|
||||
}
|
||||
|
||||
/* 권한변경이력 팝업 - UserAthrRoleChgHistory */
|
||||
@GetMapping(value = "/common/acl/user/userMan.view", params = "cmd=POPUP4")
|
||||
public String detailPopup4() {
|
||||
return "/common/acl/user/userManPopup4";
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST")
|
||||
public ResponseEntity<GridResponse<UserUI>> selectList(
|
||||
@SortDefault("userid") Pageable pageable,
|
||||
UserUISearch userUiSearch) {
|
||||
Page<UserUI> page = userManService.selectList(pageable, userUiSearch);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=DETAIL")
|
||||
public ResponseEntity<UserUI> selectDetail(String userId) {
|
||||
UserUI userUI = userManService.selectDetail(userId);
|
||||
return ResponseEntity.ok(userUI);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_INIT_COMBO")
|
||||
public ResponseEntity<Map<String, Object>> initCombo() {
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
resultMap.put("authRows", userManService.selectRole("Y"));
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<Object> insert(HttpServletRequest request, UserUI userUI) {
|
||||
AdminLoginVo adminLoginVo = getAdminLoginVo(request);
|
||||
|
||||
userManService.insert(userUI,adminLoginVo);
|
||||
|
||||
return ResponseEntity.ok().body(
|
||||
Collections.singletonMap("result", "success"));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<Object> update(HttpServletRequest request, UserUI userUI) {
|
||||
userManService.update(userUI);
|
||||
return ResponseEntity.ok().body(
|
||||
Collections.singletonMap("result", "success"));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String userId) {
|
||||
userManService.delete(userId);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=UPDATE_PASSWORD")
|
||||
public ResponseEntity<Object> updatePassword(UserUI userUI)
|
||||
throws Exception {
|
||||
userManService.updatePassword(userUI);
|
||||
return ResponseEntity.ok().body(Collections.singletonMap("result",
|
||||
"초기화 성공 하였습니다."));
|
||||
}
|
||||
|
||||
|
||||
/* 역할변경 - popup */
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_USER_ROLE")
|
||||
public ResponseEntity<GridResponse<UserRoleUI>> selectUserRoleList(
|
||||
String userId) {
|
||||
List<UserRoleUI> list = userManService.selectUserRoleList(userId);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=TRANSACTION_USER_ROLE")
|
||||
public ResponseEntity<Void> transactionUserRole(String userId,
|
||||
@RequestParam Map<String, Object> paramMap, HttpServletRequest request)
|
||||
throws JsonProcessingException {
|
||||
|
||||
List<UserRoleUI> userRoles = objectMapper.readValue(
|
||||
(String) paramMap.get("gridData"),
|
||||
new TypeReference<List<UserRoleUI>>() {});
|
||||
|
||||
AdminLoginVo adminLoginVo = getAdminLoginVo(request);
|
||||
|
||||
userManService.transactionUserRoleAndCheckAdmin(userId, userRoles, adminLoginVo);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
/* 권한변경 - popup2 */
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_USER_BIZ")
|
||||
public ResponseEntity<GridResponse<UserBizUI>> selectListUserBiz(
|
||||
String userId, UserBizUI userBizUI) {
|
||||
List<UserBizUI> list = bizManService.selectUserBizList(userBizUI);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_BIZ_COUNT")
|
||||
public ResponseEntity<Map<String, Integer>> selectListBizCount(
|
||||
String searchBzwkName) {
|
||||
int bizListCount = Math.toIntExact(unifBwkTpService
|
||||
.selectListCount(searchBzwkName));
|
||||
return ResponseEntity.ok(Collections.singletonMap("bizCount",
|
||||
bizListCount));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=TRANSACTION_USER_BIZ")
|
||||
public ResponseEntity<Void> transactionUserBiz(String userId,
|
||||
@RequestParam Map<String, Object> paramMap, HttpServletRequest request)
|
||||
throws JsonProcessingException {
|
||||
|
||||
List<UserBizUI> userBizUIs = objectMapper.readValue(
|
||||
(String) paramMap.get("gridData"),
|
||||
new TypeReference<List<UserBizUI>>() {});
|
||||
|
||||
bizManService.transactionUserBiz(userId, userBizUIs, getAdminLoginVo(request));
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
|
||||
/* 서비스타입변경 - popup3 */
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_SERVICETYPE_COUNT")
|
||||
public ResponseEntity<Map<String, Integer>> selectListServiceTypeCount() {
|
||||
int dataSourceTypeCount = DataSourceTypeManager
|
||||
.getDynamicDataSourceTypes().size();
|
||||
return ResponseEntity.ok(Collections.singletonMap("servicetypeCount",
|
||||
dataSourceTypeCount));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_USER_SERVICETYPE")
|
||||
public ResponseEntity<GridResponse<UserServicetypeUI>> selectListUserServiceType(
|
||||
String userId, String targetGridYn) {
|
||||
List<UserServicetypeUI> list = serviceTypeManService
|
||||
.selectUserServiceTypeList(userId,
|
||||
targetGridYn);
|
||||
return ResponseEntity.ok(new GridResponse<>(list));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=TRANSACTION_USER_SERVICETYPE")
|
||||
public ResponseEntity<String> transactionUserServiceType(String userId,
|
||||
@RequestParam Map<String, Object> paramMap, HttpServletRequest request)
|
||||
throws JsonProcessingException {
|
||||
|
||||
List<UserServicetypeUI> userServicetypeUIs = objectMapper.readValue(
|
||||
(String) paramMap.get("gridData"),
|
||||
new TypeReference<List<UserServicetypeUI>>() {});
|
||||
|
||||
try {
|
||||
serviceTypeManService.transactionUserServiceType(userId, userServicetypeUIs);
|
||||
|
||||
} catch (Exception e) {
|
||||
return ResponseEntity.internalServerError().body(e.getMessage());
|
||||
}
|
||||
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
/* 권한변경이력 팝업 - POPUP4 */
|
||||
@PostMapping(value = "/common/acl/user/userMan.json", params = "cmd=LIST_CHANGE_HISTORY")
|
||||
public ResponseEntity<GridResponse<UserAthrRoleChgHistoryUI>> selectList( Pageable pageable, String userId) {
|
||||
|
||||
Page<UserAthrRoleChgHistoryUI> page = userManService.selectUserChgHistoryList(pageable, userId);
|
||||
return ResponseEntity.ok(new GridResponse<>(page));
|
||||
}
|
||||
|
||||
/* 권한 역할 변경이력 관련 */
|
||||
private AdminLoginVo getAdminLoginVo(HttpServletRequest request) {
|
||||
AdminLoginVo adminLoginVo = new AdminLoginVo();
|
||||
adminLoginVo.setLoginIp(request.getRemoteAddr());
|
||||
adminLoginVo.setLoginId(SessionManager.getUserId(request));
|
||||
|
||||
return adminLoginVo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,272 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.mapper.UserAthrRoleChgHistoryUIMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.mapper.UserLoginHistoryUIMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.mapper.UserUIMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.*;
|
||||
import com.eactive.eai.rms.data.entity.man.user.*;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessId;
|
||||
import com.eactive.eai.rms.data.entity.onl.code.CodeService;
|
||||
import com.eactive.eai.rms.onl.apim.masking.MaskingUtils;
|
||||
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.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.common.seed.Seed;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.context.MonitoringContext;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.spring.LocaleMessage;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.eai.rms.data.entity.man.role.Role;
|
||||
import com.eactive.eai.rms.data.entity.man.role.RoleService;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
import com.eactive.eai.rms.onl.common.exception.BizException;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@RequiredArgsConstructor
|
||||
public class UserManService extends BaseService {
|
||||
|
||||
private final UserInfoService userInfoService;
|
||||
private final UserRoleService userRoleService;
|
||||
private final UserBusinessService userBusinessService;
|
||||
private final LocaleMessage localeMessage;
|
||||
private final RoleService roleService;
|
||||
private final UserServiceTypeService userServiceTypeService;
|
||||
private final UserUIMapper userUIMapper;
|
||||
private final MonitoringContext monitoringContext;
|
||||
private final UserAthrRoleChgHistoryService userAthrRoleChgHistoryService;
|
||||
private final UserAthrRoleChgHistoryUIMapper userAthrRoleChgHistoryUIMapper;
|
||||
private final UserLoginHistoryService userLoginHistoryService;
|
||||
private final UserLoginHistoryUIMapper userLoginHistoryUIMapper;
|
||||
private final CodeService codeService;
|
||||
|
||||
public Page<UserUI> selectList(Pageable pageable, UserUISearch userUiSearch) {
|
||||
/* 사용자명 마스킹처리요청 _ 2024.12.10 */
|
||||
Page<UserInfo> userInfos = userInfoService.findAll(pageable, userUiSearch);
|
||||
|
||||
List<UserUI> content = userInfos.getContent().stream()
|
||||
.map(entity -> {
|
||||
UserUI userInfo = userUIMapper.toVo(entity);
|
||||
userInfo.setUserName(MaskingUtils.maskName(entity.getUsername()));
|
||||
return userInfo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return new PageImpl<>(content, pageable, userInfos.getTotalElements());
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> selectRole(String searchUseYn) {
|
||||
return roleService.selectRole(searchUseYn);
|
||||
}
|
||||
|
||||
public UserUI selectDetail(String userId) {
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
UserUI userUI = userUIMapper.toVo(userInfo);
|
||||
|
||||
String roleidnfiname = selectUserRoleList(userId)
|
||||
.stream()
|
||||
.filter(role -> "true".equals(role.getChk()))
|
||||
.map(UserRoleUI::getRoleId)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
userUI.setRoleidnfiname(roleidnfiname);
|
||||
/* 사용자명 마스킹처리요청 _ 2024.12.10 */
|
||||
userUI.setUserName(MaskingUtils.maskName(userInfo.getUsername()));
|
||||
return userUI;
|
||||
}
|
||||
|
||||
public void insert(UserUI userUI, AdminLoginVo adminLoginVo) {
|
||||
|
||||
// 중복체크
|
||||
if (userInfoService.existsById(userUI.getUserId())) {
|
||||
throw new BizException(localeMessage
|
||||
.getString("user.userIdExists"));
|
||||
}
|
||||
|
||||
UserInfo userInfo = userUIMapper.toEntity(userUI);
|
||||
userInfo.setRoleidnfiname(CommonConstants.DEPT_DEVELOPER);
|
||||
|
||||
try {
|
||||
userInfo.setPassword(Seed.encrypt(userUI.getUserId()));
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Error encrypting password", e);
|
||||
}
|
||||
|
||||
userInfoService.save(userInfo);
|
||||
String roleId = monitoringContext.getStringProperty(
|
||||
MonitoringContext.USER_DEFAULT_RULE, "newbie");
|
||||
UserRole userRole = new UserRole();
|
||||
userRole.setId(new UserRoleId(userUI.getUserId(), roleId));
|
||||
userRoleService.save(userRole);
|
||||
|
||||
DataSourceTypeManager.getDynamicDataSourceTypes().stream()
|
||||
.map(DataSourceType::getName)
|
||||
.forEach(type -> userServiceTypeService
|
||||
.insertUserServiceType(userUI
|
||||
.getUserId(),
|
||||
type));
|
||||
insertUserAthrRoleChgHistory(userUI.getUserId(), CommonConstants.CHANGE_TYPE_ROLE, roleId,
|
||||
adminLoginVo.getLoginId(), adminLoginVo.getLoginIp());
|
||||
|
||||
insertUserAthrRoleChgHistory(userUI.getUserId(), CommonConstants.CHANGE_TYPE_ATHR,
|
||||
CommonConstants.USER_SERVICE_TYPE_APIGW, adminLoginVo.getLoginId(), adminLoginVo.getLoginIp());
|
||||
|
||||
}
|
||||
|
||||
public void update(UserUI userUI) {
|
||||
UserInfo userInfo = userInfoService.getById(userUI.getUserId());
|
||||
/* 사용자명 마스킹처리요청 _ 2024.12.10 */
|
||||
if (MaskingUtils.maskName(userInfo.getUsername()).equals(userUI.getUserName())) {
|
||||
userUI.setUserName(userInfo.getUsername());
|
||||
}
|
||||
|
||||
userUIMapper.updateToEntity(userUI, userInfo);
|
||||
userInfoService.save(userInfo);
|
||||
}
|
||||
|
||||
public void delete(String userId) {
|
||||
userBusinessService.deleteAllByUserId(userId);
|
||||
userServiceTypeService.deleteAllByUserId(userId);
|
||||
userRoleService.deleteAllByUserId(userId);
|
||||
userInfoService.deleteById(userId);
|
||||
}
|
||||
|
||||
public void updatePassword(UserUI userUI) throws Exception {
|
||||
UserInfo userInfo = userInfoService.getById(userUI.getUserId());
|
||||
userInfo.setPassword(Seed.encrypt(userUI.getUserId()));
|
||||
userUIMapper.updateToEntity(userUI, userInfo);
|
||||
userInfoService.save(userInfo);
|
||||
}
|
||||
|
||||
public List<UserRoleUI> selectUserRoleList(String userId) {
|
||||
Iterable<Role> roles = roleService.findAllRolesByUseYn("Y");
|
||||
List<UserRoleUI> userRoleUIs = new ArrayList<>();
|
||||
|
||||
roles.forEach(role -> {
|
||||
Optional<UserRole> userRole = userRoleService.findById(
|
||||
new UserRoleId(userId, role.getRoleId()));
|
||||
|
||||
UserRoleUI userRoleUI = new UserRoleUI();
|
||||
userRoleUI.setRoleId(role.getRoleId());
|
||||
userRoleUI.setRoleName(role.getRoleName());
|
||||
userRoleUI.setRoleDesc(role.getRoleDesc());
|
||||
userRoleUI.setChk(userRole.isPresent() ? "true" : "false");
|
||||
|
||||
userRoleUIs.add(userRoleUI);
|
||||
});
|
||||
|
||||
return userRoleUIs;
|
||||
}
|
||||
|
||||
public void transactionUserRoleAndCheckAdmin(String userId, List<UserRoleUI> userList, AdminLoginVo adminLoginVo) {
|
||||
List<UserRole> userRoles = userList.stream()
|
||||
.map(userRoleUI -> {
|
||||
UserRole userRole = new UserRole();
|
||||
userRole.setId(new UserRoleId(userId,
|
||||
userRoleUI.getRoleId()));
|
||||
return userRole;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
userRoleService.deleteOrSave(userId, userRoles);
|
||||
|
||||
String joinedUserRoles = userList.stream()
|
||||
.map(UserRoleUI::getRoleId)
|
||||
.collect(Collectors.joining(","));
|
||||
|
||||
updateUserInfoRoles(userId, joinedUserRoles);
|
||||
|
||||
// 이력 추가
|
||||
insertUserAthrRoleChgHistory(userId, CommonConstants.CHANGE_TYPE_ROLE, joinedUserRoles,
|
||||
adminLoginVo.getLoginId(), adminLoginVo.getLoginIp());
|
||||
|
||||
boolean hasAdminRole = userList.stream()
|
||||
.anyMatch(role -> "admin".equalsIgnoreCase(role.getRoleId()));
|
||||
|
||||
if(hasAdminRole) {
|
||||
updateUserBusinessForAdmin(userId);
|
||||
}
|
||||
}
|
||||
|
||||
private void updateUserInfoRoles(String userId, String joinedUserRoles){
|
||||
UserInfo userInfo = userInfoService.getById(userId);
|
||||
userInfo.setRoleidnfiname(joinedUserRoles);
|
||||
userInfoService.save(userInfo);
|
||||
}
|
||||
|
||||
private void updateUserBusinessForAdmin(String userId) {
|
||||
List<UserBusiness> allUserBusinesses = userBusinessService.findAll();
|
||||
List<UserBusiness> newUserBusinesses = allUserBusinesses.stream()
|
||||
.map(biz -> {
|
||||
UserBusiness newUserBusiness = new UserBusiness();
|
||||
newUserBusiness.setId(new UserBusinessId(userId, biz.getId().getEaiBzwkDstcd()));
|
||||
newUserBusiness.setSaveType(biz.getSaveType());
|
||||
return newUserBusiness;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
userBusinessService.deleteOrSave(userId, newUserBusinesses);
|
||||
}
|
||||
|
||||
public List<Map<String, Object>> selectAdminRoleUser(String roleId) {
|
||||
return userInfoService.selectAdminRoleUser(roleId);
|
||||
}
|
||||
|
||||
public Page<UserUI> findUserList(Pageable pageable, String username) {
|
||||
return userInfoService.findByUsername(pageable, username).map(userUIMapper::toVo);
|
||||
}
|
||||
|
||||
public void insertUserAthrRoleChgHistory(String userId, String changeType, String changeDetail,
|
||||
String adminId, String ip) {
|
||||
|
||||
UserAthrRoleChgHistory userAthrRoleChgHistory = new UserAthrRoleChgHistory();
|
||||
|
||||
userAthrRoleChgHistory.setUserId(userId);
|
||||
userAthrRoleChgHistory.setChgGb(changeType); // ATHR : 권한, ROLE : 역할
|
||||
userAthrRoleChgHistory.setChgDtl(changeDetail);
|
||||
userAthrRoleChgHistory.setAmdrId(adminId);
|
||||
userAthrRoleChgHistory.setCctnIp(ip);
|
||||
|
||||
userAthrRoleChgHistoryService.save(userAthrRoleChgHistory);
|
||||
}
|
||||
|
||||
public Page<UserAthrRoleChgHistoryUI> selectUserChgHistoryList(Pageable pageable, String userId) {
|
||||
Page<UserAthrRoleChgHistory> page = userAthrRoleChgHistoryService.findAll(pageable, userId);
|
||||
Page<UserAthrRoleChgHistoryUI> ui = page.map(userAthrRoleChgHistoryUIMapper::toVo);
|
||||
|
||||
ui.forEach(e-> {
|
||||
String codeName = codeService.findCodeName("USER_ATHR_ROLE_CHANGE_TYPE", e.getChgGb()).orElse("");
|
||||
e.setChgGbName(codeName);
|
||||
});
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
public Page<UserLoginHistoryUI> selectList(Pageable pageable, UserLoginHistoryUI userLoginHistoryUI) {
|
||||
Page<UserLoginHistory> page = userLoginHistoryService.findAll(pageable, userLoginHistoryUI);
|
||||
Page<UserLoginHistoryUI> ui = page.map(userLoginHistoryUIMapper::toVo);
|
||||
|
||||
ui.forEach(e -> {
|
||||
if(userInfoService.existsById(e.getUserId())) {
|
||||
UserInfo userInfo = userInfoService.getById(e.getUserId());
|
||||
e.setUsername(userInfo.getUsername());
|
||||
e.setRoleidnfiname(userInfo.getRoleidnfiname());
|
||||
}
|
||||
});
|
||||
|
||||
return ui;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobExecutionContext;
|
||||
import org.quartz.JobExecutionException;
|
||||
import org.quartz.SchedulerException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationContext;
|
||||
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
|
||||
public class UserSyncJob implements Job {
|
||||
private static final Logger logger = Logger.getLogger(UserSyncJob.class);
|
||||
|
||||
private UserSyncService userSyncService;
|
||||
|
||||
@Autowired
|
||||
public UserSyncJob(UserSyncService userSyncService) {
|
||||
this.userSyncService = userSyncService;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
||||
if (logger.isInfoEnabled()) logger.info("START USERSYNCJOB");
|
||||
|
||||
ApplicationContext appContext = null;
|
||||
try {
|
||||
appContext = (ApplicationContext) context.getScheduler().getContext().get("applicationContext");
|
||||
} catch (SchedulerException e) {
|
||||
logger.error("applicationContext get module error", e);
|
||||
return;
|
||||
}
|
||||
|
||||
userSyncService = (UserSyncService) appContext.getBean("userSyncService");
|
||||
|
||||
try {
|
||||
logger.info("START USERSYNCJOB_SCHEDULER...");
|
||||
|
||||
|
||||
DataSourceType dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.IM);
|
||||
DataSourceContextHolder.setDataSourceType(dataSourceType);
|
||||
|
||||
List<HashMap<String, Object>> syncUserList = userSyncService.selectSyncUser(dataSourceType.getSchema());
|
||||
List<HashMap<String, Object>> syncDeleteUserList = userSyncService.selectDeleteSyncUser(dataSourceType.getSchema());
|
||||
|
||||
logger.info("START saveUsers deleteUsers ...");
|
||||
|
||||
/* DataSourceType 변경 - MONITORING */
|
||||
dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.MONITORING);
|
||||
DataSourceContextHolder.setDataSourceType(dataSourceType);
|
||||
|
||||
if(syncUserList.size() > 0) {
|
||||
userSyncService.saveUsers(syncUserList);
|
||||
}
|
||||
|
||||
if(syncDeleteUserList.size() > 0) {
|
||||
userSyncService.deleteUsers(syncDeleteUserList);
|
||||
}
|
||||
|
||||
/* DataSourceType 변경 - APIGW */
|
||||
if(syncDeleteUserList.size() > 0) {
|
||||
|
||||
dataSourceType = DataSourceTypeManager.getDataSourceType(DataSourceTypeManager.APIGW);
|
||||
DataSourceContextHolder.setDataSourceType(dataSourceType);
|
||||
userSyncService.deleteBusinessUser(syncDeleteUserList);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("USERSYNCJOB ERROR ", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.eactive.eai.rms.common.acl.user;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.eactive.eai.common.seed.Seed;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.util.CommonConstants;
|
||||
import com.eactive.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserInfoService;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserRole;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserRoleId;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserRoleService;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceType;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceTypeId;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserServiceTypeService;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
|
||||
@Service
|
||||
@Transactional
|
||||
public class UserSyncService extends BaseService {
|
||||
|
||||
private UserDao userDao;
|
||||
private UserInfoService userInfoService;
|
||||
private UserRoleService userRoleService;
|
||||
private UserServiceTypeService userServiceTypeService;
|
||||
private UserBusinessService userBusinessService;
|
||||
private UserManService userManService;
|
||||
|
||||
@Autowired
|
||||
public UserSyncService(UserDao userDao, UserInfoService userInfoService, UserRoleService userRoleService,
|
||||
UserServiceTypeService userServiceTypeService, UserBusinessService userBusinessService,
|
||||
UserManService userManService) {
|
||||
this.userDao = userDao;
|
||||
this.userInfoService = userInfoService;
|
||||
this.userRoleService = userRoleService;
|
||||
this.userServiceTypeService = userServiceTypeService;
|
||||
this.userBusinessService = userBusinessService;
|
||||
this.userManService = userManService;
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectSyncUser(String iimSchemaId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", iimSchemaId);
|
||||
return userDao.selectCompanyList(paramMap);
|
||||
}
|
||||
|
||||
public List<HashMap<String, Object>> selectDeleteSyncUser(String iimSchemaId) {
|
||||
HashMap<String, Object> paramMap = new HashMap<>();
|
||||
paramMap.put("schemaId", iimSchemaId);
|
||||
return userDao.selectDeleteCompanyList(paramMap);
|
||||
}
|
||||
|
||||
public void saveUsers(List<HashMap<String, Object>> syncInsertUserList) throws Exception {
|
||||
|
||||
Set<String> existUserIds = userInfoService.findAll().stream()
|
||||
.map(UserInfo::getUserid)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
List<HashMap<String, Object>> newUsers = syncInsertUserList.stream()
|
||||
.filter(user -> !existUserIds.contains(user.get("EMPNO").toString()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (newUsers.size() > 0) {
|
||||
saveUser(newUsers);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void deleteUsers(List<HashMap<String, Object>> syncDeleteUserList) {
|
||||
Set<String> deleteUsers = syncDeleteUserList.stream()
|
||||
.map(e -> e.get("EMPNO").toString())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (String userId : deleteUsers) {
|
||||
|
||||
try {
|
||||
|
||||
if (userInfoService.existsById(userId)) {
|
||||
userInfoService.deleteById(userId);
|
||||
}
|
||||
|
||||
userRoleService.deleteAllByUserId(userId);
|
||||
userServiceTypeService.deleteAllByUserId(userId);
|
||||
|
||||
userManService.insertUserAthrRoleChgHistory(userId, CommonConstants.CHANGE_TYPE_ROLE,
|
||||
"DELETE USER",
|
||||
CommonConstants.SYSTEM,
|
||||
"127.0.0.1");
|
||||
|
||||
} catch (Exception e) {
|
||||
logger.error("user delete failed : " + userId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/* APIGW DataSourceType */
|
||||
public void deleteBusinessUser(List<HashMap<String, Object>> syncDeleteUserList) {
|
||||
Set<String> deleteUsers = syncDeleteUserList.stream()
|
||||
.map(e -> e.get("EMPNO").toString())
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (String userId : deleteUsers) {
|
||||
// 업무 권한이 있는경우 삭제
|
||||
if (userBusinessService.existByUserId(userId)) {
|
||||
userBusinessService.deleteAllByUserId(userId);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void saveUser(List<HashMap<String, Object>> newUsers) throws Exception {
|
||||
|
||||
for (HashMap<String, Object> userInfoMap : newUsers) {
|
||||
|
||||
String userId = (String) userInfoMap.get("EMPNO");
|
||||
|
||||
UserInfo userInfo = new UserInfo();
|
||||
userInfo.setUserid(userId);
|
||||
userInfo.setUsername(userInfoMap.get("EMPY_NM").toString());
|
||||
userInfo.setPassword(Seed.encrypt(userId));
|
||||
userInfo.setRoleidnfiname(CommonConstants.DEPT_DEVELOPER);
|
||||
|
||||
userInfoService.save(userInfo);
|
||||
|
||||
UserRoleId roleId = new UserRoleId(userId, CommonConstants.DEPT_DEVELOPER);
|
||||
|
||||
if (!userRoleService.existsById(roleId)) {
|
||||
UserRole userRole = new UserRole();
|
||||
userRole.setId(roleId);
|
||||
userRoleService.save(userRole);
|
||||
}
|
||||
|
||||
UserServiceTypeId typeId = new UserServiceTypeId(userId, CommonConstants.USER_SERVICE_TYPE_APIGW);
|
||||
|
||||
if (!userServiceTypeService.existsById(typeId)) {
|
||||
UserServiceType userServiceType = new UserServiceType();
|
||||
userServiceType.setId(typeId);
|
||||
userServiceTypeService.save(userServiceType);
|
||||
}
|
||||
|
||||
userManService.insertUserAthrRoleChgHistory(userId, CommonConstants.CHANGE_TYPE_ROLE,
|
||||
"NEW USER :" + CommonConstants.DEPT_DEVELOPER,
|
||||
CommonConstants.SYSTEM,
|
||||
"127.0.0.1");
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
package com.eactive.eai.rms.common.acl.user.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserAthrRoleChgHistoryUI;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserAthrRoleChgHistory;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserAthrRoleChgHistoryUIMapper
|
||||
extends GenericMapper<UserAthrRoleChgHistoryUI, UserAthrRoleChgHistory> {
|
||||
|
||||
UserAthrRoleChgHistoryUI toVo(UserAthrRoleChgHistory entity);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.eactive.eai.rms.common.acl.user.mapper;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.mapstruct.AfterMapping;
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.entity.onl.unifbwk.UnifBwkTp;
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserBizUI;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserBizUIMapper extends GenericMapper<UserBizUI, UserBusiness> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "id.userId", target = "userId")
|
||||
@Mapping(source = "id.eaiBzwkDstcd", target = "bizCode")
|
||||
UserBizUI toVo(UserBusiness entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
UserBusiness toEntity(UserBizUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(UserBizUI userBizUI, @MappingTarget UserBusiness userBusiness);
|
||||
|
||||
@AfterMapping
|
||||
default void setSaveType(UserBizUI userBizUI, @MappingTarget UserBusiness userBusiness) {
|
||||
if (StringUtils.isBlank(userBizUI.getSaveType())) {
|
||||
userBusiness.setSaveType("R");
|
||||
}
|
||||
}
|
||||
|
||||
@Mapping(source = "eaibzwkdstcd", target = "bizCode")
|
||||
@Mapping(source = "bzwkdsticdesc", target = "bizDesc")
|
||||
@Mapping(source = "bzwkdsticname", target = "bizName")
|
||||
UserBizUI toVo(UnifBwkTp unifBwkTp);
|
||||
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
package com.eactive.eai.rms.common.acl.user.mapper;
|
||||
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserAthrRoleChgHistoryUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserLoginHistoryUI;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserAthrRoleChgHistory;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserLoginHistory;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserLoginHistoryUIMapper
|
||||
extends GenericMapper<UserLoginHistoryUI, UserLoginHistory> {
|
||||
|
||||
UserLoginHistoryUI toVo(UserLoginHistory entity);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.eactive.eai.rms.common.acl.user.mapper;
|
||||
|
||||
import com.eactive.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserUI;
|
||||
import org.mapstruct.BeanMapping;
|
||||
import org.mapstruct.InheritInverseConfiguration;
|
||||
import org.mapstruct.Mapper;
|
||||
import org.mapstruct.Mapping;
|
||||
import org.mapstruct.MappingTarget;
|
||||
import org.mapstruct.NullValuePropertyMappingStrategy;
|
||||
import org.mapstruct.ReportingPolicy;
|
||||
|
||||
import com.eactive.eai.data.mapper.GenericMapper;
|
||||
|
||||
@Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
|
||||
public interface UserUIMapper extends GenericMapper<UserUI, UserInfo> {
|
||||
|
||||
@Override
|
||||
@Mapping(source = "userid", target = "userId")
|
||||
@Mapping(source = "username", target = "userName")
|
||||
@Mapping(source = "teamname", target = "teamName")
|
||||
@Mapping(source = "lastamndyms", target = "LASTAMNDYMS")
|
||||
@Mapping(source = "secondmentbrncd", target = "SECONDMENTBRNCD")
|
||||
@Mapping(source = "secondmentstdt", target = "SECONDMENTSTDT")
|
||||
@Mapping(source = "secondmentendt", target = "SECONDMENTENDT")
|
||||
@Mapping(source = "allowip", target = "allowIp")
|
||||
UserUI toVo(UserInfo entity);
|
||||
|
||||
@Override
|
||||
@InheritInverseConfiguration
|
||||
UserInfo toEntity(UserUI vo);
|
||||
|
||||
@InheritInverseConfiguration
|
||||
@BeanMapping(nullValuePropertyMappingStrategy = NullValuePropertyMappingStrategy.IGNORE)
|
||||
void updateToEntity(UserUI userUI, @MappingTarget UserInfo userInfo);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class AdminLoginVo {
|
||||
|
||||
private String loginIp;
|
||||
|
||||
private String loginId;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserAthrRoleChgHistoryUI {
|
||||
|
||||
private int chgLogId;
|
||||
|
||||
private String userId;
|
||||
|
||||
private String chgGb;
|
||||
|
||||
private String chgDtl;
|
||||
|
||||
private String amdrId;
|
||||
|
||||
private String cctnIp;
|
||||
|
||||
private String chgGbName;
|
||||
|
||||
@JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYY_MM_DD_HH_MM_SS_19)
|
||||
private LocalDateTime crtnDttm;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserBizUI {
|
||||
|
||||
private String userId;
|
||||
|
||||
@JsonProperty("BIZCODE")
|
||||
private String bizCode;
|
||||
|
||||
@JsonProperty("BIZNAME")
|
||||
private String bizName;
|
||||
|
||||
@JsonProperty("BIZDESC")
|
||||
private String bizDesc;
|
||||
|
||||
@JsonProperty("SAVETYPE")
|
||||
private String saveType;
|
||||
|
||||
private String searchBzwkName;
|
||||
|
||||
private String targetGridYn;
|
||||
|
||||
@JsonProperty("CHK")
|
||||
private String chk;
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserLoginHistoryUI {
|
||||
|
||||
private int loginLogId;
|
||||
|
||||
private String userId;
|
||||
|
||||
@JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYY_MM_DD_HH_MM_SS_19)
|
||||
private LocalDateTime loginDttm;
|
||||
|
||||
private String loginIp;
|
||||
|
||||
private String username;
|
||||
|
||||
private String roleidnfiname;
|
||||
|
||||
/* search 조건 */
|
||||
private String searchStartYYYYMMDD; //2024-06-21
|
||||
|
||||
private String searchEndYYYYMMDD;
|
||||
|
||||
private String searchStartDate; //20240621
|
||||
|
||||
private String searchEndDate;
|
||||
|
||||
private String searchUserId;
|
||||
|
||||
private String searchUserName;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserRoleUI {
|
||||
|
||||
@JsonProperty("CHK")
|
||||
private String chk;
|
||||
|
||||
@JsonProperty("ROLEID")
|
||||
private String roleId;
|
||||
|
||||
@JsonProperty("ROLENAME")
|
||||
private String roleName;
|
||||
|
||||
@JsonProperty("ROLEDESC")
|
||||
private String roleDesc;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserServicetypeUI {
|
||||
|
||||
@JsonProperty("NAME")
|
||||
private String useServiceType;
|
||||
|
||||
@JsonProperty("DESC")
|
||||
private String desc;
|
||||
|
||||
@JsonProperty("CHK")
|
||||
private String chk;
|
||||
|
||||
private String targetGridYn;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Size;
|
||||
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import com.eactive.eai.data.converter.LocalDateTimeFormatters;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserUI {
|
||||
|
||||
@JsonProperty("USERID")
|
||||
@NotNull
|
||||
@Size(min = 1, max = 20)
|
||||
private String userId;
|
||||
|
||||
@JsonProperty("USERNAME")
|
||||
private String userName;
|
||||
|
||||
@JsonProperty("JOBCLCD")
|
||||
private String jobclcd;
|
||||
|
||||
@JsonProperty("ROLEIDNFINAME")
|
||||
private String roleidnfiname;
|
||||
|
||||
@JsonProperty("DVSNNAME")
|
||||
private String dvsnname; // 부서명
|
||||
|
||||
@JsonProperty("TEAMNAME")
|
||||
private String teamName; // 팀명
|
||||
|
||||
@JsonProperty("JOBTLNAME")
|
||||
private String jobtlname; // 직위명
|
||||
|
||||
@JsonProperty("PAFIARINFOBRNCD")
|
||||
private String pafiarinfobrncd; // 부점코드
|
||||
|
||||
@JsonProperty("INTNLOUTSRCDSTICNAME")
|
||||
private String intnloutsrcdsticname; // 내부외주구분명
|
||||
|
||||
@JsonProperty("CPHNNO")
|
||||
private String cphnno; // 휴대폰번호
|
||||
|
||||
@JsonProperty("OFCTELNO")
|
||||
private String ofctelno; // 전화번호
|
||||
|
||||
@JsonProperty("EMAD")
|
||||
private String emad; // 이메일주소
|
||||
|
||||
@JsonProperty("EAIGROUPCODSTCD")
|
||||
private String eaigroupcodstcd; // EAI그룹회사코드
|
||||
|
||||
@JsonProperty("SPOTPRXYEMPID")
|
||||
private String spotprxyempid; // 현장대리인ID
|
||||
|
||||
@JsonProperty("SPOTPRXYNAME")
|
||||
private String spotprxyname; // 현장 대리인명
|
||||
|
||||
@JsonProperty("LASTAMNDYMS")
|
||||
@JsonFormat(pattern = LocalDateTimeFormatters.FORMAT_YYYYMMDDHHMMSS_14)
|
||||
@DateTimeFormat(pattern = "yyyyMMddHHmmss")
|
||||
private LocalDateTime LASTAMNDYMS; // 수정일시
|
||||
|
||||
@JsonProperty("SECONDMENTBRNCD")
|
||||
private String SECONDMENTBRNCD; // 파견부점코드
|
||||
|
||||
@JsonProperty("SECONDMENTSTDT")
|
||||
private String SECONDMENTSTDT; // 파견시작일
|
||||
|
||||
@JsonProperty("SECONDMENTENDT")
|
||||
private String SECONDMENTENDT; // 파견종료일
|
||||
|
||||
@JsonProperty("ALLOWIP")
|
||||
private String allowIp; // 접속허용IP
|
||||
|
||||
@JsonProperty("STATUS")
|
||||
private String status; // 사용자계정상태
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.eactive.eai.rms.common.acl.user.ui;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserUISearch {
|
||||
|
||||
private String searchUserId;
|
||||
|
||||
private String searchUserName;
|
||||
|
||||
private String searchRoleName;
|
||||
|
||||
// private String searchDepart;
|
||||
//
|
||||
// private String searchTeamName;
|
||||
//
|
||||
// private String searchPosition;
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.eactive.eai.rms.common.acl.user.util;
|
||||
|
||||
public class UserRegistResponseVo {
|
||||
|
||||
private boolean registered;
|
||||
private String userId;
|
||||
private String userName;
|
||||
private String message;
|
||||
|
||||
public boolean isRegistered() {
|
||||
return registered;
|
||||
}
|
||||
|
||||
public void setRegistered(boolean registered) {
|
||||
this.registered = registered;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "UserRegistResponseVo [registered=" + registered + ", userId=" + userId + ", userName=" + userName
|
||||
+ ", message=" + message + "]";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.eactive.eai.rms.common.acl.user.util;
|
||||
|
||||
import com.eactive.eai.rms.common.acl.user.ui.AdminLoginVo;
|
||||
import com.eactive.eai.rms.common.base.BaseAnnotationController;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.common.login.SessionManager;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Controller
|
||||
public class UserRegistUtilController extends BaseAnnotationController {
|
||||
|
||||
@Autowired
|
||||
private UserRegistUtilService userRegistUtilService;
|
||||
|
||||
private final ObjectMapper mapper = new ObjectMapper();
|
||||
|
||||
@GetMapping(value = "/common/acl/user/userRegistUtil.view")
|
||||
public String viewList() {
|
||||
return "/common/acl/user/userRegistUtil";
|
||||
}
|
||||
|
||||
@PostMapping(value = "/common/acl/user/userRegistUtil.json", params = "cmd=DATASOURCE")
|
||||
public ResponseEntity<Map<String, Object>> selectCombo() throws Exception {
|
||||
|
||||
List<DataSourceType> listDataSource = DataSourceTypeManager.getDynamicDataSourceTypes();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
List<Map<String, String>> datasourceList = new ArrayList<Map<String, String>>();
|
||||
|
||||
listDataSource.stream().forEach(dataSource -> {
|
||||
Map<String, String> insMap = new HashMap<>();
|
||||
insMap.put("DATASOURCE", dataSource.getName());
|
||||
datasourceList.add(insMap);
|
||||
});
|
||||
|
||||
resultMap.put("dataSourceList", datasourceList);
|
||||
|
||||
return ResponseEntity.ok(resultMap);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/common/acl/user/userRegistUtil.json", params = "cmd=INSERT")
|
||||
public ModelAndView regist(HttpServletRequest request, @RequestParam("userList") String userList) throws Exception {
|
||||
|
||||
HashMap<String, String>[] userMapList = mapper.readValue(userList, HashMap[].class);
|
||||
|
||||
List<UserRegistResponseVo> responseMessageList = userRegistUtilService.registUser(userMapList, getAdminLoginVo(request));
|
||||
|
||||
Map resultMap = new HashMap<>();
|
||||
resultMap.put("responseMessageList", responseMessageList);
|
||||
|
||||
ModelAndView modelAndView = new ModelAndView("jsonView", resultMap);
|
||||
return modelAndView;
|
||||
}
|
||||
|
||||
private AdminLoginVo getAdminLoginVo(HttpServletRequest request) {
|
||||
AdminLoginVo adminLoginVo = new AdminLoginVo();
|
||||
adminLoginVo.setLoginIp(request.getRemoteAddr());
|
||||
adminLoginVo.setLoginId(SessionManager.getUserId(request));
|
||||
|
||||
return adminLoginVo;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,157 @@
|
||||
package com.eactive.eai.rms.common.acl.user.util;
|
||||
|
||||
import com.eactive.apim.portal.user.entity.UserInfo;
|
||||
import com.eactive.eai.rms.common.acl.user.UserManService;
|
||||
import com.eactive.eai.rms.common.acl.user.mapper.UserBizUIMapper;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.AdminLoginVo;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserBizUI;
|
||||
import com.eactive.eai.rms.common.acl.user.ui.UserUI;
|
||||
import com.eactive.eai.rms.common.base.BaseService;
|
||||
import com.eactive.eai.rms.common.combo.IbatisComboService;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceContextHolder;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceType;
|
||||
import com.eactive.eai.rms.common.datasource.DataSourceTypeManager;
|
||||
import com.eactive.eai.rms.data.entity.man.user.UserInfoService;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusiness;
|
||||
import com.eactive.eai.rms.data.entity.onl.bzwkdstcd.UserBusinessService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@Transactional(transactionManager = "transactionManagerForEMS")
|
||||
@RequiredArgsConstructor
|
||||
public class UserRegistUtilService extends BaseService {
|
||||
|
||||
private final UserInfoService userInfoService;
|
||||
private final UserManService userManService;
|
||||
private final UserBusinessService userBusinessService;
|
||||
private final IbatisComboService ibatisComboService;
|
||||
private final UserBizUIMapper userBizUIMapper;
|
||||
|
||||
public List<UserRegistResponseVo> registUser(HashMap<String, String>[] userList, AdminLoginVo adminLoginVo)
|
||||
throws Exception {
|
||||
|
||||
List<UserRegistResponseVo> responseList = new ArrayList<>();
|
||||
List<DataSourceType> datasourceList = DataSourceTypeManager.getDynamicDataSourceTypes();
|
||||
|
||||
for (HashMap<String, String> userFromView : userList) {
|
||||
final UserUI userUIFromView = mapToUserUI(userFromView);
|
||||
final String userId = userUIFromView.getUserId();
|
||||
UserRegistResponseVo userRegistResponseVo = new UserRegistResponseVo();
|
||||
try {
|
||||
|
||||
Optional<UserInfo> userFromDB = userInfoService.findById(userId);
|
||||
|
||||
// INSERT USER (RM02)
|
||||
if (!userFromDB.isPresent()) { // 신규 등록 User
|
||||
userManService.insert(userUIFromView, adminLoginVo);
|
||||
} else {
|
||||
if (!userFromDB.get().getUsername().equals(userFromView.get("userName"))) {
|
||||
throw new Exception("타 사용자 기등록 오류");
|
||||
}
|
||||
}
|
||||
|
||||
// INSERT BIZCODE TO USER (RM06)
|
||||
for (DataSourceType datasource : datasourceList) {
|
||||
if (datasource.getName().contains("GW")) { // FIXME: how to handle GW?
|
||||
continue;
|
||||
}
|
||||
DataSourceContextHolder.setDataSourceType(datasource);
|
||||
|
||||
if ("ALL".equals(userFromView.get("bzwkCdList"))) {
|
||||
// FIXME: ibatis -> jpaComboService
|
||||
List<Map<String, Object>> allBizList = ibatisComboService.selectListComboForTable("TSEAICM01", "EAIBZWKDSTCD", "BZWKDSTICNAME", "", "EAIBZWKDSTCD");
|
||||
List<UserBizUI> allBizUI = mapAllBizListToUserBizUI(userId, allBizList);
|
||||
List<UserBusiness> bizEntityList = allBizUI.stream().map(userBizUIMapper::toEntity).filter(entity -> !userBusinessService.existsById(entity.getId())).collect(Collectors.toList());
|
||||
userBusinessService.saveAll(bizEntityList);
|
||||
} else {
|
||||
|
||||
String[] split = userFromView.get("bzwkCdList").split(",");
|
||||
List<UserBizUI> listUserRoleUI =
|
||||
Arrays.stream(split)
|
||||
.filter(StringUtils::isNotBlank)
|
||||
.map(bizCode -> mapToUserBizUI(userId, bizCode)).collect(Collectors.toList());
|
||||
|
||||
if (listUserRoleUI.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
List<UserBusiness> bizEntityList = listUserRoleUI.stream().map(userBizUIMapper::toEntity).filter(entity -> !userBusinessService.existsById(entity.getId())).collect(Collectors.toList());
|
||||
userBusinessService.saveAll(bizEntityList);
|
||||
}
|
||||
}
|
||||
|
||||
userRegistResponseVo.setMessage(successMessage(userFromView));
|
||||
responseList.add(userRegistResponseVo);
|
||||
|
||||
} catch (Exception e) {
|
||||
userRegistResponseVo.setMessage(failMessage(userFromView, e));
|
||||
responseList.add(userRegistResponseVo);
|
||||
logger.debug("Not Registered User : " + userRegistResponseVo);
|
||||
}
|
||||
}
|
||||
|
||||
return responseList;
|
||||
}
|
||||
|
||||
private UserUI mapToUserUI(Map<String, String> userFromView) {
|
||||
UserUI userUI = new UserUI();
|
||||
userUI.setUserId(userFromView.get("userId"));
|
||||
userUI.setTeamName(userFromView.get("teamName"));
|
||||
userUI.setUserName(userFromView.get("userName"));
|
||||
userUI.setDvsnname(userFromView.get("teamName"));
|
||||
userUI.setJobtlname(" ");
|
||||
return userUI;
|
||||
}
|
||||
|
||||
private UserBizUI mapToUserBizUI(String userId, String bizCode) {
|
||||
UserBizUI userBizUI = new UserBizUI();
|
||||
userBizUI.setUserId(userId);
|
||||
userBizUI.setBizCode(bizCode);
|
||||
userBizUI.setChk("true");
|
||||
return userBizUI;
|
||||
}
|
||||
|
||||
private List<UserBizUI> mapAllBizListToUserBizUI(String userId, List<Map<String, Object>> allBizList) {
|
||||
List<UserBizUI> listUserRoleUI = new ArrayList<>();
|
||||
for (Map<String, Object> biz : allBizList) {
|
||||
UserBizUI userBizUI = new UserBizUI();
|
||||
userBizUI.setUserId(userId);
|
||||
userBizUI.setBizCode(biz.get("CODE").toString());
|
||||
userBizUI.setBizName(biz.get("NAME").toString());
|
||||
userBizUI.setSaveType("R");
|
||||
userBizUI.setChk("true");
|
||||
listUserRoleUI.add(userBizUI);
|
||||
}
|
||||
return listUserRoleUI;
|
||||
}
|
||||
|
||||
private String failMessage(HashMap<String, String> user, Exception exception) {
|
||||
|
||||
String userId = user.get("userId");
|
||||
String userName = user.get("userName");
|
||||
String teamName = user.get("teamName");
|
||||
String bzwkCdList = user.get("bzwkCdList");
|
||||
String message = exception.getMessage();
|
||||
|
||||
return new StringBuilder().append(userId).append(" ").append(teamName).append(" ").append(userName)
|
||||
.append(" - 사용자 등록 실패 : ").append(message).toString();
|
||||
}
|
||||
|
||||
private String successMessage(HashMap<String, String> user) {
|
||||
|
||||
String userId = user.get("userId");
|
||||
String userName = user.get("userName");
|
||||
String teamName = user.get("teamName");
|
||||
String bzwkCdList = user.get("bzwkCdList");
|
||||
|
||||
return new StringBuilder().append(userId).append(" ").append(teamName).append(" ").append(userName)
|
||||
.append(" - 신규 사용자 등록 및 어플리케이션 코드 ").append(bzwkCdList).append(" 적용").toString();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user