Search in sources :

Example 1 with RuleMetricResponse

use of com.webank.wedatasphere.qualitis.response.RuleMetricResponse in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method modifyRuleMetricReal.

private GeneralResponse<RuleMetricResponse> modifyRuleMetricReal(ModifyRuleMetricRequest request, String userName) throws UnExpectedRequestException, PermissionDeniedRequestException {
    if (request == null) {
        throw new UnExpectedRequestException("{&REQUEST_CAN_NOT_BE_NULL}");
    }
    // Check rule metric existence.
    RuleMetric ruleMetricInDb = ruleMetricDao.findById(request.getId());
    if (ruleMetricInDb == null) {
        throw new UnExpectedRequestException("Rule Metric [ID=" + request.getId() + "] {&DOES_NOT_EXIST}");
    }
    LOGGER.info("Start to modify rule metric, modify request: [{}], user: [{}]", request.toString(), userName);
    if (!ruleMetricInDb.getName().equals(request.getName())) {
        checkDuplicateName(request.getName());
    }
    if (!ruleMetricInDb.getEnCode().equals(request.getEnCode())) {
        checkDuplicateCode(request.getEnCode());
    }
    User loginUser = userDao.findByUsername(userName);
    List<UserRole> userRoles = userRoleDao.findByUser(loginUser);
    Integer roleType = roleService.getRoleType(userRoles);
    if (roleType.equals(RoleDefaultTypeEnum.ADMIN.getCode())) {
        LOGGER.info("First level(created by SYS_ADMIN) indicator will be modified soon.");
    } else if (roleType.equals(RoleDefaultTypeEnum.DEPARTMENT_ADMIN.getCode())) {
        LOGGER.info("Second level(created by DEPARTMENT_ADMIN) indicator will be modified soon.");
        if (ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.DEFAULT_METRIC.getCode())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
        List<Department> managedDepartment = new ArrayList<>();
        for (UserRole userRole : userRoles) {
            Department department = userRole.getRole().getDepartment();
            if (department != null) {
                managedDepartment.add(department);
            }
        }
        RuleMetricDepartmentUser ruleMetricDepartmentUser = ruleMetricDepartmentUserDao.findByRuleMetric(ruleMetricInDb);
        if (ruleMetricDepartmentUser != null && managedDepartment.contains(ruleMetricDepartmentUser.getDepartment())) {
            LOGGER.info("Rule metric[{}]", ruleMetricInDb.toString());
        } else {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    } else {
        LOGGER.info("Third level(created by PROJECTOR) indicator will be modified soon.");
        if (!ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.PERSONAL_METRIC.getCode()) || !ruleMetricInDb.getCreateUser().equals(loginUser.getUserName())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    }
    Integer bussCode = request.getBussCode();
    ruleMetricInDb.setName(request.getName());
    ruleMetricInDb.setCnName(request.getCnName());
    ruleMetricInDb.setMetricDesc(request.getDesc());
    ruleMetricInDb.setBussCode(bussCode);
    if (RuleMetricBussCodeEnum.SUBSYSTEM.getCode().equals(bussCode)) {
        ruleMetricInDb.setSubSystemName(request.getSubSystemName());
        ruleMetricInDb.setFullCnName(request.getFullCnName());
        // Empty them
        ruleMetricInDb.setBussCustom("");
        ruleMetricInDb.setProductName("");
    } else if (RuleMetricBussCodeEnum.PRODUCT.getCode().equals(bussCode)) {
        ruleMetricInDb.setProductName(request.getProductName());
        ruleMetricInDb.setSubSystemName("");
        ruleMetricInDb.setFullCnName("");
        ruleMetricInDb.setBussCustom("");
    } else if (RuleMetricBussCodeEnum.CUSTOM.getCode().equals(bussCode)) {
        ruleMetricInDb.setBussCustom(request.getBussCustom());
        ruleMetricInDb.setProductName("");
        ruleMetricInDb.setSubSystemName("");
        ruleMetricInDb.setFullCnName("");
    }
    ruleMetricInDb.setModifyUser(userName);
    ruleMetricInDb.setModifyTime(ExecutionManagerImpl.PRINT_TIME_FORMAT.format(new Date()));
    ruleMetricInDb.setType(request.getType());
    ruleMetricInDb.setEnCode(request.getEnCode());
    ruleMetricInDb.setFrequency(request.getFrequency());
    ruleMetricInDb.setDepartmentName(request.getDepartmentName());
    ruleMetricInDb.setDevDepartmentName(request.getDevDepartmentName());
    ruleMetricInDb.setOpsDepartmentName(request.getOpsDepartmentName());
    ruleMetricInDb.setAvailable(request.getAvailable());
    RuleMetricResponse response = new RuleMetricResponse(ruleMetricDao.add(ruleMetricInDb));
    return new GeneralResponse<>("200", "{&MODIFY_RULE_METRIC_SUCCESSFULLY}", response);
}
Also used : ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) User(com.webank.wedatasphere.qualitis.entity.User) Date(java.util.Date) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Department(com.webank.wedatasphere.qualitis.entity.Department) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) List(java.util.List) ArrayList(java.util.ArrayList)

