| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810 |
- package com.kingdee.eas.custom.compensation.handler;
- import cn.com.servyou.dto.ApiResponse;
- import cn.com.servyou.dto.AsyncResult;
- import cn.com.servyou.dto.declare.CompanyDeclareRequest;
- import cn.com.servyou.dto.tax.*;
- import cn.com.servyou.rmi.client.ClientProxyFactory;
- import cn.com.servyou.service.DeclarationRequest;
- import com.alibaba.fastjson.JSONObject;
- import com.fasterxml.jackson.databind.ObjectMapper;
- import com.kingdee.bos.BOSException;
- import com.kingdee.bos.Context;
- import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
- import com.kingdee.eas.basedata.hraux.NationalityInfo;
- import com.kingdee.eas.basedata.person.PersonInfo;
- import com.kingdee.eas.common.EASBizException;
- import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
- import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
- import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
- import com.kingdee.eas.custom.shuiyou.utils.ClientProxyFactoryUtils;
- import com.kingdee.shr.base.syssetting.context.SHRContext;
- import com.kingdee.shr.base.syssetting.exception.SHRWebException;
- import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
- import com.kingdee.shr.compensation.app.tax.*;
- import com.kingdee.shr.compensation.util.Base64Utils;
- import com.kingdee.shr.compensation.web.handler.tax.IncomeTaxDeclareListHandler;
- import com.kingdee.util.StringUtils;
- import org.apache.log4j.Logger;
- import org.springframework.ui.ModelMap;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.sql.SQLException;
- import java.text.SimpleDateFormat;
- import java.util.*;
- /**
- * @author qingwu
- * @date 2024/9/18
- * @apiNote 个税申报扩展
- */
- public class IncomeTaxDeclareListHandlerEx extends IncomeTaxDeclareListHandler {
- Logger logger = Logger.getLogger("com.kingdee.eas.custom.compensation.handler.IncomeTaxDeclareListHandlerEx");
- String personName = "测试姜凌";
- String cardType = "居民身份证";
- String cardNumber = "828888201005039412";
- /**
- * 个税申报
- *
- * @param request
- * @param response
- * @param modelMap
- */
- public void taxDeclaresAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
- logger.error("taxDeclareAction-----start-------");
- Context ctx = SHRContext.getInstance().getContext();
- //个税申报
- //String selectedId = request.getParameter("selectedId");
- //String sqlInString = CmpUtils.spiltToSqlString(selectedId);
- //if (StringUtils.isEmpty(sqlInString)) {
- // sqlInString = "''";
- //}
- try {
- //String oqlBuffer = "select id,yearMonth,totalPerson,totalMoney,taxRebate,declareStatus,versionCode,yearMonthDate,tbType,taxUnit.id,taxUnit.name,taxUnit.taxNumber,taxUnit.regNumber,taxUnit.areaCode,taxUnit.declPassword, batchNo where id in ( " + sqlInString + " )";
- //IncomeTaxDeclarCollection declareCollection = IncomeTaxDeclarFactory.getLocalInstance(ctx).getIncomeTaxDeclarCollection(oqlBuffer);
- IncomeTaxDeclarCollection declareCollection = new IncomeTaxDeclarCollection();
- Map<String, List<Map<String, Object>>> declareDataMap = null;
- List<Map<String, Object>> list = new ArrayList<>();
- Map<String, Object> map = new HashMap<>();
- map.put("personName", personName);
- map.put("cardType", cardType);
- map.put("cardNumber",cardNumber);
- if (declareCollection.size() == 0) {
- declareCollection.add(new IncomeTaxDeclarInfo());
- }
- ApiResponse<AsyncResult> apiResponse = null;
- ObjectMapper mapper = new ObjectMapper();
- for (int i = 0; i < declareCollection.size(); i++) {
- IncomeTaxDeclarInfo incomeTaxDeclarInfo = declareCollection.get(i);
- //纳税单位
- //TaxUnitInfo taxUnitInfo = incomeTaxDeclarInfo.getTaxUnit();
- TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(ctx).getTaxUnitInfo(new ObjectUuidPK("FqEAAACXVqyPHZiq"));
- //年月
- //String yearMonth = incomeTaxDeclarInfo.getYearMonth();
- //反算服务
- ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
- //算税请求接口
- DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
- //获取请求参数
- //获取请求参数
- CompanyDeclareRequest declareRequestParameter = getDeclareRequestParameter(taxUnitInfo, declareDataMap, "202408");
- //申报数据报送
- apiResponse = declarationRequest.send(declareRequestParameter);
- logger.error("asyncResultApiResponse-----getCode-------" + apiResponse.getHead().getCode());
- logger.error("asyncResultApiResponse-----getMsg--------" + apiResponse.getHead().getMsg());
- if (apiResponse.getHead().getCode().equals("00000000")) {
- AsyncResult body = apiResponse.getBody();
- String requestId = body.getRequestId();
- logger.error("requestId-----" + requestId);
- logger.error("apiResponse-----" + mapper.writeValueAsString(apiResponse));
- //查询反算反馈结果
- ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
- //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
- //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
- JSONObject json = new JSONObject();
- json.put("requestId", requestId);
- //json.put("param", jsonObject.toString());
- isyUtilsFacade.addTask("synIncomeTaxDeclareService", json.toJSONString(), TaskCatalogEnum.TAX, "");
- }
- }
- JSONUtils.writeJson(response, mapper.writeValueAsString(apiResponse));
- logger.error("taxDeclareAction-----end-------");
- } catch (IOException e) {
- throw new RuntimeException(e);
- } catch (EASBizException e) {
- throw new RuntimeException(e);
- } catch (SQLException e) {
- throw new RuntimeException(e);
- }
- }
- ///**
- // * 个税申报
- // *
- // * @param request
- // * @param response
- // * @param modelMap
- // */
- //@Override
- //public void taxDeclareAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
- // super.taxDeclareAction(request, response, modelMap);
- // logger.error("taxDeclareAction-----start-------");
- //
- // Context ctx = SHRContext.getInstance().getContext();
- // //个税申报
- // String selectedId = request.getParameter("selectedId");
- // String sqlInString = CmpUtils.spiltToSqlString(selectedId);
- // if (StringUtils.isEmpty(sqlInString)) {
- // sqlInString = "''";
- // }
- // try {
- // String oqlBuffer = "select id,yearMonth,totalPerson,totalMoney,taxRebate,declareStatus,versionCode,yearMonthDate,tbType,taxUnit.id,taxUnit.name,taxUnit.taxNumber,taxUnit.regNumber,taxUnit.areaCode,taxUnit.declPassword, batchNo where id in ( " + sqlInString + " )";
- // IncomeTaxDeclarCollection declareCollection = IncomeTaxDeclarFactory.getLocalInstance(ctx).getIncomeTaxDeclarCollection(oqlBuffer);
- // Map<String, List<Map<String, Object>>> declareDataMap = null;
- // if (declareCollection.size() == 0) {
- // declareCollection.add(new IncomeTaxDeclarInfo());
- // }
- // for (int i = 0; i < declareCollection.size(); i++) {
- // IncomeTaxDeclarInfo incomeTaxDeclarInfo = declareCollection.get(i);
- // //纳税单位
- // //TaxUnitInfo taxUnitInfo = incomeTaxDeclarInfo.getTaxUnit();
- // TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(ctx).getTaxUnitInfo(new ObjectUuidPK("FqEAAACXVqyPHZiq"));
- // //年月
- // //String yearMonth = incomeTaxDeclarInfo.getYearMonth();
- // //反算服务
- // ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
- // //算税请求接口
- // DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
- // //获取请求参数
- // //获取请求参数
- // CompanyDeclareRequest declareRequestParameter = getDeclareRequestParameter(taxUnitInfo, declareDataMap, "202408");
- // //申报数据报送
- // ApiResponse<AsyncResult> apiResponse = declarationRequest.send(declareRequestParameter);
- // logger.error("asyncResultApiResponse-----getCode-------" + apiResponse.getHead().getCode());
- // logger.error("asyncResultApiResponse-----getMsg--------" + apiResponse.getHead().getMsg());
- // if (apiResponse.getHead().getCode().equals("00000000")) {
- // AsyncResult body = apiResponse.getBody();
- // String requestId = body.getRequestId();
- // logger.error("requestId-----" + requestId);
- // //查询反算反馈结果
- // ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
- // //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
- // //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
- // JSONObject json = new JSONObject();
- // json.put("requestId", requestId);
- // //json.put("param", jsonObject.toString());
- // isyUtilsFacade.addTask("synIncomeTaxDeclareService", json.toJSONString(), TaskCatalogEnum.TAX, "");
- // }
- // }
- // logger.error("taxDeclareAction-----end-------");
- //
- // } catch (IOException e) {
- // throw new RuntimeException(e);
- // } catch (EASBizException e) {
- // throw new RuntimeException(e);
- // }
- //}
- /**
- * 获取请求参数
- * 注意:
- * 1.解除劳动合同一次性补偿金、全年一次性奖金所得,不能单独申报,需要同正常工资薪金一起申报。
- * 2.解除劳动合同一次性补偿金、稿酬所得,由于税务规则需要,解除劳动合同一次性补偿金、稿酬所得必须填写免税附表。
- *
- * @param taxUnitInfo
- * @param declareDataMap
- * @param yearMonth
- * @return
- */
- private CompanyDeclareRequest getDeclareRequestParameter(TaxUnitInfo taxUnitInfo,
- Map<String, List<Map<String, Object>>> declareDataMap,
- String yearMonth) throws BOSException, SQLException, EASBizException {
- CompanyDeclareRequest declareRequestPara = new CompanyDeclareRequest();
- //随机id
- String bizNo = UUID.randomUUID().toString();
- logger.error("bizNo:" + bizNo);
- //外部业务订单号*
- declareRequestPara.setBizNo(bizNo);
- //企业名称*
- declareRequestPara.setName(taxUnitInfo.getName());
- //税号*
- declareRequestPara.setTaxNo(taxUnitInfo.getTaxNumber());
- //行政区划代码*
- declareRequestPara.setArea(taxUnitInfo.getAreaCode());
- //登记序号
- declareRequestPara.setRegistrationNumber(taxUnitInfo.getRegNumber());
- //部门编号
- //declareRequestPara.setDeptNo("");
- //部门名称
- //declareRequestPara.setDeptName("");
- //税款所属期YYYYMM*
- declareRequestPara.setMonth(yearMonth);
- //实名账号
- //declareRequestPara.setRealNameAccount();
- //实名密码
- //declareRequestPara.setRealNamePassword();
- //加密实名密码
- //declareRequestPara.setEncryptedRealNamePassword();
- //申报密码
- //declareRequestPara.setDeclarePassword("Aa123456");
- String declPassword = taxUnitInfo.getDeclPassword();
- if (StringUtils.isEmpty(declPassword)) {
- throw new BOSException("申报密码不能为空!");
- }
- declareRequestPara.setDeclarePassword(Base64Utils.decode(declPassword));
- //加密申报密码
- //taxRequestPara.setEncryptedDeclarePassword();
- //密码类型*
- declareRequestPara.setPasswordType("0");
- //离职日期处理策略 1、不传或传1,代表离职日期自动清空,即人员状态由“非正常”变更为“正常”时,离职日期字段自动清空,默认逻辑。
- //2、传2离职日期不自动清空,即人员状态由“非正常”变更为“正常”时,离职日期不自动清空,客户如需清空需对离职日期字段传入空字符串。
- //declareRequestPara.setResignDateStrategy();
- //企业员工列表
- List<DetailCompanyEmployee> companyEmployeeList = getCompanyEmployeeList();
- declareRequestPara.setCompanyEmployeeList(companyEmployeeList);
- //综合所得
- //综合所得对象
- ComplexIncomeRequest complexIncomeRequest = new ComplexIncomeRequest();
- //纳税人次
- //complexIncomeRequest.setTaxCount();
- //应扣缴税额
- //complexIncomeRequest.setRefundTax();
- //减免方式
- //complexIncomeRequest.setDeductionMode();
- //减免比例
- //complexIncomeRequest.setRatio();
- //减免限额
- //complexIncomeRequest.setLimitAmount();
- ////正常工资薪金对象
- //NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncome(declareDataMap);
- //complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
- //全年一次性奖金收入列表
- //List<ComplexIncome> annualOneTimeBonusIncomeList = getAnnualOneTimeBonusIncomeList(declareDataMap);
- //List<ComplexIncome> annualOneTimeBonusIncomeList = new ArrayList();
- //ComplexIncome annualOneTimeBonusIncome = getAnnualOneTimeBonusIncome();
- //annualOneTimeBonusIncomeList.add(annualOneTimeBonusIncome);
- //complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncomeList);
- //一般劳务报酬所得列表
- //List<ComplexIncome> laborRemunerationIncome = getLaborRemunerationIncome(declareDataMap);
- ////解除劳动合同一次性补偿金列表
- //List<ComplexIncome> compensateIncome = getCompensateIncome(declareDataMap);
- //complexIncomeRequest.setCompensateIncome(compensateIncome);
- //测试 正常工资薪金对象
- NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncomes();
- complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
- //测试 全年一次性奖金
- List<ComplexIncome> annualOneTimeBonusIncome = getAnnualOneTimeBonusIncomes();
- complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncome);
- ////测试 一般劳务报酬所得列表
- //List<ComplexIncome> laborRemunerationIncome = getLaborRemunerationIncomes();
- //complexIncomeRequest.setLaborRemunerationIncome(laborRemunerationIncome);
- declareRequestPara.setComplexIncomeRequest(complexIncomeRequest);
- return declareRequestPara;
- }
- /**
- * 获取一般劳务报酬所得
- * taxItemPlanName 个税项目名称
- * cmpschemeid 计算规则ID
- *
- * @return
- */
- public List<ComplexIncome> getLaborRemunerationIncomes() {
- List<ComplexIncome> complexIncomeList = new ArrayList();
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名
- complexIncome.setName(personName);
- //证照类型
- complexIncome.setLicenseType(cardType);
- complexIncome.setLicenseNumber(cardNumber);
- //税后收入额
- complexIncome.setAbroadIncome(new BigDecimal("123123"));
- //收入额
- complexIncome.setIncome(new BigDecimal("10000"));
- //所得项目名称
- complexIncome.setIncomeItemName("一般劳务报酬所得");
- complexIncomeList.add(complexIncome);
- return complexIncomeList;
- }
- /**
- * 获取全年一次性奖金
- * taxItemPlanName 个税项目名称
- * cmpschemeid 计算规则ID
- *
- * @return
- */
- public List<ComplexIncome> getAnnualOneTimeBonusIncomes() {
- List<ComplexIncome> complexIncomeList = new ArrayList();
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名
- complexIncome.setName(personName);
- //证照类型
- complexIncome.setLicenseType(cardType);
- complexIncome.setLicenseNumber(cardNumber);
- //税后收入额
- complexIncome.setAbroadIncome(new BigDecimal("123123"));
- //收入额
- complexIncome.setIncome(new BigDecimal("10000"));
- //所得项目名称
- complexIncome.setIncomeItemName("全年一次性奖金收入");
- complexIncomeList.add(complexIncome);
- return complexIncomeList;
- }
- /**
- * 企业员工列表*
- *
- * @return
- */
- private List<DetailCompanyEmployee> getCompanyEmployeeList() {
- List<DetailCompanyEmployee> companyEmployeeList = new ArrayList<DetailCompanyEmployee>();
- //获取人员数据
- DetailCompanyEmployee detailCompanyEmployee = getDetailCompanyEmployee();
- companyEmployeeList.add(detailCompanyEmployee);
- return companyEmployeeList;
- }
- /**
- * 解除劳动合同一次性补偿金列表
- *
- * @param caluDataMap
- * @return
- */
- private List<ComplexIncome> getCompensateIncome(
- Map<String, List<Map<String, Object>>> caluDataMap) {
- List<ComplexIncome> compensateIncome = new ArrayList<ComplexIncome>();
- List<Map<String, Object>> list = caluDataMap.get("jcldhtlb");
- for (int i = 0; list != null && i < list.size(); i++) {
- //个税应用+税款计算初算明细表
- Map<String, Object> map = list.get(i);
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名*
- complexIncome.setName((String) map.get("personName"));
- //证件类型名称*
- complexIncome.setLicenseType((String) map.get("cardType"));
- //证件号码*
- complexIncome.setLicenseNumber((String) map.get("cardNumber"));
- //todo 是否自动生成免税附表
- complexIncome.setIsAutoGenerateExempt("是");
- //当期收入额*
- complexIncome.setIncome((BigDecimal) map.get("t39"));
- //免税收入
- complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
- //其他
- //complexIncome.setOther(BigDecimal.ZERO);
- //减免税额 无
- complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
- //备注
- //complexIncome.setRemark("");
- //所得项目名称*
- complexIncome.setIncomeItemName("解除劳动合同一次性补偿金");
- //准予扣除的捐赠额 无
- complexIncome.setDeductibleDonation((BigDecimal) map.get("t16"));
- compensateIncome.add(complexIncome);
- }
- return compensateIncome;
- }
- /**
- * 一般劳务报酬所得列表
- *
- * @param caluDataMap
- * @return
- */
- private List<ComplexIncome> getLaborRemunerationIncome(Map<String, List<Map<String, Object>>> caluDataMap) {
- List<ComplexIncome> laborRemunerationIncome = new ArrayList<>();
- List<Map<String, Object>> list = caluDataMap.get("lwbclb");
- for (int i = 0; list != null && i < list.size(); i++) {
- Map<String, Object> map = list.get(i);
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名*
- complexIncome.setName((String) map.get("personName"));
- //证件类型名称*
- complexIncome.setLicenseType((String) map.get("cardType"));
- //证件号码*
- complexIncome.setLicenseNumber((String) map.get("cardNumber"));
- //是否明细申报
- //complexIncome.setIsDetailedDeclaration("");
- //当期收入额*
- complexIncome.setIncome((BigDecimal) map.get("t1"));
- //免税收入
- complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
- //商业健康保险
- complexIncome.setCommercialHealthInsurance((BigDecimal) map.get("t13"));
- //税延养老保险
- complexIncome.setExtensionEndowmentInsurance((BigDecimal) map.get("t14"));
- //其他
- //complexIncome.setOther(BigDecimal.ZERO);
- //减免税额
- complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
- //备注
- //complexIncome.setRemark("");
- //减除费用
- // complexIncome.setDeductionAmount(BigDecimal.ZERO);
- //应纳税额
- //complexIncome.setPayableAmount(BigDecimal.ZERO);
- //税率
- //complexIncome.setTaxRate(BigDecimal.ZERO);
- //所得项目名称*
- complexIncome.setIncomeItemName("一般劳务报酬所得");
- //允许扣除的税费
- complexIncome.setTaxDeductible((BigDecimal) map.get("t18"));
- laborRemunerationIncome.add(complexIncome);
- }
- return laborRemunerationIncome;
- }
- /**
- * 获取全年一次性奖金
- * taxItemPlanName 个税项目名称
- * cmpschemeid 计算规则ID
- *
- * @return
- */
- public ComplexIncome getAnnualOneTimeBonusIncome() throws SQLException, BOSException {
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名
- complexIncome.setName(personName);
- //证照类型
- complexIncome.setLicenseType(cardType);
- complexIncome.setLicenseNumber(cardNumber);
- //税后收入额
- complexIncome.setAbroadIncome(new BigDecimal("123123"));
- //收入额
- complexIncome.setIncome(new BigDecimal("10000"));
- return complexIncome;
- }
- /**
- * 全年一次性奖金收入列表
- *
- * @return
- */
- private List<ComplexIncome> getAnnualOneTimeBonusIncomeList(
- Map<String, List<Map<String, Object>>> caluDataMap) {
- List<ComplexIncome> annualOneTimeBonusIncome = new ArrayList<>();
- List<Map<String, Object>> list = caluDataMap.get("qnycxjjsslb");
- for (int i = 0; list != null && i < list.size(); i++) {
- Map<String, Object> map = list.get(i);
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名*
- complexIncome.setName((String) map.get("personName"));
- //证件类型名称*
- complexIncome.setLicenseType((String) map.get("cardType"));
- //证件号码*
- complexIncome.setLicenseNumber((String) map.get("cardNumber"));
- //当期收入额*
- complexIncome.setIncome((BigDecimal) map.get("t1"));
- //免税收入
- complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
- //其他
- //complexIncome.setOther(BigDecimal.ZERO);
- //减免税额
- complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
- //备注
- //complexIncome.setRemark("");
- //所得项目名称*
- complexIncome.setIncomeItemName("全年一次性奖金收入");
- //准予扣除的捐赠额
- complexIncome.setDeductibleDonation((BigDecimal) map.get("t16"));
- annualOneTimeBonusIncome.add(complexIncome);
- }
- return annualOneTimeBonusIncome;
- }
- /**
- * 获取正常工资薪金对象
- *
- * @return
- */
- public NormalSalarySpecIncome getNormalSalarySpecIncomes() throws BOSException, EASBizException {
- //正常工资薪金对象
- NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
- //正常工资薪金列表
- List<ComplexIncome> normalSalarySpec = new ArrayList();
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名
- complexIncome.setName(personName);
- //证照类型
- complexIncome.setLicenseType(cardType);
- complexIncome.setLicenseNumber(cardNumber);
- //税后收入额
- complexIncome.setAbroadIncome(new BigDecimal("10000"));
- //收入额
- complexIncome.setIncome(new BigDecimal("10000"));
- //所得项目名称
- complexIncome.setIncomeItemName("正常工资薪金");
- normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec);
- return normalSalarySpecIncome;
- }
- /**
- * 人员
- *
- * @return
- */
- public DetailCompanyEmployee getDetailCompanyEmployee() {
- //人员对象
- DetailCompanyEmployee detailCompanyEmployee = new DetailCompanyEmployee();
- //姓名
- detailCompanyEmployee.setName(personName);
- //证照类型
- detailCompanyEmployee.setLicenseType(cardType);
- //证照号码
- detailCompanyEmployee.setLicenseNumber(cardNumber);
- //人员状态
- //detailCompanyEmployee.setState(personInfo.getEmployeeType().getName());
- ////人员报税信息->任职受雇从业信息
- //ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
- //TaxPersonRecordEntryCollection taxPersonRecordEntryCollection = iTaxPersonRecordEntry.getTaxPersonRecordEntryCollection("where person.id = '" + personInfo.getId() + "'");
- //TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntryCollection.get(0);
- //任职受雇类型 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
- detailCompanyEmployee.setIsEmployee("雇员");
- //手机号
- detailCompanyEmployee.setPhone("13333282630");
- //detailCompanyEmployee.setIsEmployee(taxPersonRecordEntryInfo.getEmployedType().getAlias());
- //受雇日期 YYYY-MM-DD,不能大于当前时间,任职受雇类型选择雇员、保险营销员、证券经纪人时必录
- SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
- detailCompanyEmployee.setEmployedDate("2022-10-02");
- ////性别
- detailCompanyEmployee.setGender("女");
- ////出生日期
- detailCompanyEmployee.setBirthday("2001-01-01");
- //国籍 nationality
- //NationalityInfo nationality = personInfo.getNationality();
- detailCompanyEmployee.setNationality("中国");
- return detailCompanyEmployee;
- }
- /**
- * 获取正常工资薪金参数
- *
- * @return
- */
- private NormalSalarySpecIncome getNormalSalarySpecIncome
- (Map<String, List<Map<String, Object>>> caluDataMap) {
- //正常工资薪金对象
- NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
- //正常工资薪金是否需要专项*
- //normalSalarySpecIncome.setZcgzxjsfxyzx("");
- //正常工资薪金是否传入累计(申报/单月计算时使用)
- //normalSalarySpecIncome.setZcgzxjsfcrlj("");
- //年金算税上限选项
- normalSalarySpecIncome.setAnnuityAndHouseProvidentFundOption("");
- //个人养老金策略
- normalSalarySpecIncome.setPersonalPensionOption("");
- //上月个人养老金策略
- normalSalarySpecIncome.setLastMonthPersonalPensionOption("");
- List<ComplexIncome> normalSalarySpec = new ArrayList<>();
- //正常工资薪金(带专项)列表*
- normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec);
- List<Map<String, Object>> list = caluDataMap.get("zcgzxjlb");
- for (int i = 0; list != null && i < list.size(); i++) {
- Map<String, Object> map = list.get(i);
- ComplexIncome complexIncome = new ComplexIncome();
- //姓名*
- complexIncome.setName((String) map.get("personName"));
- //证件类型名称*
- complexIncome.setLicenseType((String) map.get("cardType"));
- //证件号码*
- complexIncome.setLicenseNumber((String) map.get("cardNumber"));
- //是否明细申报
- //complexIncome.setIsDetailedDeclaration("");
- //当期收入额*
- complexIncome.setIncome((BigDecimal) map.get("t1"));
- //免税收入
- complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
- //基本养老保险
- complexIncome.setEndowmentInsurance((BigDecimal) map.get("t3"));
- //基本医疗保险
- complexIncome.setMedicalInsurance((BigDecimal) map.get("t4"));
- //失业保险
- complexIncome.setUnemploymentInsurance((BigDecimal) map.get("t5"));
- //住房公积金
- complexIncome.setHouseProvidentFund((BigDecimal) map.get("t6"));
- //子女教育支出
- complexIncome.setChildEducationExpenditure((BigDecimal) map.get("t64"));
- //赡养老人支出
- complexIncome.setSupportElderExpenditure((BigDecimal) map.get("t65"));
- //住房租金支出
- complexIncome.setHouseRentExpenditure((BigDecimal) map.get("t67"));
- //房屋贷款支出
- complexIncome.setHouseLoanExpenditure((BigDecimal) map.get("t66"));
- //继续教育支出
- complexIncome.setContinueEducationExpenditure((BigDecimal) map.get("t68"));
- //婴幼儿照护支出
- complexIncome.setBabyCareExpenditure((BigDecimal) map.get("t70"));
- //todo 企业年金/职业年金
- complexIncome.setAnnuity(BigDecimal.ZERO);
- //商业健康保险
- complexIncome.setCommercialHealthInsurance((BigDecimal) map.get("t13"));
- //税延养老保险
- complexIncome.setExtensionEndowmentInsurance((BigDecimal) map.get("t14"));
- //其他
- complexIncome.setOther(BigDecimal.ZERO);
- //减免税额
- complexIncome.setTaxDeduction(BigDecimal.ZERO);
- //备注 根据政策要求,填写【其他】项,一定在备注中写明具体扣除项目名称
- complexIncome.setRemark("");
- //应纳税额
- complexIncome.setPayableAmount(BigDecimal.ZERO);
- //已缴税额
- complexIncome.setPaidAmount(BigDecimal.ZERO);
- //税率
- complexIncome.setTaxRate(BigDecimal.ZERO);
- //所得项目名称
- complexIncome.setIncomeItemName("正常工资薪金");
- //累计收入额 本年累计收入=本期所有的工资薪金所得收入之和+往期工资薪金所得收入之和(见税款计算)
- complexIncome.setAccumulatedIncome(BigDecimal.ZERO);
- //累计专项扣除额
- complexIncome.setAccumulatedSpecDeduction(BigDecimal.ZERO);
- //累计其他扣除额
- complexIncome.setAccumulatedOtherDeduction(BigDecimal.ZERO);
- //累计减除费用额
- complexIncome.setAccumulatedDeductionAmount(BigDecimal.ZERO);
- //累计子女教育支出
- complexIncome.setAccumulatedChildEducation(BigDecimal.ZERO);
- //累计继续教育支出
- complexIncome.setAccumulatedContinueEducation(BigDecimal.ZERO);
- //累计住房租金支出
- complexIncome.setAccumulatedHouseRent(BigDecimal.ZERO);
- //累计房屋贷款支出
- complexIncome.setAccumulatedHouseLoan(BigDecimal.ZERO);
- //累计赡养老人支出
- complexIncome.setAccumulatedSupportElder(BigDecimal.ZERO);
- //累计3岁以下婴幼儿照护支出
- complexIncome.setAccumulatedBabyCare(BigDecimal.ZERO);
- //累计准予扣除的捐赠额
- complexIncome.setAccumulatedDeductibleDonation(BigDecimal.ZERO);
- //累计个人养老金
- complexIncome.setAccumulatedPersonalPension(BigDecimal.ZERO);
- //累计个人养老金校验码
- complexIncome.setAccumulatedPersonalPensionCheckCode("");
- //准予扣除的捐赠额
- complexIncome.setDeductibleDonation(BigDecimal.ZERO);
- //试用公式
- complexIncome.setFormula("");
- //境内工作天数
- complexIncome.setDomesticWorkingDays(BigDecimal.ZERO);
- //境外工作天数
- complexIncome.setAbroadWorkingDays(BigDecimal.ZERO);
- //境外支付
- complexIncome.setAbroadIncome(BigDecimal.ZERO);
- //境内支付
- complexIncome.setDomesticIncome(BigDecimal.ZERO);
- normalSalarySpec.add(complexIncome);
- }
- return normalSalarySpecIncome;
- }
- /**
- * 获取企业人员列表
- */
- private List<DetailCompanyEmployee> getCompanyEmployeeList(Map<String, List<Map<String, Object>>> caluDataMap) {
- List<DetailCompanyEmployee> companyEmployeeList = new ArrayList<>();
- List<Map<String, Object>> list = caluDataMap.get("zcgzxjlb");
- for (int i = 0; list != null && i < list.size(); i++) {
- Map<String, Object> map = list.get(i);
- DetailCompanyEmployee employee = new DetailCompanyEmployee();
- //姓名*
- employee.setName((String) map.get("personName"));
- //证件类型名称*
- employee.setLicenseType((String) map.get("cardType"));
- //证件号码*
- employee.setLicenseNumber((String) map.get("cardNumber"));
- //部门编号
- //employee.setDeptNo("");
- //工号
- employee.setEmployeeNumber((String) map.get("personNumber"));
- //所属期
- //employee.setPeriod("");
- //手机号码 中国籍必填;非中国籍首次入境时间超过一个月必填;
- employee.setPhone((String) map.get("phoneNumber"));
- //人员状态* 默认为正常,可选择正常/非正常
- employee.setState((String) map.get("personstatusName"));
- //是否雇员* 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
- employee.setIsEmployee((String) map.get("employedtypeName"));
- //入职年度就业情况 当雇员保险营销员、证券经纪人时可选择:当年首次入职学生、当年首次入职其他人员。其他情况下填写默认为空
- employee.setFirstEmploymentSituation((String) map.get("situationName"));
- //受雇日期
- employee.setEmployedDate((String) map.get("employeddate"));
- //性别* 男/女
- employee.setGender((String) map.get("gender"));
- //出生日期* YYYY-MM-DD 需要和身份证上保持一致
- employee.setBirthday((String) map.get("birthday"));
- //国籍*
- employee.setNationality((String) map.get("nationalityName"));
- //人员地区* 境内/境外
- employee.setArea((String) map.get("isoversea"));
- //离职日期
- employee.setResignDate((String) map.get("departuredate"));
- //个人投资总额
- employee.setPersonInvestment((BigDecimal) map.get("investmenttotal"));
- //个人投资比例
- employee.setPersonInvestmentRatio((BigDecimal) map.get("investmentrate"));
- //是否残疾
- String isdisability = (String) map.get("isdisability");
- employee.setIsDisabled(isdisability);
- if ("是".equals(isdisability)) {
- //todo 残疾证件类型
- employee.setDisableCardTypeName("残疾证");
- }
- //是否烈属
- employee.setIsMartyr((String) map.get("ishero"));
- //是否孤老
- employee.setIsBereavedGaffer((String) map.get("isold"));
- //残疾证号
- employee.setDisableCardNumber((String) map.get("discardnumber"));
- //烈属证号
- employee.setMartyrCardNumber((String) map.get("herocardnumber"));
- //电子邮箱
- employee.setEmail((String) map.get("email"));
- //学历
- employee.setEducation((String) map.get("diploma"));
- //职务
- employee.setPosition((String) map.get("positionName"));
- //开户银行省份(名字)
- employee.setDepositBankProvinceName((String) map.get("bankcardprovince"));
- //开户银行
- employee.setDepositBank((String) map.get("bankcardprovince"));
- //银行账号
- employee.setBankAccount((String) map.get("account"));
- //居住省份
- employee.setResidentProvince((String) map.get("address"));
- //居住城市
- employee.setResidentCity((String) map.get("addresscity"));
- //居住区县
- employee.setResidentDistrict((String) map.get("addresscounty"));
- //居住街道
- employee.setResidentStreet((String) map.get("addressstreet"));
- //户籍省份
- employee.setCensusProvince((String) map.get("hometown"));
- //户籍城市
- employee.setCensusCity((String) map.get("hometowncity"));
- //户籍区县
- employee.setCensusDistrict((String) map.get("hometowncountry"));
- //户籍街道
- employee.setCensusStreet((String) map.get("hometownstreet"));
- //户籍详细地址
- employee.setCensusAddress((String) map.get("hometowndetailed"));
- //备注
- employee.setEmpRemark((String) map.get("desc"));
- //出生地
- employee.setBirthplace((String) map.get("birthplaceName"));
- //首次入境时间
- employee.setFirstEntryDate((String) map.get("entrydate"));
- //预计离境时间
- employee.setEstimatedDepartureDate((String) map.get("leavedate"));
- //联系地省份
- employee.setContactProvince((String) map.get("contactaddress"));
- //联系地城市
- employee.setContactCity((String) map.get("contactcity"));
- //联系地区县
- employee.setContactDistrict((String) map.get("contactcountry"));
- //联系地街道
- employee.setContactStreet((String) map.get("contactstreet"));
- //联系地详细地址
- employee.setContactStreet((String) map.get("contactdetailed"));
- //中文名
- employee.setChineseName((String) map.get("chinesename"));
- //涉税事项
- employee.setTaxRelatedReason((String) map.get("taxreason"));
- //其他证件号码
- employee.setOtherLicenseNumber((String) map.get("othercardnumber"));
- //其他证件类型 其他证件类型为:外国人永久居留身份证(外国人永久居留证),外国护照,中华人民共和国外国人工作许可证(A类),中华人民共和国外国人工作许可证(B类),中华人民共和国外国人工作许可证(C类),中华人民共和国港澳居民居住证,中华人民共和国台湾居民居住证,中国护照,港澳居民来往内地通行证,台湾居民来往大陆通行证,其他证件号码必填
- employee.setOtherLicenseType((String) map.get("othercardtype"));
- //是否扣除减除费用(原是否主单位)
- employee.setIsMainUnits((String) map.get("deductfees"));
- companyEmployeeList.add(employee);
- }
- return companyEmployeeList;
- }
- }
|