package com.tax.controller;

import java.math.BigDecimal;
import java.util.Date;

import javax.annotation.Resource;

import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import com.tax.entity.ErrorReport;
import com.tax.entity.Record;
import com.tax.service.TaxService;
import com.tax.vo.Pager;

/**
 * @ClassName:TaxAction.java
 * @Description: 年终奖、月工资请求控制器Action
 *
 */
@Controller
@Scope("prototype")
public class TaxAction extends BaseAction{
	@Resource
	private TaxService taxService;
	/**
	 * 进入页面
	 * @return
	 */
	@RequestMapping(value = "/")
	public String home(){
		return "tax";
	}
	
	/**
	 * 查询税率标准
	 * @param pageNumber
	 * @param pageSize
	 */
	@RequestMapping(value = "searchTaxRate", method = RequestMethod.POST)
	public void searchTaxRate(Integer pageNumber,Integer pageSize){
		try{
			
			Pager page = taxService.getAll(pageNumber,pageSize);
			printJSON(page);
			
		}catch(Exception e){
			ErrorReport ErrorReport = new ErrorReport();
			ErrorReport.setActionurl("/searchTaxRate"); //异常路径
			ErrorReport.setRequestMethod("post"); //请求方式
			ErrorReport.setCdate(new Date());
			ErrorReport.setIp(getIpAddr(request));
			ErrorReport.setDescp(e.getMessage());
			errorReportDao.save(ErrorReport);
		}
	}
	
	/**
	 * 计算个人所得税
	 * @param category
	 * @param amount
	 * @param spiltType
	 */
	@RequestMapping(value = "calculation", method = RequestMethod.POST)
	public void calculation(Integer category,BigDecimal amount,BigDecimal yearBonusAmount,Integer spiltType){
		String ip = getIpAddr(request);
		
		try{
			Record record = taxService.calculation(category,amount,yearBonusAmount,spiltType,ip);
			printJSON(record);
			
		}catch(Exception e){
			ErrorReport ErrorReport = new ErrorReport();
			ErrorReport.setActionurl("/calculation"); //异常路径
			ErrorReport.setRequestMethod("post"); //请求方式
			ErrorReport.setCdate(new Date());
			ErrorReport.setIp(getIpAddr(request));
			ErrorReport.setDescp(e.getMessage());
			errorReportDao.save(ErrorReport);
		}
		
	}
}
最近下载更多
最代码-宋家辉  LV61 2023年8月5日
binbin123123  LV1 2020年6月2日
8战魂5无双8  LV43 2019年12月7日
xzl8023xwq  LV13 2019年10月22日
zhxtatata  LV4 2019年6月27日
qianbaobao  LV1 2019年5月27日
安宇12345  LV15 2019年4月18日
15673237576  LV1 2019年3月16日
18392130476  LV6 2019年1月28日
fsj0122  LV1 2019年1月16日
最近浏览更多
暂无贡献等级
吞吞吐吐她  LV6 2024年3月27日
暂无贡献等级
最代码-宋家辉  LV61 2023年8月5日
uni-code_0123  LV1 2023年8月4日
qazws123  LV1 2023年6月7日
sweetbox  LV10 2023年4月16日
泡面不会打野  LV1 2022年12月30日
tonghao  LV18 2022年12月9日
111114758  LV2 2022年11月27日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友