Example 2 with RuleMetricResponse

use of com.webank.wedatasphere.qualitis.response.RuleMetricResponse in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method addRuleMetricReal.

private GeneralResponse<RuleMetricResponse> addRuleMetricReal(AddRuleMetricRequest request, String userName) throws UnExpectedRequestException {
    checkDuplicateName(request.getName());
    checkDuplicateCode(request.getEnCode());
    LOGGER.info("Start to add rule metric, add request: [{}], user: [{}]", request.toString(), userName);
    User loginUser = userDao.findByUsername(userName);
    List<UserRole> userRoles = userRoleDao.findByUser(loginUser);
    Integer roleType = roleService.getRoleType(userRoles);
    RuleMetric newRuleMetric = new RuleMetric(request.getName(), request.getCnName(), request.getDesc(), request.getSubSystemName(), request.getFullCnName(), request.getProductName(), request.getDepartmentName(), request.getDevDepartmentName(), request.getOpsDepartmentName(), request.getType(), request.getEnCode(), request.getFrequency(), request.getAvailable(), request.getBussCode(), request.getBussCustom());
    newRuleMetric.setCreateUser(userName);
    newRuleMetric.setCreateTime(ExecutionManagerImpl.PRINT_TIME_FORMAT.format(new Date()));
    RuleMetric savedRuleMetric = ruleMetricDao.add(newRuleMetric);
    if (roleType.equals(RoleDefaultTypeEnum.ADMIN.getCode())) {
        LOGGER.info("First level(created by SYS_ADMIN) indicator will be created soon.");
        savedRuleMetric.setLevel(RuleMetricLevelEnum.DEFAULT_METRIC.getCode());
    } else if (roleType.equals(RoleDefaultTypeEnum.DEPARTMENT_ADMIN.getCode())) {
        LOGGER.info("Second level(created by DEPARTMENT_ADMIN) indicator will be created soon.");
        savedRuleMetric.setLevel(RuleMetricLevelEnum.DEPARTMENT_METRIC.getCode());
        for (UserRole temp : userRoles) {
            Department department = temp.getRole().getDepartment();
            if (department != null) {
                RuleMetricDepartmentUser ruleMetricDepartmentUser = new RuleMetricDepartmentUser();
                ruleMetricDepartmentUser.setDepartment(department);
                ruleMetricDepartmentUser.setRuleMetric(savedRuleMetric);
                ruleMetricDepartmentUserDao.add(ruleMetricDepartmentUser);
                LOGGER.info("Succeed to save rule metric department user.");
            }
        }
    } else {
        LOGGER.info("Third level(created by PROJECTOR) indicator will be created soon.");
        savedRuleMetric.setLevel(RuleMetricLevelEnum.PERSONAL_METRIC.getCode());
        RuleMetricDepartmentUser ruleMetricDepartmentUser = new RuleMetricDepartmentUser();
        ruleMetricDepartmentUser.setDepartment(loginUser.getDepartment());
        ruleMetricDepartmentUser.setUser(loginUser);
        ruleMetricDepartmentUser.setRuleMetric(savedRuleMetric);
        ruleMetricDepartmentUserDao.add(ruleMetricDepartmentUser);
        LOGGER.info("Succeed to save rule metric department user.");
    }
    RuleMetricResponse response = new RuleMetricResponse(ruleMetricDao.add(savedRuleMetric));
    return new GeneralResponse<>("200", "{&ADD_RULE_METRIC_SUCCESSFULLY}", response);
}
Also used : ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Department(com.webank.wedatasphere.qualitis.entity.Department) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) User(com.webank.wedatasphere.qualitis.entity.User) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) Date(java.util.Date)

