package com.kingdee.eas.custom.compensation.handler;

import com.kingdee.bos.BOSException;
import com.kingdee.bos.Context;
import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
import com.kingdee.bos.metadata.entity.*;
import com.kingdee.bos.metadata.query.util.CompareType;
import com.kingdee.bos.metadata.resource.BizEnumInfo;
import com.kingdee.bos.sql.ParserException;
import com.kingdee.bos.util.BOSObjectType;
import com.kingdee.bos.util.BOSUuid;
import com.kingdee.eas.base.permission.UserInfo;
import com.kingdee.eas.common.EASBizException;
import com.kingdee.eas.custom.compensation.*;
import com.kingdee.eas.custom.compensation.utils.AdvancedZipUtils;
import com.kingdee.eas.custom.compensation.utils.TemplateUtil;
import com.kingdee.eas.framework.DataBaseInfo;
import com.kingdee.eas.framework.ObjectBaseInfo;
import com.kingdee.eas.hr.ats.AtsUtil;
import com.kingdee.eas.util.app.ContextUtil;
import com.kingdee.eas.util.app.DbUtil;
import com.kingdee.jdbc.rowset.IRowSet;
import com.kingdee.shr.attachment.ISHRAttachmentExt;
import com.kingdee.shr.attachment.SHRAttachmentExtCollection;
import com.kingdee.shr.attachment.SHRAttachmentExtFactory;
import com.kingdee.shr.base.syssetting.BaseItemCustom;
import com.kingdee.shr.base.syssetting.BaseItemStateEnum;
import com.kingdee.shr.base.syssetting.IBaseItemCustom;
import com.kingdee.shr.base.syssetting.app.osf.OSFAppUtil;
import com.kingdee.shr.base.syssetting.exception.SHRWebException;
import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
import com.kingdee.shr.base.syssetting.util.MetaDataUtil;
import com.kingdee.shr.base.syssetting.web.dynamic.util.DynamicUtil;
import com.kingdee.shr.base.syssetting.web.dynamic.util.MD5;
import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
import com.kingdee.shr.base.syssetting.web.util.UserUtil;
import com.kingdee.shr.compensation.app.integrate.*;
import com.kingdee.shr.compensation.web.handler.integrate.BatchSubmitShemeBillListHandler;
import com.kingdee.util.enums.DynamicEnum;
import org.apache.commons.lang3.StringUtils;
import org.springframework.ui.ModelMap;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.sql.Date;
import java.sql.SQLException;
import java.text.SimpleDateFormat;
import java.util.*;


/**
 * @Description 提报单列表
 * @Date 2025/9/16 15:49
 * @Created by 59279
 */
public class BatchSubmitShemeBillListHandlerEx extends BatchSubmitShemeBillListHandler {
    private static final Map<String, String> approveFieldMap = new HashMap<>();

    public BatchSubmitShemeBillListHandlerEx() {
        approveFieldMap.put("approveHis.multiapprove.createtime", "审批时间");
        approveFieldMap.put("approveHis.personid.name", "审批人");
        approveFieldMap.put("approveHis.assigndetail.actdefname", "任务");
        approveFieldMap.put("approveHis.multiapprove.handleropinion", "处理策略");
        approveFieldMap.put("approveHis.multiapprove.opinion", "审批意见");
    }

