package com.inspect.metadata.patrolpointmnt.domain.vo;

import com.inspect.base.core.constant.Tags;
import com.inspect.metadata.patrolpointmnt.domain.BasedataPatrolPoint;
import com.inspect.common.security.utils.DictUtils;
import com.inspect.system.base.domain.SysDictData;

import java.util.List;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;

public class MonitorVo extends BasedataPatrolPoint {
    private final String DEFAULT_PURPOSE = "数据分析,在线监视";

    public void setAlgSubtypeId(String algSubtypeId) {
        if (!StringUtils.isEmpty("数据分析,在线监视")) {
            List<SysDictData> dicts = DictUtils.getDictCache(Tags.DEFECT_TYPE);
            List collect = dicts.stream().filter((item) -> String.valueOf(item.getDictSort()).equals(algSubtypeId)).collect(Collectors.toList());
            if (!collect.isEmpty()) {
                super.setAlgSubtypeId(((SysDictData) collect.get(0)).getDictLabel());
            }
        }

    }

    public void setPurpose(String purpose) {
        if (StringUtils.isEmpty(purpose)) {
            super.setPurpose("数据分析,在线监视");
        } else {
            super.setPurpose(purpose);
        }

    }
}