Example 3 with RuleMetricResponse

use of com.webank.wedatasphere.qualitis.response.RuleMetricResponse in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method getRuleMetricDetail.

@Override
public GeneralResponse<RuleMetricResponse> getRuleMetricDetail(long id) throws UnExpectedRequestException, PermissionDeniedRequestException {
    if (id <= 0) {
        throw new UnExpectedRequestException("{&REQUEST_CAN_NOT_BE_NULL}");
    }
    // Check rule metric existence.
    RuleMetric ruleMetricInDb = ruleMetricDao.findById(id);
    if (ruleMetricInDb == null) {
        throw new UnExpectedRequestException("Rule Metric ID [" + id + "] {&DOES_NOT_EXIST}");
    }
    String userName = HttpUtils.getUserName(httpServletRequest);
    LOGGER.info("Start to get rule metric, rule metric ID: [{}], user: [{}]", id, userName);
    User loginUser = userDao.findByUsername(userName);
    List<UserRole> userRoles = userRoleDao.findByUser(loginUser);
    Integer roleType = roleService.getRoleType(userRoles);
    RuleMetricDepartmentUser ruleMetricDepartmentUser = ruleMetricDepartmentUserDao.findByRuleMetric(ruleMetricInDb);
    if (roleType.equals(RoleDefaultTypeEnum.ADMIN.getCode())) {
        LOGGER.info("SYS_ADMIN will get rule metric.");
    } else if (roleType.equals(RoleDefaultTypeEnum.DEPARTMENT_ADMIN.getCode())) {
        LOGGER.info("DEPARTMENT_ADMIN will get rule metric.");
        List<Department> managedDepartment = new ArrayList<>();
        for (UserRole userRole : userRoles) {
            Department department = userRole.getRole().getDepartment();
            if (department != null) {
                managedDepartment.add(department);
            }
        }
        if (ruleMetricDepartmentUser.getDepartment() != null) {
            List<Department> res = managedDepartment.stream().filter(department -> department.getId() == ruleMetricDepartmentUser.getDepartment().getId()).collect(Collectors.toList());
            if (res.size() > 0) {
                LOGGER.info("Rule metric[{}] comes from department: {}", ruleMetricInDb.toString(), ruleMetricDepartmentUser.getDepartment().getName());
            } else {
                throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
            }
        } else if (ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.DEFAULT_METRIC.getCode())) {
            LOGGER.info("DEPARTMENT_ADMIN will get first level rule metric.");
        } else {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    } else {
        LOGGER.info("PROJECTOR will get rule metric.");
        Department department = loginUser.getDepartment();
        if (ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.DEPARTMENT_METRIC) && !department.equals(ruleMetricDepartmentUser.getDepartment())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
        if (ruleMetricInDb.getLevel().equals(RuleMetricLevelEnum.PERSONAL_METRIC) && !loginUser.equals(ruleMetricDepartmentUser.getUser())) {
            throw new PermissionDeniedRequestException("User {&HAS_NO_PERMISSION_TO_ACCESS}", 403);
        }
    }
    RuleMetricResponse ruleMetricResponse = new RuleMetricResponse(ruleMetricInDb);
    return new GeneralResponse<>("200", "{&GET_RULE_METRIC_SUCCESSFULLY}", ruleMetricResponse);
}
Also used : ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) User(com.webank.wedatasphere.qualitis.entity.User) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Department(com.webank.wedatasphere.qualitis.entity.Department) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) List(java.util.List) ArrayList(java.util.ArrayList)

