package nc.pubimpl.erm.expenseaccount;

import org.apache.commons.lang3.StringUtils;

import com.alibaba.fastjson.JSONObject;

import nc.bs.dao.BaseDAO;
import nc.pubitf.erm.expenseaccount.IinsertLog_RequiresNew;
import nc.vo.erm.image.ImageTMLogVO;
import nc.vo.pub.BusinessException;

public class InsertLog_RequiresNewImpl implements IinsertLog_RequiresNew{
	
	private BaseDAO dao = null;

	@Override
	public void insertImageLog_RequiresNew(String billid, String billcode, JSONObject send, JSONObject result, String urlcode) throws BusinessException {
		String code = result.getString("code");
		ImageTMLogVO log = new ImageTMLogVO();
		log.setBillid(billid);
		log.setBillno(billcode);
		log.setTm_content(JSONObject.toJSONString(send));
		log.setTm_result(JSONObject.toJSONString(result));
		log.setApicode(urlcode);
		if(!StringUtils.isBlank(code) && "200".equals(code)) {
			log.setTm_status("S");
		} else {
			log.setTm_status("F");
		}
		// ²åÈëÈÕÖ¾±í
		getDao().insertVO(log);
	}
	
	private BaseDAO getDao() {
		if(dao == null) {
			dao = new BaseDAO();
		}
		return dao;
	}

}
