package com.seeyon.ctp.rest.resources;

import javax.ws.rs.Consumes;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.QueryParam;
import javax.ws.rs.core.Response;

import org.apache.commons.logging.Log;

import com.seeyon.apps.src_gettaxrate.dao.IGetTaxRateDao;
import com.seeyon.apps.src_gettaxrate.util.CommonResult;
import com.seeyon.ctp.common.AppContext;
import com.seeyon.ctp.common.log.CtpLogFactory;

/**
* @author zhaoyang:
* @version 创建时间：2024年11月30日 下午9:08:23
* 类说明  根据纳税人识别号、税目 ，去获取税率
*/
@Path("/nc/oa")
@Produces({"application/json", "application/xml"})
public class getTaxRateResources extends BaseResource {
	
	private static final Log log = CtpLogFactory.getLog(getTaxRateResources.class);
	private IGetTaxRateDao gettaxrateDao;
	
	
	public IGetTaxRateDao getIGetTaxRateDao() {
		if (this.gettaxrateDao == null) {
			this.gettaxrateDao = ((IGetTaxRateDao) AppContext.getBean("gettaxrateDao"));
		}
		return gettaxrateDao;
	}
	public void setIGetF9WagesDao(IGetTaxRateDao getwagesDao) {
		this.gettaxrateDao = getwagesDao;
	}
	
	
	@GET
    @Path("/gettaxdata")
    @Produces({"application/json"})
    @Consumes({"application/json"})
    public Response getData(@QueryParam("taxnum") String taxnum,@QueryParam("taxtype") String taxtype){
		CommonResult result = getIGetTaxRateDao().getTaxRateExecute2(taxnum, taxtype);
		if("success".equals(result.getStatusCode())) {
			return success(result.getData(),"税率查询成功");
		}else {
			return fail("税率查询失败: "+result.getMessage());
		}
	}

}
