package com.docus.server.report.util;

import lombok.Data;

/**
 *  嘉时软件自定义 成功/失败消息 XML 格式
 * @author wyb
 */
@Data
public class JSXMLResult {

    private static  final String SUCCESS_TEMPLATE="<Response>" +
            "<Result>" +
            "<Code>0</Code>" +
            "<MsgId>%s</MsgId>" +
            "<Msg>成功！</Msg>" +
            "</Result>" +
            "</Response>";

    private static  final String FAILED_TEMPLATE="<Response>" +
            "<Result>" +
            "<Code>500</Code>" +
            "<MsgId>%s</MsgId>" +
            "<Msg>%s</Msg>" +
            "</Result>" +
            "</Response>";

    public static String success(String msgId){
        return String.format(SUCCESS_TEMPLATE,msgId);
    }

    public static String failed(String msgId,String message){
        return String.format(FAILED_TEMPLATE,msgId,message);
    }

    public static void main(String[] args) {
        System.out.println(success("100"));
        System.out.println(failed("100","随便输出了"));
    }

}
