package nc.impl.wgpt.log;

import nc.bs.dao.BaseDAO;
import nc.itf.wgpt.log.IWuYeWgptLogService;
import nc.log.uap.wgpt.WuYeWgptLogger;
import nc.vo.pub.SuperVO;
import nc.vo.wgpt.log.WuYeWgptLogVO;
/**
 * @Description: 日志服务
 * 
 * @author 谢文如 【碧桂园-物业板块-网购平台接口】
 * @date 2019-3-6
 * @version with NC V6.3
 */
public class WuYeWgptLogImpl implements IWuYeWgptLogService {

	@Override
	public void insertLog_RequiresNew(WuYeWgptLogVO logVO) {
		try {
			BaseDAO dao = new BaseDAO();
			dao.insertVO(logVO);
		} catch (Exception e) {
			WuYeWgptLogger.log(logVO.getItfname(),logVO.getItfcode(),"插入日志异常：\r\n"+WuYeWgptLogger.getStackTrace(e));
		}
	}

	@Override
	public void insertSuperVO_RequiresNew(SuperVO logVO) {
		try {
			BaseDAO dao = new BaseDAO();
			dao.insertVO(logVO);
		} catch (Exception e) {
			WuYeWgptLogger.log(logVO.getTableName()+"_GX",logVO.getTableName()+"_GX","插入日志异常：\r\n"+WuYeWgptLogger.getStackTrace(e));
		}
	}

	@Override
	public void updateSuperVO_RequiresNew(SuperVO logVO, String[] fieldNames) {
		try {
			BaseDAO dao = new BaseDAO();
			if(fieldNames != null) {
				dao.updateVO(logVO, fieldNames);
			}else {
				dao.updateVO(logVO);
			}
		} catch (Exception e) {
			WuYeWgptLogger.log(logVO.getTableName()+"_GX",logVO.getTableName()+"_GX","插入日志异常：\r\n"+WuYeWgptLogger.getStackTrace(e));
		}
	}
	@Override
	public void updateSql_RequiresNew(String updatesql) {
		try {
			BaseDAO dao = new BaseDAO();
			dao.executeUpdate(updatesql);
		} catch (Exception e) {
			WuYeWgptLogger.log(updatesql+"_GX",updatesql+"_GX","插入日志异常：\r\n"+WuYeWgptLogger.getStackTrace(e));
		}
	}
}