Example 4 with RuleMetricResponse

use of com.webank.wedatasphere.qualitis.response.RuleMetricResponse in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method queryRuleMetric.

@Override
public GeneralResponse<GetAllResponse<RuleMetricResponse>> queryRuleMetric(RuleMetricQueryRequest request) throws UnExpectedRequestException {
    CommonChecker.checkObject(request, "Rule Metric query request");
    if (StringUtils.isBlank(request.getSubSystemName())) {
        request.setSubSystemName("");
    }
    if (StringUtils.isBlank(request.getRuleMetricName())) {
        request.setRuleMetricName("%");
    } else {
        request.setRuleMetricName("%" + request.getRuleMetricName() + "%");
    }
    String userName = HttpUtils.getUserName(httpServletRequest);
    LOGGER.info("Start to get all rule metric, page request: [{}], user: [{}]", request.toString(), userName);
    User loginUser = userDao.findByUsername(userName);
    List<UserRole> userRoles = userRoleDao.findByUser(loginUser);
    Integer roleType = roleService.getRoleType(userRoles);
    List<RuleMetric> ruleMetrics = new ArrayList<>();
    long total = 0;
    if (roleType.equals(RoleDefaultTypeEnum.ADMIN.getCode())) {
        LOGGER.info("SYS_ADMIN will get all rule metrics in query.");
        ruleMetrics.addAll(ruleMetricDao.queryAllRuleMetrics(request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable(), request.getPage(), request.getSize()));
        total = ruleMetricDao.countQueryAllRuleMetrics(request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable());
    } else if (roleType.equals(RoleDefaultTypeEnum.DEPARTMENT_ADMIN.getCode())) {
        LOGGER.info("DEPARTMENT_ADMIN will get rule metrics of all management departments and all projectors.");
        List<Department> departments = new ArrayList<>();
        for (UserRole temp : userRoles) {
            Department department = temp.getRole().getDepartment();
            if (department != null) {
                departments.add(department);
            }
        }
        ruleMetrics.addAll(ruleMetricDao.queryRuleMetrics(RuleMetricLevelEnum.DEFAULT_METRIC.getCode(), departments, null, request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable(), request.getPage(), request.getSize()));
        total = ruleMetricDao.countQueryRuleMetrics(RuleMetricLevelEnum.DEFAULT_METRIC.getCode(), departments, null, request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable());
    } else {
        LOGGER.info("PROJECTOR  will get rule metrics of department and own.");
        List<Department> departments = new ArrayList<>();
        departments.add(loginUser.getDepartment());
        ruleMetrics.addAll(ruleMetricDao.queryRuleMetrics(RuleMetricLevelEnum.DEFAULT_METRIC.getCode(), departments, loginUser, request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable(), request.getPage(), request.getSize()));
        total = ruleMetricDao.countQueryRuleMetrics(RuleMetricLevelEnum.DEFAULT_METRIC.getCode(), departments, loginUser, request.getSubSystemName(), request.getRuleMetricName(), request.getEnCode(), request.getType(), request.getAvailable());
    }
    GetAllResponse<RuleMetricResponse> response = new GetAllResponse<>();
    List<RuleMetricResponse> ruleMetricResponses = new ArrayList<>();
    for (RuleMetric ruleMetric : ruleMetrics) {
        ruleMetricResponses.add(new RuleMetricResponse(ruleMetric));
    }
    response.setData(ruleMetricResponses);
    response.setTotal(total);
    return new GeneralResponse<>("200", "{&RULE_METRIC_QUERY_SUCCESS}", response);
}
Also used : ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) User(com.webank.wedatasphere.qualitis.entity.User) ArrayList(java.util.ArrayList) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Department(com.webank.wedatasphere.qualitis.entity.Department) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) List(java.util.List) ArrayList(java.util.ArrayList) GetAllResponse(com.webank.wedatasphere.qualitis.response.GetAllResponse)

