package com.malk.mcli.service.impl;


import com.malk.mcli.service.InvoiceWebService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.Date;

@Slf4j
@Service
public class InvoiceWebServiceImpl implements InvoiceWebService {

    @Override
    public String sayHello(String user) {

        log.info("sayHello. {}", user);
        return user + "，现在时间：" + "(" + new Date() + ")";
    }

    @Override
    public String test(String user) {
        log.info("test. {}", user);
        return user;
    }

    ////

    @Override
    public String GetSchema(String schemaCode) {
        log.info("GetSchema., {} ", schemaCode);

        return "{\"ResultCode\":\"0\",   \"Message\":\"\",   \"Schema\":{\"Code\":\"Student\",\"Items\":[{\"Name\":\"Name\",\"DisplayName\":\"学生姓名\",\"DataType\":\"String\"},{\"Name\":\"Age\",\"DisplayName\":\"学生年龄\",\"DataType\":\"Int\"},{\"Name\":\"ReturnData\",\"DisplayName\":\"子表数据\",\"DataType\":\"BizStructureArray\",\"ChildSchema\":{\"Code\":\"ResultObject\",\"Items\":[{\"Name\":\"ResultCode\",\"DisplayName\":\"执行结果代码\",\"DataType\":\"Int\"},{\"Name\":\"ErrorMessage\",\"DisplayName\":\"异常原因\",\"DataType\":\"String\"}]}}]},   \"Data\":{\"Name\":\"张三\",\"Age\":\"10\",\"ReturnData\":[{\"ResultCode\":\"0\",\"ErrorMessage\":\"0\"},{\"ResultCode\":\"1\",\"ErrorMessage\":\"1\"}]}}";

    }

    @Override
    public String GetSchemaList() {
        log.info("GetSchemaList");
        return "{\"ResultCode\":\"0\",   \"Message\":\"\",   \"Schema\":{\"Code\":\"Student\",\"Items\":[{\"Name\":\"Name\",\"DisplayName\":\"学生姓名\",\"DataType\":\"String\"},{\"Name\":\"Age\",\"DisplayName\":\"学生年龄\",\"DataType\":\"Int\"},{\"Name\":\"ReturnData\",\"DisplayName\":\"子表数据\",\"DataType\":\"BizStructureArray\",\"ChildSchema\":{\"Code\":\"ResultObject\",\"Items\":[{\"Name\":\"ResultCode\",\"DisplayName\":\"执行结果代码\",\"DataType\":\"Int\"},{\"Name\":\"ErrorMessage\",\"DisplayName\":\"异常原因\",\"DataType\":\"String\"}]}}]},   \"Data\":{\"Name\":\"张三\",\"Age\":\"10\",\"ReturnData\":[{\"ResultCode\":\"0\",\"ErrorMessage\":\"0\"},{\"ResultCode\":\"1\",\"ErrorMessage\":\"1\"}]}}";

    }

    @Override
    public String GetList() {
        log.info("GetList");
        return "{\"ResultCode\":\"0\",   \"Message\":\"\",   \"Schema\":{\"Code\":\"Student\",\"Items\":[{\"Name\":\"Name\",\"DisplayName\":\"学生姓名\",\"DataType\":\"String\"},{\"Name\":\"Age\",\"DisplayName\":\"学生年龄\",\"DataType\":\"Int\"},{\"Name\":\"ReturnData\",\"DisplayName\":\"子表数据\",\"DataType\":\"BizStructureArray\",\"ChildSchema\":{\"Code\":\"ResultObject\",\"Items\":[{\"Name\":\"ResultCode\",\"DisplayName\":\"执行结果代码\",\"DataType\":\"Int\"},{\"Name\":\"ErrorMessage\",\"DisplayName\":\"异常原因\",\"DataType\":\"String\"}]}}]},   \"Data\":{\"Name\":\"张三\",\"Age\":\"10\",\"ReturnData\":[{\"ResultCode\":\"0\",\"ErrorMessage\":\"0\"},{\"ResultCode\":\"1\",\"ErrorMessage\":\"1\"}]}}";

    }

    @Override
    public String Invoke(String userCode, String schemaCode, String methodName, String param) {
        log.info("invoke. {}, {}, {},{}", userCode, schemaCode, methodName, param);
        return "{\"ResultCode\":\"0\",   \"Message\":\"\",   \"Schema\":{\"Code\":\"Student\",\"Items\":[{\"Name\":\"Name\",\"DisplayName\":\"学生姓名\",\"DataType\":\"String\"},{\"Name\":\"Age\",\"DisplayName\":\"学生年龄\",\"DataType\":\"Int\"},{\"Name\":\"ReturnData\",\"DisplayName\":\"子表数据\",\"DataType\":\"BizStructureArray\",\"ChildSchema\":{\"Code\":\"ResultObject\",\"Items\":[{\"Name\":\"ResultCode\",\"DisplayName\":\"执行结果代码\",\"DataType\":\"Int\"},{\"Name\":\"ErrorMessage\",\"DisplayName\":\"异常原因\",\"DataType\":\"String\"}]}}]},   \"Data\":{\"Name\":\"张三\",\"Age\":\"10\",\"ReturnData\":[{\"ResultCode\":\"0\",\"ErrorMessage\":\"0\"},{\"ResultCode\":\"1\",\"ErrorMessage\":\"1\"}]}}";
    }
}