package com.engine.htsc.htNoticetRelease.utils;

import com.engine.common.util.ServiceUtil;
import com.engine.htsc.common.service.CoWorkflowService;
import com.engine.htsc.common.service.impl.CoWorkflowServiceImpl;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import weaver.interfaces.htsc.comInfo.PropBean;

/**
 * k11181318
 * 总部公告工具类
 */
public class HTNoticeReleaseUtil {
    private final Log log = LogFactory.getLog(HTNoticeReleaseUtil.class);
    private CoWorkflowService getCoWorkflowService() {
        return ServiceUtil.getService(CoWorkflowServiceImpl.class);
    }

    /**
     * 生成总部公告流程编号
     *
     * @return string
     */
    public synchronized String createHTNoticeReleaseRequestMark() {
        try {
            PropBean pp = new PropBean();
            String workFlowId = pp.getPropName("HTNoticeReleaseRequestMark"); //流程编号
            if (StringUtils.isBlank(workFlowId)) {
                log.info("配置文件,HTNoticeReleaseRequestMark没有维护");
                return "";
            }
            CoWorkflowService coWorkflowService = this.getCoWorkflowService();
            String requestMark = coWorkflowService.createRequestMark(workFlowId);
            return requestMark;
        }catch (Exception e) {
            log.error("生成资金业务付款流程编号失败,catch:" + e.getMessage());
            e.printStackTrace();
            return "";
        }
    }
}