Example 5 with RuleMetricResponse

use of com.webank.wedatasphere.qualitis.response.RuleMetricResponse in project Qualitis by WeBankFinTech.

the class RuleMetricServiceImpl method download.

@Override
public GeneralResponse<?> download(DownloadRuleMetricRequest request, HttpServletResponse response) throws UnExpectedRequestException, IOException, WriteExcelException, PermissionDeniedRequestException {
    // Check rule metric IDs permission.
    PageRequest pageRequest = new PageRequest(0, Integer.MAX_VALUE);
    List<RuleMetricResponse> ownRuleMetric = getAllRuleMetric(pageRequest).getData().getData().stream().collect(Collectors.toList());
    if (ownRuleMetric.size() <= 0 || ownRuleMetric.size() >= MAX_RULE_METRIC_COUNT) {
        throw new UnExpectedRequestException("The number of metrics is illegal");
    }
    List<Long> downloadIds = request.getRuleMetricIds();
    List<Long> ownIds = ownRuleMetric.stream().map(RuleMetricResponse::getId).collect(Collectors.toList());
    if (ownIds.containsAll(downloadIds)) {
        List<RuleMetricResponse> downloadRuleMetric = ownRuleMetric.stream().filter(ruleMetricResponse -> downloadIds.contains(ruleMetricResponse.getId())).collect(Collectors.toList());
        List<ExcelRuleMetric> excelRuleMetrics = new ArrayList<>(downloadRuleMetric.size());
        for (RuleMetricResponse ruleMetricResponse : downloadRuleMetric) {
            ExcelRuleMetric excelRuleMetric = new ExcelRuleMetric();
            excelRuleMetric.setName(ruleMetricResponse.getName());
            excelRuleMetric.setChName(ruleMetricResponse.getCnName());
            excelRuleMetric.setMetricDesc(ruleMetricResponse.getMetricDesc());
            int bussCode = ruleMetricResponse.getBussCode();
            excelRuleMetric.setDimension(bussCode + "");
            if (RuleMetricBussCodeEnum.SUBSYSTEM.getCode().equals(bussCode)) {
                excelRuleMetric.setFullCnName(ruleMetricResponse.getFullCnName());
                excelRuleMetric.setSubSystemName(ruleMetricResponse.getSubSystemName());
                excelRuleMetric.setSubSystemId(String.valueOf(ruleMetricResponse.getSubSystemId()));
            } else if (RuleMetricBussCodeEnum.PRODUCT.getCode().equals(bussCode)) {
                excelRuleMetric.setProductId(ruleMetricResponse.getProductId());
                excelRuleMetric.setProductName(ruleMetricResponse.getProductName());
            } else if (RuleMetricBussCodeEnum.CUSTOM.getCode().equals(bussCode)) {
                excelRuleMetric.setBussCustom(ruleMetricResponse.getBussCustom());
            }
            excelRuleMetric.setFrequency(String.valueOf(ruleMetricResponse.getFrequency()));
            excelRuleMetric.setDevDepartmentName(ruleMetricResponse.getDevDepartmentName());
            excelRuleMetric.setOpsDepartmentName(ruleMetricResponse.getOpsDepartmentName());
            excelRuleMetric.setDepartmentCode(ruleMetricResponse.getDepartmentCode());
            excelRuleMetric.setDepartmentName(ruleMetricResponse.getDepartmentName());
            excelRuleMetric.setAvailable(ruleMetricResponse.getAvailable());
            excelRuleMetric.setEnCode(ruleMetricResponse.getEnCode());
            excelRuleMetric.setType(ruleMetricResponse.getType());
            excelRuleMetrics.add(excelRuleMetric);
        }
        String fileName = "batch_metrics_export_" + FILE_DATE_FORMATTER.format(new Date());
        fileName = URLEncoder.encode(fileName, "UTF-8");
        response.setContentType("application/octet-stream");
        response.addHeader("Content-Disposition", "attachment;filename*=UTF-8''" + fileName);
        response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
        OutputStream outputStream = response.getOutputStream();
        writeExcelToOutput(excelRuleMetrics, outputStream);
        outputStream.flush();
    } else {
        throw new PermissionDeniedRequestException("HAS_NO_PERMISSION_TO_ACCESS", 403);
    }
    LOGGER.info("Succeed to download all rule metrics in type of excel");
    return null;
}
Also used : StringUtils(org.apache.commons.lang.StringUtils) FormDataContentDisposition(org.glassfish.jersey.media.multipart.FormDataContentDisposition) Date(java.util.Date) LoggerFactory(org.slf4j.LoggerFactory) Autowired(org.springframework.beans.factory.annotation.Autowired) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) HiveRuleDetail(com.webank.wedatasphere.qualitis.project.response.HiveRuleDetail) RuleMetricValueResponse(com.webank.wedatasphere.qualitis.response.RuleMetricValueResponse) GeneralResponse(com.webank.wedatasphere.qualitis.response.GeneralResponse) AlarmConfig(com.webank.wedatasphere.qualitis.rule.entity.AlarmConfig) RuleMetricDao(com.webank.wedatasphere.qualitis.dao.RuleMetricDao) HttpUtils(com.webank.wedatasphere.qualitis.util.HttpUtils) GetAllResponse(com.webank.wedatasphere.qualitis.response.GetAllResponse) RuleMetricBussCodeEnum(com.webank.wedatasphere.qualitis.constant.RuleMetricBussCodeEnum) Context(javax.ws.rs.core.Context) ExcelReader(com.alibaba.excel.ExcelReader) PageRequest(com.webank.wedatasphere.qualitis.request.PageRequest) ModifyRuleMetricRequest(com.webank.wedatasphere.qualitis.request.ModifyRuleMetricRequest) Department(com.webank.wedatasphere.qualitis.entity.Department) Set(java.util.Set) RuleMetricDepartmentUser(com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser) Collectors(java.util.stream.Collectors) ExecutionManagerImpl(com.webank.wedatasphere.qualitis.submitter.impl.ExecutionManagerImpl) ExcelTypeEnum(com.alibaba.excel.support.ExcelTypeEnum) List(java.util.List) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) Sheet(com.alibaba.excel.metadata.Sheet) CommonChecker(com.webank.wedatasphere.qualitis.project.request.CommonChecker) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) RoleDefaultTypeEnum(com.webank.wedatasphere.qualitis.rule.constant.RoleDefaultTypeEnum) UserRole(com.webank.wedatasphere.qualitis.entity.UserRole) FastDateFormat(org.apache.commons.lang.time.FastDateFormat) RuleMetricTypeConfigDao(com.webank.wedatasphere.qualitis.dao.RuleMetricTypeConfigDao) RuleMetricQueryRequest(com.webank.wedatasphere.qualitis.request.RuleMetricQueryRequest) UserRoleDao(com.webank.wedatasphere.qualitis.dao.UserRoleDao) Rule(com.webank.wedatasphere.qualitis.rule.entity.Rule) ArrayList(java.util.ArrayList) ExcelWriter(com.alibaba.excel.ExcelWriter) RuleMetricConditionResponse(com.webank.wedatasphere.qualitis.response.RuleMetricConditionResponse) RuleMetricLevelEnum(com.webank.wedatasphere.qualitis.constant.RuleMetricLevelEnum) HttpServletRequest(javax.servlet.http.HttpServletRequest) User(com.webank.wedatasphere.qualitis.entity.User) ExcelRuleMetricListener(com.webank.wedatasphere.qualitis.excel.ExcelRuleMetricListener) ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) CollectionUtils(org.apache.commons.collections.CollectionUtils) Propagation(org.springframework.transaction.annotation.Propagation) Service(org.springframework.stereotype.Service) RuleMetricService(com.webank.wedatasphere.qualitis.service.RuleMetricService) TaskResult(com.webank.wedatasphere.qualitis.entity.TaskResult) DownloadRuleMetricRequest(com.webank.wedatasphere.qualitis.request.DownloadRuleMetricRequest) RoleService(com.webank.wedatasphere.qualitis.service.RoleService) OutputStream(java.io.OutputStream) Logger(org.slf4j.Logger) RuleMetric(com.webank.wedatasphere.qualitis.entity.RuleMetric) HttpServletResponse(javax.servlet.http.HttpServletResponse) RuleMetricTypeConfig(com.webank.wedatasphere.qualitis.entity.RuleMetricTypeConfig) IOException(java.io.IOException) AddRuleMetricRequest(com.webank.wedatasphere.qualitis.request.AddRuleMetricRequest) DataInfo(com.webank.wedatasphere.qualitis.metadata.response.DataInfo) URLEncoder(java.net.URLEncoder) ExcelSheetName(com.webank.wedatasphere.qualitis.project.constant.ExcelSheetName) RuleDao(com.webank.wedatasphere.qualitis.rule.dao.RuleDao) RuleMetricDepartmentUserDao(com.webank.wedatasphere.qualitis.dao.RuleMetricDepartmentUserDao) UserDao(com.webank.wedatasphere.qualitis.dao.UserDao) TaskResultDao(com.webank.wedatasphere.qualitis.dao.TaskResultDao) WriteExcelException(com.webank.wedatasphere.qualitis.rule.exception.WriteExcelException) InputStream(java.io.InputStream) Transactional(org.springframework.transaction.annotation.Transactional) ExcelRuleMetric(com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric) UnExpectedRequestException(com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException) PermissionDeniedRequestException(com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException) OutputStream(java.io.OutputStream) ArrayList(java.util.ArrayList) Date(java.util.Date) RuleMetricResponse(com.webank.wedatasphere.qualitis.response.RuleMetricResponse) PageRequest(com.webank.wedatasphere.qualitis.request.PageRequest)

