package com.xdap.self_development.utils;

import com.xdap.self_development.domain.pojo.ParameterPojo;

import java.util.List;

public class ParameterUtils {

    private static final String DEPT_ZHONGQING = "中轻动力平台部";
    private static final String DEPT_ZHONGZHONG = "中重动力平台部";
    private static final String DEPT_MERGED = "中轻动力平台部或中重动力平台部";

    private ParameterUtils() {
        throw new AssertionError("禁止实例化工具类 ParameterUtils");
    }

    public static void normalizeDepartment(ParameterPojo parameter) {
        if (parameter == null) {
            return;
        }
        String dept = parameter.getDepartment();
        if (DEPT_ZHONGQING.equals(dept) || DEPT_ZHONGZHONG.equals(dept)) {
            parameter.setDepartment(DEPT_MERGED);
        }
    }

    public static void normalizeDepartment(List<ParameterPojo> parameters) {
        if (parameters == null || parameters.isEmpty()) {
            return;
        }
        for (ParameterPojo parameter : parameters) {
            normalizeDepartment(parameter);
        }
    }
}
