package com.kingdee.eas.custom.shuiyou.taxCal.service; import cn.com.servyou.dto.ApiResponse; import cn.com.servyou.dto.AsyncResult; import cn.com.servyou.dto.tax.*; import cn.com.servyou.rmi.client.ClientProxyFactory; import cn.com.servyou.service.TaxRequest; import com.fasterxml.jackson.databind.ObjectMapper; import com.kingdee.bos.BOSException; import com.kingdee.bos.Context; import com.kingdee.bos.bsf.service.app.IHRMsfService; import com.kingdee.bos.dao.ormapping.ObjectUuidPK; import com.kingdee.eas.common.EASBizException; import com.kingdee.eas.custom.shuiyou.interfacelog.ILogInfo; import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoFactory; import com.kingdee.eas.custom.shuiyou.interfacelog.LogInfoInfo; import com.kingdee.eas.custom.shuiyou.task.MessageResult; import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum; import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory; import com.kingdee.eas.custom.shuiyou.utils.ClientProxyFactoryUtils; import com.kingdee.eas.hr.base.PositionTypeEnum; import com.kingdee.eas.hr.rec.GenderEnum; import com.kingdee.eas.util.app.DbUtil; import com.kingdee.jdbc.rowset.IRowSet; import com.kingdee.shr.compensation.CardTypeEnum; import com.kingdee.shr.compensation.EmployedTypeEnum; import com.kingdee.shr.compensation.PersonStatusEnum; import com.kingdee.shr.compensation.app.incomeTax.EmploymentSituationEnum; import com.kingdee.shr.compensation.app.tax.TaxUnitFactory; import com.kingdee.shr.compensation.app.tax.TaxUnitInfo; import com.kingdee.shr.compensation.util.Base64Utils; import com.kingdee.util.StringUtils; import org.apache.log4j.Logger; import java.math.BigDecimal; import java.text.SimpleDateFormat; import java.util.*; /** * @Description 提交异步税款计算请求 * @Date 2024/9/2 14:30 * @Created by Heyuan */ public class SubmitAsynTaxCalRequestService implements IHRMsfService { private static Logger logger = Logger.getLogger(SubmitAsynTaxCalRequestService.class); @Override public MessageResult process(Context ctx, Map paramMap) throws EASBizException, BOSException { ObjectMapper objectMapper = new ObjectMapper(); String taskId = null; ILogInfo iLogInfo = LogInfoFactory.getLocalInstance(ctx); //接口日志实体 LogInfoInfo logInfo = new LogInfoInfo(); //入口 logInfo.setEntrance(this.getClass().getName()); logInfo.setBizDate(new Date()); try { logger.info("调用 CalTaxService, 参数 " + objectMapper.writeValueAsString(paramMap)); MessageResult messageResult = null; String this_taskId = (String) paramMap.get("this_taskId");//任务id String paramData = (String) paramMap.get("paramData"); Map paramDataMap = objectMapper.readValue(paramData, Map.class); String taxUnitId = paramDataMap.get("TAXUNITID");//纳税单位id String period = paramDataMap.get("PERIOD");//周期yyyy-MM String creator = paramDataMap.get("creator");//创建人id StringBuilder errorMsg = new StringBuilder(); if (StringUtils.isEmpty(taxUnitId)) { errorMsg.append("纳税单位id不能为空!\n"); } if (StringUtils.isEmpty(period)) { errorMsg.append("周期yyyy-MM不能为空!\n"); } if (errorMsg.length() > 0) { throw new BOSException(errorMsg.toString()); } //客户端代理工厂 ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory(); TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(ctx).getTaxUnitInfo(new ObjectUuidPK(taxUnitId)); //获取待计算数据 Map>> caluDataMap = getCaluData(ctx, paramDataMap); //算税请求接口 TaxRequest taxRequest = clientProxyFactory.getTaxRequest(); //获取请求参数 CalculateIndividualIncomeTaxRequest taxRequestPara = getTaxRequestParameter(taxUnitInfo, caluDataMap, period); //调用异步算税接口 ApiResponse asyncResultApiResponse = taxRequest.calculateASynIndividualIncomeTax(taxRequestPara); String status = asyncResultApiResponse.getHead().getStatus(); logInfo.setInterfaceAddress("/gateway/iit/calculateTax/calculateASynIndividualIncomeTax");//接口地址 logInfo.setInterfaceName("calculateASynIndividualIncomeTax");//接口名 ObjectMapper mapper = new ObjectMapper(); logInfo.setInParameter(mapper.writeValueAsString(taxRequestPara));//入参 logInfo.setOutParameter(mapper.writeValueAsString(asyncResultApiResponse));//回参 if ("N".equals(status)) { //请求失败响应 String msg = asyncResultApiResponse.getHead().getMsg(); messageResult = MessageResult.FAILED(msg); logInfo.setErrorInfo(msg);//错误信息 logInfo.setStatus("失败"); } else { //调用成功 //请求id String requestId = asyncResultApiResponse.getBody().getRequestId(); logInfo.setStatus("成功"); paramDataMap.put("requestId", requestId); String backParam = mapper.writeValueAsString(paramDataMap); // 创建轮询请求任务 taskId = SYUtilsFacadeFactory.getLocalInstance(ctx).addTask( "getASynIndividualIncomeTaxFeedback", backParam, TaskCatalogEnum.CAL_GET, ""); messageResult = MessageResult.SUCCESS(); Map map = new HashMap(); messageResult.setData(map); map.put("taskId", taskId); map.put("requestId", requestId); } iLogInfo.addnew(logInfo); return messageResult; } catch (Exception e) { e.printStackTrace(); logInfo.setErrorInfo(e.getMessage());//错误信息 iLogInfo.addnew(logInfo); return MessageResult.ERROR(e.getMessage()); } } /** * 获取待计算数据 */ private Map>> getCaluData(Context ctx, Map paramDataMap) throws BOSException { try { String taxUnitId = paramDataMap.get("TAXUNITID");//纳税单位id String period = paramDataMap.get("PERIOD");//周期yyyy-MM String creator = paramDataMap.get("creator");//创建人id String initIds = paramDataMap.get("initIds");//初算数据id StringBuilder sql = new StringBuilder(); sql.append("SELECT ").append("\n") .append("item.fnumber AS itemNumber,").append("\n") .append("personRe.FCARDNUMBER,").append("\n") .append("personRe.FCARDTYPE,").append("\n") .append("(CASE WHEN personRe.FREPORTNAME IS NOT NULL THEN personRe.FREPORTNAME ELSE person.fname_l2 END) AS personName,").append("\n") .append("person.fnumber AS personNumber,").append("\n") .append("personRe.FPHONENUMBER,").append("\n") // 手机号 .append("personRe.FISOVERSEA,").append("\n") // 是否境外人员 .append("personRe.FGENDER,").append("\n") // 性别 .append("personRe.FBIRTHDAY,").append("\n") // 出生日期 .append("personRe.FISDISABILITY,").append("\n") // 是否残疾 .append("personRe.FDISCARDNUMBER,").append("\n") // 残疾证号 .append("personRe.FHEROCARDNUMBER,").append("\n") // 烈属证号 .append("personRe.FEMAIL,").append("\n") // 电子邮箱 .append("personRe.FCHINESENAME,").append("\n") // 中文名 .append("personRe.FISHERO,").append("\n") // 是否烈属 .append("personRe.FISOLD,").append("\n") // 是否孤老 .append("personRe.FADDRESS,").append("\n") // 居住地省 .append("personRe.FADDRESSCITY,").append("\n") // 居住城市 .append("personRe.FADDRESSCOUNTY,").append("\n") // 居住区县 .append("personRe.FADDRESSSTREET,").append("\n") // 居住街道 .append("personRe.FDESC,").append("\n") // 备注 .append("personRe.FHOMETOWN,").append("\n") // 户籍省份 .append("personRe.FHOMETOWNCITY,").append("\n") // 户籍城市 .append("personRe.FHOMETOWNCOUNTRY,").append("\n") // 户籍区县 .append("personRe.FHOMETOWNSTREET,").append("\n") // 户籍街道 .append("personRe.FHOMETOWNDETAILED,").append("\n") // 户籍详细地址 .append("personRe.FACCOUNT,").append("\n") // 银行账号 .append("personRe.FOTHERCARDTYPE,").append("\n") // 其他证件类型 .append("personRe.FOTHERCARDNUMBER,").append("\n") // 其他证件号码 .append("personRe.FTAXREASON,").append("\n") // 涉税事项 .append("personRe.FBANKCARDPROVINCE,").append("\n") // 开户银行省份 .append("bank.fname_l2 AS bankName,").append("\n") // 开户银行 .append("personRe.FCONTACTADDRESS,").append("\n") // 联系地址_省 .append("personRe.FCONTACTCITY,").append("\n") // 联系地城市 .append("personRe.FCONTACTCOUNTRY,").append("\n") // 联系地区县 .append("personRe.FCONTACTSTREET,").append("\n") // 联系地街道 .append("personRe.FCONTACTDETAILED,").append("\n") // 联系地详细地址 .append("personRe.FENTRYDATE,").append("\n") // 首次入境时间 .append("personRe.FLEAVEDATE,").append("\n") // 预计离境时间 .append("personRe.FPOSITION,").append("\n") // 职务 .append("personRe.FINVESTMENTTOTAL,").append("\n") // 个人投资总额 .append("personRe.FINVESTMENTRATE,").append("\n") // 个人投资比例 .append("birthplace.FNAME_L2 AS birthplaceName,").append("\n") // 出生地 .append("nationality.FNAME_L2 AS nationalityName,").append("\n") // 国籍 .append("diploma.fnumber AS diplomaNumber,").append("\n") // 学历编码 .append("personReEntry.FPERSONSTATUS,").append("\n") // 人员状态 .append("personReEntry.FEMPLOYEDDATE,").append("\n") // 受雇日期 .append("personReEntry.FDEPARTUREDATE,").append("\n") // 离职日期 .append("personReEntry.FEMPLOYEDTYPE,").append("\n") // 任职受雇从业类型 .append("personReEntry.FSITUATION,").append("\n") // 就业情况 .append("personReEntry.FDEDUCTFEES,").append("\n") // 是否扣除减除费用 .append("scid.t1,").append("\n") // 当期收入额 .append("scid.t2,").append("\n") // 免税收入 .append("scid.t3,").append("\n") // 基本养老保险 .append("scid.t4,").append("\n") // 基本医疗保险 .append("scid.t5,").append("\n") // 失业保险 .append("scid.t6,").append("\n") // 住房公积金 .append("scid.t12,").append("\n") // 企业年金 .append("scid.t13,").append("\n") // 商业健康保险 .append("scid.t14,").append("\n") // 税延养老保险 .append("scid.t16,").append("\n") // 准予扣除的捐赠额 .append("scid.t17,").append("\n") // 减免税额 .append("scid.t18,").append("\n") // 允许扣除的税费 .append("scid.t39,").append("\n") // 一次性补偿 .append("scid.t64,").append("\n") // 子女教育支出 .append("scid.t65,").append("\n") // 赡养老人支出 .append("scid.t66,").append("\n") // 房屋贷款支出 .append("scid.t67,").append("\n") // 住房租金支出 .append("scid.t68,").append("\n") // 继续教育支出 .append("scid.t70 ").append("\n") // 婴幼儿照护支出 .append("FROM T_HR_STaxCalInitDetail scid ").append("\n") .append("LEFT JOIN T_HR_STaxIncomeItem item ON item.fid = scid.FINCOMEITEMID ").append("\n") .append("LEFT JOIN T_HR_STaxPersonRecordentry personReEntry ON personReEntry.fPersonId = scid.fPersonId AND scid.fTaxUnitId = personReEntry.fTaxUnitId ").append("\n") .append("LEFT JOIN T_HR_STaxPersonRecord personRe ON personReEntry.FBILLID = personRe.fid ").append("\n") .append("LEFT JOIN T_BD_Person person ON person.fid = personRe.FPERSONID ").append("\n") .append("LEFT JOIN T_BD_Nationality birthplace ON birthplace.fid = personRe.FBIRTHPLACEID ").append("\n") .append("LEFT JOIN T_BD_HRDiploma diploma ON diploma.fid = personRe.FEDULEVELID ").append("\n") .append("LEFT JOIN T_HR_PBank bank ON bank.fid = personRe.FHRBANKID ").append("\n") .append("LEFT JOIN T_BD_Nationality nationality ON nationality.fid = personRe.FNATIONALITYID ").append("\n") .append("WHERE scid.FTAXUNITID = '").append(taxUnitId).append("'").append("\n") .append("AND scid.FSTATE = '30' ").append("\n") .append("AND scid.fid in(").append(initIds).append(")").append("\n"); logger.info("getCaluData.sql:\n" + sql); IRowSet iRowSet = DbUtil.executeQuery(ctx, sql.toString()); Map>> dataMap = new HashMap<>(); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); while (iRowSet.next()) { List> list; //所得项目编码 String itemNumber = iRowSet.getString("itemNumber"); if (dataMap.containsKey(itemNumber)) { list = dataMap.get(itemNumber); } else { list = new ArrayList<>(); dataMap.put(itemNumber, list); } Map map = new HashMap(); //姓名 map.put("personName", iRowSet.getString("personName")); //工号 map.put("personNumber", iRowSet.getString("personNumber")); //证件号码 map.put("cardNumber", iRowSet.getString("FCARDNUMBER")); //证件类型 String cardType = iRowSet.getString("FCARDTYPE"); if (!StringUtils.isEmpty(cardType)) { CardTypeEnum anEnum = CardTypeEnum.getEnum(cardType); if (anEnum != null) { map.put("cardType", anEnum.getAlias()); } } //人员状态 String personstatus = iRowSet.getString("FPERSONSTATUS"); if (personstatus != null) { PersonStatusEnum anEnum = PersonStatusEnum.getEnum(personstatus); if (anEnum != null) { map.put("personstatusName", anEnum.getAlias()); } } //任职受雇从业类型 String employedtype = iRowSet.getString("FEMPLOYEDTYPE"); if (!StringUtils.isEmpty(employedtype)) { EmployedTypeEnum anEnum = EmployedTypeEnum.getEnum(employedtype); if (anEnum != null) { map.put("employedtypeName", anEnum.getAlias()); } } //手机号码 map.put("phoneNumber", iRowSet.getString("FPHONENUMBER")); //就业情况 Integer situation = iRowSet.getInt("FSITUATION"); if (situation != null) { EmploymentSituationEnum anEnum = EmploymentSituationEnum.getEnum(situation); if (anEnum != null) { map.put("situationName", anEnum.getAlias()); } } //性别 String gender = iRowSet.getString("FGENDER"); if (!StringUtils.isEmpty(gender)) { GenderEnum anEnum = GenderEnum.getEnum(gender); if (anEnum != null) { map.put("gender", anEnum.getAlias()); } } //否境外人员 String isoversea = iRowSet.getString("FISOVERSEA"); if ("1".equals(isoversea)) { map.put("isoversea", "境外"); } else if ("0".equals(isoversea)) { map.put("isoversea", "境内"); } //是否残疾 String isdisability = iRowSet.getString("FISDISABILITY"); if ("1".equals(isdisability)) { map.put("isdisability", "是"); } else { map.put("isdisability", "否"); } //残疾证号 map.put("discardnumber", iRowSet.getString("FDISCARDNUMBER")); //是否烈属 String ishero = iRowSet.getString("FISHERO"); if ("1".equals(ishero)) { map.put("ishero", "是"); } else { map.put("ishero", "否"); } //烈属证号 map.put("herocardnumber", iRowSet.getString("FHEROCARDNUMBER")); //是否孤老 String isold = iRowSet.getString("FISOLD"); if ("1".equals(isold)) { map.put("isold", "是"); } else { map.put("isold", "否"); } //是否扣除减除费用 String deductfees = iRowSet.getString("FDEDUCTFEES"); if ("0".equals(deductfees)) { map.put("deductfees", "是"); } else { map.put("deductfees", "否"); } //职务 String position = iRowSet.getString("FPOSITION"); if (!StringUtils.isEmpty(position)) { PositionTypeEnum anEnum = PositionTypeEnum.getEnum(position); if (anEnum != null) { map.put("positionName", anEnum.getAlias()); } } //电子邮箱 map.put("email", iRowSet.getString("FEMAIL")); //个人投资总额 map.put("investmenttotal", iRowSet.getBigDecimal("FINVESTMENTTOTAL")); //个人投资比例 map.put("investmentrate", iRowSet.getBigDecimal("FINVESTMENTRATE")); //中文名 map.put("chinesename", iRowSet.getString("FCHINESENAME")); //出生日期 Date birthday = iRowSet.getDate("FBIRTHDAY"); if (birthday != null) { map.put("birthday", sdf.format(birthday)); } //受雇日期 Date employeddate = iRowSet.getDate("FEMPLOYEDDATE"); if (employeddate != null) { map.put("employeddate", sdf.format(employeddate)); } //离职日期 Date departuredate = iRowSet.getDate("FDEPARTUREDATE"); if (departuredate != null) { map.put("departuredate", sdf.format(departuredate)); } //出生地 map.put("birthplaceName", iRowSet.getString("birthplaceName")); //学历 int diplomaNumber = iRowSet.getInt("diplomaNumber"); //todo 大学本科以下 大学本科 研究生 if (diplomaNumber < 6) { map.put("diploma", "大学本科以下"); } else if (diplomaNumber == 6) { map.put("diploma", "大学本科"); } else if (diplomaNumber > 6) { map.put("diploma", "研究生"); } //开户银行省份 map.put("bankcardprovince", iRowSet.getString("FBANKCARDPROVINCE")); //开户银行 map.put("bankName", iRowSet.getString("bankName")); //银行账号 map.put("account", iRowSet.getString("FACCOUNT")); //其他证件类型 map.put("othercardtype", iRowSet.getString("FOTHERCARDTYPE")); //其他证件号码 map.put("othercardnumber", iRowSet.getString("FOTHERCARDNUMBER")); //居住地省 map.put("address", iRowSet.getString("FADDRESS")); //居住城市 map.put("addresscity", iRowSet.getString("FADDRESSCITY")); //居住区县 map.put("addresscounty", iRowSet.getString("FADDRESSCOUNTY")); //居住街道 map.put("addressstreet", iRowSet.getString("FADDRESSSTREET")); //户籍省份 map.put("hometown", iRowSet.getString("FHOMETOWN")); //户籍城市 map.put("hometowncity", iRowSet.getString("FHOMETOWNCITY")); //户籍城市 map.put("hometowncountry", iRowSet.getString("FHOMETOWNCOUNTRY")); //户籍街道 map.put("hometownstreet", iRowSet.getString("FHOMETOWNSTREET")); //户籍详细地址 map.put("hometowndetailed", iRowSet.getString("FHOMETOWNDETAILED")); //国籍 map.put("nationalityName", iRowSet.getString("nationalityName")); //涉税事项 map.put("taxreason", iRowSet.getString("FTAXREASON")); //首次入境时间 Date entrydate = iRowSet.getDate("FENTRYDATE"); if (entrydate != null) { map.put("entrydate", sdf.format(entrydate)); } //预计离境时间 Date leavedate = iRowSet.getDate("FLEAVEDATE"); if (leavedate != null) { map.put("leavedate", sdf.format(leavedate)); } //联系地址_省 map.put("contactaddress", iRowSet.getString("FCONTACTADDRESS")); //联系地城市 map.put("contactcity", iRowSet.getString("FCONTACTCITY")); //联系地区县 map.put("contactcountry", iRowSet.getString("FCONTACTCOUNTRY")); //联系地街道 map.put("contactstreet", iRowSet.getString("FCONTACTSTREET")); //联系地详细地址 map.put("contactdetailed", iRowSet.getString("FCONTACTDETAILED")); //备注 map.put("desc", iRowSet.getString("FDESC")); //本期收入 map.put("t1", iRowSet.getBigDecimal("t1")); //本期免税收入 map.put("t2", iRowSet.getBigDecimal("t2")); //基本养老保险 map.put("t3", iRowSet.getBigDecimal("t3")); //基本医疗保险 map.put("t4", iRowSet.getBigDecimal("t4")); //失业保险 map.put("t5", iRowSet.getBigDecimal("t5")); //住房公积金 map.put("t6", iRowSet.getBigDecimal("t6")); //企业年金 map.put("t12", iRowSet.getBigDecimal("t12")); //商业健康保险 map.put("t13", iRowSet.getBigDecimal("t13")); //税延养老保险 map.put("t14", iRowSet.getBigDecimal("t14")); //准予扣除的捐赠额 map.put("t16", iRowSet.getBigDecimal("t16")); //允许扣除的税费 map.put("t18", iRowSet.getBigDecimal("t18")); //一次性补偿 map.put("t39", iRowSet.getBigDecimal("t39")); //子女教育支出 map.put("t64", iRowSet.getBigDecimal("t64")); //赡养老人支出 map.put("t65", iRowSet.getBigDecimal("t65")); //房屋贷款支出 map.put("t66", iRowSet.getBigDecimal("t66")); //住房租金支出 map.put("t67", iRowSet.getBigDecimal("t67")); //继续教育支出 map.put("t68", iRowSet.getBigDecimal("t68")); //婴幼儿照护支出 map.put("t70", iRowSet.getBigDecimal("t70")); list.add(map); } return dataMap; } catch (Exception e) { e.printStackTrace(); throw new BOSException("获取待计算数据报错:" + e.getMessage()); } } /** * 获取请求参数 * * @param taxUnitInfo * @param caluDataMap * @param period * @return * @throws BOSException */ private CalculateIndividualIncomeTaxRequest getTaxRequestParameter( TaxUnitInfo taxUnitInfo, Map>> caluDataMap, String period) throws BOSException { //异步算税参数对象 CalculateIndividualIncomeTaxRequest taxRequestPara = new CalculateIndividualIncomeTaxRequest(); //随机id String bizNo = UUID.randomUUID().toString(); //外部业务订单号* taxRequestPara.setBizNo(bizNo); //企业名称* taxRequestPara.setName(taxUnitInfo.getName()); //taxRequestPara.setName("荆州九州通医药有限公司00"); //税号* taxRequestPara.setTaxNo(taxUnitInfo.getTaxNumber()); //taxRequestPara.setTaxNo("91310124834931897I"); //行政区划代码* taxRequestPara.setArea(taxUnitInfo.getAreaCode()); //taxRequestPara.setArea("310101"); //登记序号 taxRequestPara.setRegistrationNumber(taxUnitInfo.getRegNumber()); //taxRequestPara.setRegistrationNumber("10117310124834931897"); //部门编号 //taxRequestPara.setDeptNo(""); //部门名称 //taxRequestPara.setDeptName(""); //税款所属期YYYYMM* taxRequestPara.setMonth(period.replace("-", "")); //实名账号 //taxRequestPara.setRealNameAccount(); //实名密码 //taxRequestPara.setRealNamePassword(); //加密实名密码 //taxRequestPara.setEncryptedRealNamePassword(); //申报密码 //taxRequestPara.setDeclarePassword("Aa123456"); String declPassword = taxUnitInfo.getDeclPassword(); if (StringUtils.isEmpty(declPassword)) { throw new BOSException("申报密码不能为空!"); } taxRequestPara.setDeclarePassword(Base64Utils.decode(declPassword)); //加密申报密码 //taxRequestPara.setEncryptedDeclarePassword(); //密码类型* taxRequestPara.setPasswordType("0"); //综合所得 //综合所得对象 ComplexIncomeRequest complexIncomeRequest = new ComplexIncomeRequest(); taxRequestPara.setComplexIncomeRequest(complexIncomeRequest); //是否离线算薪 //complexIncomeRequest.setIsOffLineCalculateTax(); //减免方式 //complexIncomeRequest.setDeductionMode(); //减免比例 //complexIncomeRequest.setRatio(); //减免限额 //complexIncomeRequest.setLimitAmount(); //正常工资薪金对象 NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncome(caluDataMap); complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome); //全年一次性奖金收入列表 List annualOneTimeBonusIncomeList = getAnnualOneTimeBonusIncomeList(caluDataMap); complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncomeList); //一般劳务报酬所得列表 List laborRemunerationIncome = getLaborRemunerationIncome(caluDataMap); complexIncomeRequest.setLaborRemunerationIncome(laborRemunerationIncome); //解除劳动合同一次性补偿金列表 List compensateIncome = getCompensateIncome(caluDataMap); complexIncomeRequest.setCompensateIncome(compensateIncome); return taxRequestPara; } /** * 解除劳动合同一次性补偿金列表 * * @param caluDataMap * @return */ private List getCompensateIncome( Map>> caluDataMap) { List compensateIncome = new ArrayList(); List> list = caluDataMap.get("jcldhtlb"); for (int i = 0; list != null && i < list.size(); i++) { //个税应用+税款计算初算明细表 Map 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("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 getLaborRemunerationIncome(Map>> caluDataMap) { List laborRemunerationIncome = new ArrayList<>(); List> list = caluDataMap.get("lwbclb"); for (int i = 0; list != null && i < list.size(); i++) { Map 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; } /** * 全年一次性奖金收入列表 * * @return */ private List getAnnualOneTimeBonusIncomeList( Map>> caluDataMap) { List annualOneTimeBonusIncome = new ArrayList<>(); List> list = caluDataMap.get("qnycxjjsslb"); for (int i = 0; list != null && i < list.size(); i++) { Map 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.setBatchNo(0); //当期收入额* 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 */ private NormalSalarySpecIncome getNormalSalarySpecIncome (Map>> caluDataMap) { //正常工资薪金对象 NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome(); //企业人员列表* List companyEmployeeList = getCompanyEmployeeList(caluDataMap); normalSalarySpecIncome.setCompanyEmployeeList(companyEmployeeList); //正常工资薪金是否需要专项* //normalSalarySpecIncome.setZcgzxjsfxyzx(""); //正常工资薪金是否传入累计(申报/单月计算时使用) //normalSalarySpecIncome.setZcgzxjsfcrlj(""); //支持上月传专项或者累计专项金额(仅对两月算税上月薪金列表算税数据生效) //normalSalarySpecIncome.setZcgzxjsfcrzx(""); //是否已申报上月正常工资薪金(两个月算税场景) //normalSalarySpecIncome.setDeclaredLastMonth(""); //批次号(一月多次发薪) //normalSalarySpecIncome.setBatchNo(0); //导入上月正常工资薪金(一月多次发薪) normalSalarySpecIncome.setImportLastMonthSalaryOption(""); //是否需要人员申报 normalSalarySpecIncome.setDeclareEmployeeOption(""); //年金算税上限选项 normalSalarySpecIncome.setAnnuityAndHouseProvidentFundOption(""); //是否使用上月传入的应补退税额 normalSalarySpecIncome.setMultiCalculateTaxUseRefundTax(""); //个人养老金策略 normalSalarySpecIncome.setPersonalPensionOption(""); //上月个人养老金策略 normalSalarySpecIncome.setLastMonthPersonalPensionOption(""); //离职日期处理策略 normalSalarySpecIncome.setResignDateStrategy(""); //是否使用已报送人员信息进行补全 //normalSalarySpecIncome.setSfsybsrybq(); //上月正常工资薪金(带专项)列表 //normalSalarySpecIncome.setLastMonthNormalSalary(); List normalSalarySpec = new ArrayList<>(); //正常工资薪金(带专项)列表* normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec); List> list = caluDataMap.get("zcgzxjlb"); for (int i = 0; list != null && i < list.size(); i++) { Map 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")); // 企业年金/职业年金 complexIncome.setAnnuity((BigDecimal) map.get("t12")); //商业健康保险 complexIncome.setCommercialHealthInsurance((BigDecimal) map.get("t13")); //税延养老保险 complexIncome.setExtensionEndowmentInsurance((BigDecimal) map.get("t14")); //其他 //complexIncome.setOther(BigDecimal.ZERO); normalSalarySpec.add(complexIncome); } return normalSalarySpecIncome; } /** * 获取企业人员列表 */ private List getCompanyEmployeeList(Map>> caluDataMap) { List companyEmployeeList = new ArrayList<>(); List> list = caluDataMap.get("zcgzxjlb"); for (int i = 0; list != null && i < list.size(); i++) { Map 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; } }