Aggregations

Department (com.webank.wedatasphere.qualitis.entity.Department)6 RuleMetric (com.webank.wedatasphere.qualitis.entity.RuleMetric)6 RuleMetricDepartmentUser (com.webank.wedatasphere.qualitis.entity.RuleMetricDepartmentUser)6 User (com.webank.wedatasphere.qualitis.entity.User)6 UserRole (com.webank.wedatasphere.qualitis.entity.UserRole)6 ExcelRuleMetric (com.webank.wedatasphere.qualitis.project.excel.ExcelRuleMetric)6 GeneralResponse (com.webank.wedatasphere.qualitis.response.GeneralResponse)6 RuleMetricResponse (com.webank.wedatasphere.qualitis.response.RuleMetricResponse)6 ArrayList (java.util.ArrayList)5 List (java.util.List)5 PermissionDeniedRequestException (com.webank.wedatasphere.qualitis.exception.PermissionDeniedRequestException)3 UnExpectedRequestException (com.webank.wedatasphere.qualitis.exception.UnExpectedRequestException)3 GetAllResponse (com.webank.wedatasphere.qualitis.response.GetAllResponse)3 Date (java.util.Date)2 ExcelReader (com.alibaba.excel.ExcelReader)1 ExcelWriter (com.alibaba.excel.ExcelWriter)1 Sheet (com.alibaba.excel.metadata.Sheet)1 ExcelTypeEnum (com.alibaba.excel.support.ExcelTypeEnum)1 RuleMetricBussCodeEnum (com.webank.wedatasphere.qualitis.constant.RuleMetricBussCodeEnum)1 RuleMetricLevelEnum (com.webank.wedatasphere.qualitis.constant.RuleMetricLevelEnum)1