825af37b2729564e8f8d6e7bce310405f1346bc3.svn-base 3.13 KB
/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.thinkgem.jeesite.modules.reg.service.qjxt;

import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.Date;
import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.thinkgem.jeesite.common.persistence.Page;
import com.thinkgem.jeesite.common.service.CrudService;
import com.thinkgem.jeesite.modules.reg.entity.qjxt.Interfacelog;
import com.thinkgem.jeesite.modules.reg.dao.qjxt.InterfacelogDao;

/**
 * 权籍系统接口日志信息管理Service
 * @author xuyg
 * @version 2018-11-12
 */
@Service
@Transactional(readOnly = true)
public class InterfacelogService extends CrudService<InterfacelogDao, Interfacelog> {

	public Interfacelog get(String id) {
		return super.get(id);
	}
	
	public List<Interfacelog> findList(Interfacelog interfacelog) {
		return super.findList(interfacelog);
	}
	
	public Page<Interfacelog> findPage(Page<Interfacelog> page, Interfacelog interfacelog) {
		return super.findPage(page, interfacelog);
	}
	
	@Transactional(readOnly = false)
	public void save(Interfacelog interfacelog) {
		super.save(interfacelog);
	}
	
	@Transactional(readOnly = false)
	public void delete(Interfacelog interfacelog) {
		super.delete(interfacelog);
	}
	
	public void saveUsByProperty(String url,String requser,String reqparameter,String resparameter,Exception exception){
		Interfacelog loginfo = new Interfacelog();
		loginfo.setUrl(url);
		loginfo.setRequser(requser);
		loginfo.setResuser("不动产信息登记平台");
		loginfo.setCreatedate(new Date());
		loginfo.setReqparameter(reqparameter);
		loginfo.setResparameter(resparameter);
		String stackTrace="";
		if(exception != null){
		try {
            StringWriter sw = new StringWriter();
            PrintWriter pw = new PrintWriter(sw);
            exception.printStackTrace(pw);
            stackTrace=sw.toString();
            sw.close();
            pw.close();
	    } catch (Exception e2) {
            e2.printStackTrace();
	    } 
	}
		/**
		if(stackTrace.length()>4000){
			stackTrace = stackTrace.substring(0, 3000);
		}
		**/
		loginfo.setStackTrace(stackTrace.toString());
		save(loginfo);
	}
	
	public void saveAskByProperty(String url,String resuser,String reqparameter,String resparameter,Exception exception){
		Interfacelog log = new Interfacelog();
		log.setUrl(url);
		log.setRequser("不动产信息登记平台");
		log.setResuser(resuser);
		log.setCreatedate(new Date());
		log.setReqparameter(reqparameter);
		log.setResparameter(resparameter);
		String stackTrace="";
		if(exception != null){
			try {
	            StringWriter sw = new StringWriter();
	            PrintWriter pw = new PrintWriter(sw);
	            exception.printStackTrace(pw);
	            stackTrace=sw.toString();
	            sw.close();
	            pw.close();
		    } catch (Exception e2) {
	            e2.printStackTrace();
		    } 
		}
		/**
		if(stackTrace.length()>4000){
			stackTrace = stackTrace.substring(0, 3000);
		}
		**/
		log.setStackTrace(stackTrace.toString());
		save(log);
	}
}