    /**
     * 自定义打印
     *
     * @param request
     * @param response
     * @param modelMap
     * @throws SHRWebException
     */
    public void customPrintAction(
            HttpServletRequest request,
            HttpServletResponse response,
            ModelMap modelMap
    ) throws SHRWebException {
        String billIds = request.getParameter("billIds");
        //模板id
        String submitShemeTemplateId = request.getParameter("submitShemeTemplateId");
        Context ctx = getContext();
        if (StringUtils.isBlank(billIds)) {
            throw new ShrWebBizException("单据id为空! </br> The document ID is empty!");
        }
        if (StringUtils.isBlank(submitShemeTemplateId)) {
            throw new ShrWebBizException("模板id不能为空! </br> The template ID cannot be empty!");
        }
        try {
            //查询模板
            ISubmitShemeTemplate iSubmitShemeTemplate = SubmitShemeTemplateFactory.getLocalInstance(ctx);
            SubmitShemeTemplateInfo submitShemeTemplateInfo =
                    iSubmitShemeTemplate.getSubmitShemeTemplateInfo(new ObjectUuidPK(submitShemeTemplateId));
            //提报方案
            CalSubmitSchemeInfo calSubmitScheme = submitShemeTemplateInfo.getCalSubmitScheme();
            if (calSubmitScheme == null) {
                throw new ShrWebBizException("提报方案不存在! </br> The submission plan does not exist!");
            }
            String calSubmitSchemeId = calSubmitScheme.getId().toString();
            //提报表映射关系
            ICalShemeTableRelation iCalShemeTableRelation = CalShemeTableRelationFactory.getLocalInstance(ctx);
            CalShemeTableRelationInfo calShemeTableRelationInfo = iCalShemeTableRelation.getCalShemeTableRelationInfo(
                    "where submitScheme.id ='" + calSubmitSchemeId + "'");
            //提报单据分录表名
            String billEntryTableName = calShemeTableRelationInfo.getBillEntryTableName();
            if (StringUtils.isBlank(billEntryTableName)) {
                throw new ShrWebBizException("提报单据分录表名为空! </br> The table name of the submission document entry is empty!");
            }
            //提报单据分录动态字段
            Map<String, CalSubmitItemDataType> calSubmitSchemeItemMap = getCalSubmitSchemeItemMap(ctx, calSubmitSchemeId);
            SubmitShemeTemplateEntryCollection entryCol = submitShemeTemplateInfo.getEntry();
            //获取模板字段
            Map<String, Set<String>> variables = new HashMap<String, Set<String>>();
            String billItems = submitShemeTemplateInfo.getBillProperties();
            Set<String> billProperties = new HashSet();
            if (StringUtils.isNotBlank(billItems)) {
                billProperties = AtsUtil.toSet(billItems);
            }
            String entryItems = submitShemeTemplateInfo.getEntryProperties();
            Set<String> entryProperties = new HashSet();
            if (StringUtils.isNotBlank(entryItems)) {
                entryProperties = AtsUtil.toSet(entryItems);
            }
            //
            String schemeItems = submitShemeTemplateInfo.getSchemeItems();
            Set<String> schemeItemsProperties = new HashSet();
            if (StringUtils.isNotBlank(schemeItems)) {
                schemeItemsProperties = AtsUtil.toSet(schemeItems);
            }
            //提报单查询字段
            SelectorItemCollection batchSubmitShemeBillSic = new SelectorItemCollection();
            batchSubmitShemeBillSic.decode(submitShemeTemplateInfo.getSelectItemCol());
            for (int i = 0; i < entryCol.size(); i++) {
                SubmitShemeTemplateEntryInfo entryInfo = entryCol.get(i);
                String templateField = entryInfo.getTemplateField();
                String column = entryInfo.getColumn();
                if (!variables.containsKey(column)) {
                    variables.put(column, new HashSet());
                }
                variables.get(column).add(templateField);
            }
            //获取模板附件
            byte[] file = getTemplateFile(ctx, submitShemeTemplateId);
            IBatchSubmitShemeBill iBatchSubmitShemeBill = BatchSubmitShemeBillFactory.getLocalInstance(ctx);
            FilterInfo filterInfo = new FilterInfo();
            filterInfo.getFilterItems().add(new FilterItemInfo("id", billIds, CompareType.INCLUDE));
            batchSubmitShemeBillSic.add("number");
            batchSubmitShemeBillSic.add("id");
            EntityViewInfo instance = EntityViewInfo.getInstance(filterInfo, batchSubmitShemeBillSic, null);
            BatchSubmitShemeBillCollection batchSubmitShemeBillCol = iBatchSubmitShemeBill.getBatchSubmitShemeBillCollection(instance);
            Map<String, PropertyInfo> properties = MetaDataUtil.getProperties(getContext(), new BatchSubmitShemeBill().getName());
            Map<String, PropertyInfo> entryInfoProperties = MetaDataUtil.getProperties(getContext(), new BatchSubmitShemeBillEntry().getName());
            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
            Map<String, byte[]> files = new HashMap<>();
            List billDataList = new ArrayList();
            for (int i = 0; i < batchSubmitShemeBillCol.size(); i++) {
                BatchSubmitShemeBillInfo batchSubmitShemeBillInfo = batchSubmitShemeBillCol.get(i);
                Map<String, String> billMap = new HashMap<String, String>();
                billDataList.add(billMap);
                for (String key : billProperties) {
                    String[] attr = key.split("\\.");
                    PropertyInfo propertyInfo = properties.get(attr[0]);
                    //最终值
                    String value = getFinalValue(propertyInfo, batchSubmitShemeBillInfo, attr, sdf);
                    Set<String> templateFields = variables.get(key);
                    for (String templateField : templateFields) {
                        billMap.put(templateField, value);
                    }
                }
                List entryDataList = new ArrayList();
                Set<String> entryIds = new HashSet<String>();
                Map<String, Map<String, String>> billEntryTableNameMap = new HashMap<>();
                BatchSubmitShemeBillEntryCollection entrys = batchSubmitShemeBillInfo.getEntry();
                for (int j = 0; j < entrys.size(); j++) {
                    BatchSubmitShemeBillEntryInfo entryInfo = entrys.get(j);
                    String entryId = entryInfo.getId().toString();
                    entryIds.add(entryId);
                }
                if (!schemeItemsProperties.isEmpty()) {
                    StringBuilder querySql = new StringBuilder();
                    querySql.append("select fid,")
                            .append(String.join(",", schemeItemsProperties))
                            .append(" from ")
                            .append(billEntryTableName)
                            .append(" where fid in (").append(AtsUtil.convertSetToString(entryIds)).append(")");
                    IRowSet iRowSet = DbUtil.executeQuery(ctx, querySql.toString());
                    while (iRowSet.next()) {
                        String fid = iRowSet.getString("fid");
                        Map<String, String> entryMap = new HashMap<>();
                        for (String schemeItemsProperty : schemeItemsProperties) {
                            String value = "";
                            CalSubmitItemDataType calSubmitItemDataType = calSubmitSchemeItemMap.get(schemeItemsProperty);
                            if (CalSubmitItemDataType.Date.equals(calSubmitItemDataType)) {
                                Date date = iRowSet.getDate(schemeItemsProperty);
                                if (date != null) {
                                    value = sdf.format(date);
                                }
                            } else if (CalSubmitItemDataType.number.equals(calSubmitItemDataType)) {
                                BigDecimal bigDecimal = iRowSet.getBigDecimal(schemeItemsProperty);
                                if (bigDecimal != null) {
                                    value = bigDecimal.setScale(2, 4).toPlainString();
                                }
                            } else if (CalSubmitItemDataType.F7.equals(calSubmitItemDataType)) {
                                String id = iRowSet.getString(schemeItemsProperty);
                                if (StringUtils.isNotBlank(id)) {
                                    String bosType = BOSUuid.read(id).getType().toString();
                                    IBaseItemCustom iBaseItemCustom = getBaseItemCusInterface(ctx, bosType);
                                    DataBaseInfo dataBaseInfo = iBaseItemCustom.getBaseItemCustomInfo(new ObjectUuidPK(id));
                                    value = dataBaseInfo.getName();
                                }
                            } else {
                                value = iRowSet.getString(schemeItemsProperty) == null ? "" : iRowSet.getString(schemeItemsProperty);
                            }
                            Set<String> templateFields = variables.get("schemeItem." + schemeItemsProperty);
                            for (String templateField : templateFields) {
                                entryMap.put(templateField, value);
                            }
                        }
                        billEntryTableNameMap.put(fid, entryMap);
                    }
                }
                //遍历分录,获取分录数据
                for (int j = 0; j < entrys.size(); j++) {
                    BatchSubmitShemeBillEntryInfo entryInfo = entrys.get(j);
                    Map<String, Object> entryMap = new HashMap<>();
                    //获取方案对应的表数据
                    for (String key : entryProperties) {
                        String[] attr = key.split("\\.");
                        String value = "";
                        if ("SN".equals(attr[1])) {
                            //序号,因为表格新增数据插入第一行，所以需要倒序
                            value = String.valueOf(entrys.size() - j);
                        } else {
                            //原始值
                            PropertyInfo propertyInfo = entryInfoProperties.get(attr[1]);
                            value = getFinalValue(propertyInfo, entryInfo, attr, sdf);
                        }
                        Set<String> templateFields = variables.get(key);
                        for (String templateField : templateFields) {
                            entryMap.put(templateField, value);
                        }
                    }
                    String entryId = entryInfo.getId().toString();
                    entryMap.putAll(billMap);
                    Map<String, String> billEntryTableNameData = billEntryTableNameMap.get(entryId);
                    if (billEntryTableNameData != null) {
                        entryMap.putAll(billEntryTableNameData);
                    }
                    entryDataList.add(entryMap);
                }
                List<Map<String, String>> newapproveList = new ArrayList<>();
                SimpleDateFormat dateTimeSdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
                //获取单据审批信息
                try {
                    Map<String, Object> params = new HashMap<>();
                    params.put("billId", batchSubmitShemeBillInfo.getId().toString());
                    List<Map<String, String>> approveList = (List<Map<String, String>>) OSFAppUtil.callService(ctx, "getApproveHistory", params);
                    for (int j = 0; j < approveList.size(); j++) {
                        Map<String, String> map = approveList.get(j);
                        Map<String, String> newData = new HashMap<>();
                        for (String key : approveFieldMap.keySet()) {
                            String substring = key.substring("approveHis.".length());
                            Object value = map.get(substring);
                            if ("multiapprove.createtime".equals(substring) && value != null) {
                                value = dateTimeSdf.format(value);
                            }
                            Set<String> templateFields = variables.get(key);
                            if (templateFields != null) {
                                for (String templateField : templateFields) {
                                    newData.put(templateField, value == null ? "" : value.toString());
                                }
                            }
                        }
                        newapproveList.add(newData);
                    }
                } catch (Exception e) {
                    e.printStackTrace();
                    throw new ShrWebBizException("getApprovalHistoryError : " + e.getMessage());
                }
                byte[] bytes = TemplateUtil.processWordTemplate(file, billMap, entryDataList, newapproveList);
                files.put(batchSubmitShemeBillInfo.getNumber() + ".pdf", bytes);
            }
            UserInfo currentUserInfo = ContextUtil.getCurrentUserInfo(ctx);
            String downloadZipName = System.currentTimeMillis() + "print.zip";
            //9.0以上版本 会在下载文件后面添加一个md5值
            String zipName = downloadZipName + "_" + MD5.md5Hash(currentUserInfo.getId().toString());
            String userPath = UserUtil.getUserTempDirAbsolutePath(request.getSession());
            File userPathFile = new File(userPath);
            if (!userPathFile.exists()) {
                userPathFile.mkdirs();
            }
            String zipPath = userPath + File.separator + zipName;
            //创建压缩包
            AdvancedZipUtils.createZipFromMultipleFiles(files, zipPath);
            Map<String, String> param = new HashMap<String, String>();
            param.put("method", "tmp");
            param.put("file", downloadZipName);
            param.put("filename", "reportBatchPrintAttachment.zip");
            String link = DynamicUtil.assembleUrl("/shr/downloadfile.do", param).replaceAll("\\+", "%20");
            this.writeSuccessData(link);
        } catch (BOSException e) {
            e.printStackTrace();
            throw new ShrWebBizException(e);
        } catch (EASBizException e) {
            e.printStackTrace();
            throw new ShrWebBizException(e);
        } catch (ParserException e) {
            throw new ShrWebBizException(e);
        } catch (IOException e) {
            throw new ShrWebBizException(e);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }


    /**
     * 获取自定义基础资料实例接口
     *
     * @param ctx
     * @param bosType
     * @return
     * @throws BOSException
     */
    protected IBaseItemCustom getBaseItemCusInterface(Context ctx, String bosType) throws BOSException {
        if (com.kingdee.util.StringUtils.isEmpty(bosType)) {
            throw new BOSException("bosType不能为空! </br> The bosType cannot be empty!");
        }
        BaseItemCustom baseItemCustom = new BaseItemCustom(ctx);
        baseItemCustom.setType(BOSObjectType.create(bosType));
        return baseItemCustom;
    }

    private Map<String, CalSubmitItemDataType> getCalSubmitSchemeItemMap(Context ctx, String submitSchemeId) throws SHRWebException {
        Map<String, CalSubmitItemDataType> calSubmitSchemeItemMap = new HashMap<>();
        try {
            CalSubmitSchemeItemCollection schemeItemCols = CalSubmitSchemeItemFactory.getLocalInstance(ctx).getCalSubmitSchemeItemCollection("select calSubmitItem.*,isRequired where calSubmitScheme = '" + submitSchemeId + "' and isShow = 1 and state = 1 order by sortSn asc");
            for (int j = 0; j < schemeItemCols.size(); ++j) {
                CalSubmitSchemeItemInfo calSchemeItem = schemeItemCols.get(j);
                CalSubmitItemInfo calItem = calSchemeItem.getCalSubmitItem();
                String propName = "S" + calItem.getFieldSn();
                calSubmitSchemeItemMap.put(propName, calItem.getDataType());
            }
        } catch (BOSException e) {
            throw new SHRWebException(e.getMessage(), e);
        }
        return calSubmitSchemeItemMap;
    }

    /**
     * 获取格式化后的值
     *
     * @param propertyInfo
     * @param info
     * @param attr
     * @param sdf
     * @return
     */
    private String getFinalValue(PropertyInfo propertyInfo, ObjectBaseInfo info, String[] attr, SimpleDateFormat sdf) {
        String value = "";
        if (propertyInfo instanceof LinkPropertyInfo) {
            //连接属性
            Object originalValue = info.get(attr[attr.length - 2]);
            if (originalValue != null) {
                DataBaseInfo coreBaseInfo = (DataBaseInfo) originalValue;
                value = coreBaseInfo.getString(attr[attr.length - 1]);
            }
        } else {
            OwnPropertyInfo ownPropertyInfo = (OwnPropertyInfo) propertyInfo;
            String name = ownPropertyInfo.getName();
            DataType dataType = ownPropertyInfo.getDataType();
            if (DataType.BOOLEAN.equals(dataType)) {
                Boolean aBoolean = info.getBoolean(name);
                if (aBoolean) {
                    value = "是";
                } else {
                    value = "否";
                }
            } else if (DataType.DATE.equals(dataType)) {
                Date date = info.getDate(name);
                if (date != null) {
                    value = sdf.format(date);
                }
            } else if (DataType.DECIMAL.equals(dataType)) {
                BigDecimal bigDecimal = info.getBigDecimal(name, 2);
                if (bigDecimal != null) {
                    value = bigDecimal.toPlainString();
                }
            } else if (DataType.ENUM.equals(dataType)) {
                String orginalValue = info.getString(name);
                if (!StringUtils.isEmpty(orginalValue)) {
                    BizEnumInfo enumType = ownPropertyInfo.getEnumType();
                    DynamicEnum anEnum = DynamicEnum.getEnum(enumType.getClassName(), orginalValue);
                    if (anEnum != null) {
                        value = anEnum.getAlias();
                    }
                }
            } else {
                value = info.getString(name) == null ? "" : info.getString(name);
            }
        }
        return value != null ? value : "";
    }

    /**
     * 获取模板文件数据
     *
     * @param ctx                   上下文对象
     * @param submitShemeTemplateId 提交方案模板ID
     * @return 模板文件的字节数组
     * @throws BOSException       BOS异常
     * @throws ShrWebBizException SHR业务异常
     */
    private byte[] getTemplateFile(Context ctx, String submitShemeTemplateId) throws
            BOSException, ShrWebBizException {
        // 获取附件扩展接口实例
        ISHRAttachmentExt ishrAttachmentExt = SHRAttachmentExtFactory.getLocalInstance(ctx);
        // 根据模板ID查询附件集合，按最后更新时间倒序排列
        SHRAttachmentExtCollection shrAttachmentExtCol =
                ishrAttachmentExt.getSHRAttachmentExtCollection(
                        "select attachment.file where boID='" + submitShemeTemplateId + "' and propertyName ='null0' order by lastUpdateTime desc");
        // 检查附件集合是否为空
        if (shrAttachmentExtCol.isEmpty()) {
            throw new ShrWebBizException("附件信息为空！ </br> The attachment information is empty!");
        }
        // 获取第一个附件的文件数据
        byte[] file = shrAttachmentExtCol.get(0).getAttachment().getFile();
        // 检查文件数据是否为空
        if (file == null) {
            throw new ShrWebBizException("附件为空！ </br> The attachment is empty!");
        }
        return file;
    }


    /**
     * 根据单据ID获取模板信息Action方法
     *
     * @param request  HTTP请求对象，用于获取请求参数
     * @param response HTTP响应对象，用于返回响应数据
     * @param modelMap 模型映射对象，用于存储和传递数据
     * @throws SHRWebException 业务异常，当操作失败时抛出
     */
    public void getTemplatesByBillIdAction(
            HttpServletRequest request,
            HttpServletResponse response,
            ModelMap modelMap
    ) throws SHRWebException {
        String billIds = getBillId(request);
        if (StringUtils.isBlank(billIds)) {
            throw new ShrWebBizException("单据id不能为空! </br> The document ID cannot be empty!");
        }
        try {
            //获取提报方案ID集合
            Set<String> submitSchemes = getSubmitSchemes(billIds);
            //检查提报方案是否一致
            checkSameSubmitScheme(submitSchemes);
            String submitSchemeId = submitSchemes.iterator().next();
            ISubmitShemeTemplate iSubmitShemeTemplate = SubmitShemeTemplateFactory.getLocalInstance(getContext());
            FilterInfo filterInfo = new FilterInfo();
            FilterItemCollection filterItems = filterInfo.getFilterItems();
            //提报方案
            filterItems.add(new FilterItemInfo("calSubmitScheme", submitSchemeId));
            //状态为启用
            filterItems.add(new FilterItemInfo("state", BaseItemStateEnum.ENABLE));
            EntityViewInfo instance = EntityViewInfo.getInstance(filterInfo, null, null);
            //提报套打模板集合
            SubmitShemeTemplateCollection submitShemeTemplateCol =
                    iSubmitShemeTemplate.getSubmitShemeTemplateCollection(instance);
            //todo: 获取模板集合
            JSONUtils.SUCCESS(submitShemeTemplateCol);
        } catch (BOSException e) {
            e.printStackTrace();
            throw new ShrWebBizException(e);
        }
    }

    /**
     * 根据提报单ID集合获取对应的提报方案ID集合
     *
     * @param billIds 提报单ID字符串，多个ID用逗号分隔
     * @return Set<String> 提报方案ID集合
     * @throws BOSException       BOS框架异常
     * @throws ShrWebBizException 业务异常，当billIds为空时抛出
     */
    private Set<String> getSubmitSchemes(String billIds) throws BOSException, ShrWebBizException {
        if (StringUtils.isBlank(billIds)) {
            throw new ShrWebBizException("单据id不能为空! </br> The document ID cannot be empty! ");
        }
        Set<String> submitSchemes = new HashSet<String>();
        //提报单
        IBatchSubmitShemeBill iBatchSubmitShemeBill = BatchSubmitShemeBillFactory.getLocalInstance(getContext());
        FilterInfo filterInfo = new FilterInfo();
        FilterItemCollection filterItems = filterInfo.getFilterItems();
        filterItems.add(new FilterItemInfo("id", billIds, CompareType.INCLUDE));
        EntityViewInfo instance = EntityViewInfo.getInstance(filterInfo, null, null);
        BatchSubmitShemeBillCollection submitShemeBillCol =
                iBatchSubmitShemeBill.getBatchSubmitShemeBillCollection(instance);
        for (int i = 0; i < submitShemeBillCol.size(); i++) {
            BatchSubmitShemeBillInfo batchSubmitShemeBillInfo = submitShemeBillCol.get(i);
            CalSubmitSchemeInfo submitScheme = batchSubmitShemeBillInfo.getSubmitScheme();
            submitSchemes.add(submitScheme.getId().toString());
        }
        return submitSchemes;
    }

    /**
     * 检查提报方案是否一致
     *
     * @param submitSchemes 提报方案集合
     * @throws ShrWebBizException 当提报方案为空或包含多个不同方案时抛出异常
     */
    private void checkSameSubmitScheme(Set<String> submitSchemes) throws ShrWebBizException {
        if (submitSchemes == null || submitSchemes.isEmpty()) {
            throw new ShrWebBizException("提报方案不能为空! </br> The submission plan cannot be empty! ");
        } else if (submitSchemes.size() > 1) {
            throw new ShrWebBizException("请选择同一提报方案的提报单!  </br> Please select the submission forms under the same submission plan!");
        }
    }
}
