package psdi.app.iface;

import psdi.mbo.Mbo;
import psdi.mbo.MboRemote;
import psdi.mbo.MboSetRemote;
import psdi.server.MXServer;
import psdi.util.MXException;

import java.rmi.RemoteException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 接口日志记录
 * createby liuxq  2024-5-10
 */
public class udIFLogHandler {
    public void insertIFLog(String AppId, String AppName, String OPNum, String OPType, Integer LqTotal,String Source,String Target,String IFName,String IFStatus,String Createby,String Orgid,String Siteid,Date SendDate,Date AcceptDate,String SendJs,String AcceptJs) throws RemoteException, MXException, ParseException {
        Date createDate = new Date();//获取当前时间
        MboSetRemote udIFLogMboSet = MXServer.getMXServer().getMboSet("UDIFLOG",MXServer.getMXServer().getSystemUserInfo());//接口日志表
        MboRemote udIFLogMbo = udIFLogMboSet.add();//创建对象
        udIFLogMbo.setValue("CREATEDATE",createDate);//触发时间
        udIFLogMbo.setValue("APPID",AppId);//应用id
        udIFLogMbo.setValue("APPNAME",AppName);//应用名称
        udIFLogMbo.setValue("OPNUM",OPNum);//单据号
        udIFLogMbo.setValue("OPTYPE",OPType);//操作类型
        udIFLogMbo.setValue("LQTOTAL",LqTotal);//本次拉取总数量
        udIFLogMbo.setValue("SOURCE",Source);//源系统
        udIFLogMbo.setValue("TARGET",Target);//目标系统
        udIFLogMbo.setValue("IFNAME",IFName);//接口名
        udIFLogMbo.setValue("IFSTATUS",IFStatus);//接口状态
        udIFLogMbo.setValue("CREATEBY",Createby);//操作人
        udIFLogMbo.setValue("ORGID",Orgid);//组织
        udIFLogMbo.setValue("SITEID",Siteid);//地点
        udIFLogMbo.setValue("SENDDATE",SendDate);//发起时间
        udIFLogMbo.setValue("SENDJS",SendJs);//发起报文
        udIFLogMbo.setValue("ACCEPTDATE",AcceptDate);//接收时间
        udIFLogMbo.setValue("ACCEPTJS",AcceptJs);//接收报文
        udIFLogMbo.getThisMboSet().save();//保存
        udIFLogMbo.getThisMboSet().close();//关闭
    }
}
