IncomeTaxDeclareListHandlerEx.java 38 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810
  1. package com.kingdee.eas.custom.compensation.handler;
  2. import cn.com.servyou.dto.ApiResponse;
  3. import cn.com.servyou.dto.AsyncResult;
  4. import cn.com.servyou.dto.declare.CompanyDeclareRequest;
  5. import cn.com.servyou.dto.tax.*;
  6. import cn.com.servyou.rmi.client.ClientProxyFactory;
  7. import cn.com.servyou.service.DeclarationRequest;
  8. import com.alibaba.fastjson.JSONObject;
  9. import com.fasterxml.jackson.databind.ObjectMapper;
  10. import com.kingdee.bos.BOSException;
  11. import com.kingdee.bos.Context;
  12. import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
  13. import com.kingdee.eas.basedata.hraux.NationalityInfo;
  14. import com.kingdee.eas.basedata.person.PersonInfo;
  15. import com.kingdee.eas.common.EASBizException;
  16. import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
  17. import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
  18. import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
  19. import com.kingdee.eas.custom.shuiyou.utils.ClientProxyFactoryUtils;
  20. import com.kingdee.shr.base.syssetting.context.SHRContext;
  21. import com.kingdee.shr.base.syssetting.exception.SHRWebException;
  22. import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
  23. import com.kingdee.shr.compensation.app.tax.*;
  24. import com.kingdee.shr.compensation.util.Base64Utils;
  25. import com.kingdee.shr.compensation.web.handler.tax.IncomeTaxDeclareListHandler;
  26. import com.kingdee.util.StringUtils;
  27. import org.apache.log4j.Logger;
  28. import org.springframework.ui.ModelMap;
  29. import javax.servlet.http.HttpServletRequest;
  30. import javax.servlet.http.HttpServletResponse;
  31. import java.io.IOException;
  32. import java.math.BigDecimal;
  33. import java.sql.SQLException;
  34. import java.text.SimpleDateFormat;
  35. import java.util.*;
  36. /**
  37. * @author qingwu
  38. * @date 2024/9/18
  39. * @apiNote 个税申报扩展
  40. */
  41. public class IncomeTaxDeclareListHandlerEx extends IncomeTaxDeclareListHandler {
  42. Logger logger = Logger.getLogger("com.kingdee.eas.custom.compensation.handler.IncomeTaxDeclareListHandlerEx");
  43. String personName = "测试姜凌";
  44. String cardType = "居民身份证";
  45. String cardNumber = "828888201005039412";
  46. /**
  47. * 个税申报
  48. *
  49. * @param request
  50. * @param response
  51. * @param modelMap
  52. */
  53. public void taxDeclaresAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
  54. logger.error("taxDeclareAction-----start-------");
  55. Context ctx = SHRContext.getInstance().getContext();
  56. //个税申报
  57. //String selectedId = request.getParameter("selectedId");
  58. //String sqlInString = CmpUtils.spiltToSqlString(selectedId);
  59. //if (StringUtils.isEmpty(sqlInString)) {
  60. // sqlInString = "''";
  61. //}
  62. try {
  63. //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 + " )";
  64. //IncomeTaxDeclarCollection declareCollection = IncomeTaxDeclarFactory.getLocalInstance(ctx).getIncomeTaxDeclarCollection(oqlBuffer);
  65. IncomeTaxDeclarCollection declareCollection = new IncomeTaxDeclarCollection();
  66. Map<String, List<Map<String, Object>>> declareDataMap = null;
  67. List<Map<String, Object>> list = new ArrayList<>();
  68. Map<String, Object> map = new HashMap<>();
  69. map.put("personName", personName);
  70. map.put("cardType", cardType);
  71. map.put("cardNumber",cardNumber);
  72. if (declareCollection.size() == 0) {
  73. declareCollection.add(new IncomeTaxDeclarInfo());
  74. }
  75. ApiResponse<AsyncResult> apiResponse = null;
  76. ObjectMapper mapper = new ObjectMapper();
  77. for (int i = 0; i < declareCollection.size(); i++) {
  78. IncomeTaxDeclarInfo incomeTaxDeclarInfo = declareCollection.get(i);
  79. //纳税单位
  80. //TaxUnitInfo taxUnitInfo = incomeTaxDeclarInfo.getTaxUnit();
  81. TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(ctx).getTaxUnitInfo(new ObjectUuidPK("FqEAAACXVqyPHZiq"));
  82. //年月
  83. //String yearMonth = incomeTaxDeclarInfo.getYearMonth();
  84. //反算服务
  85. ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
  86. //算税请求接口
  87. DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
  88. //获取请求参数
  89. //获取请求参数
  90. CompanyDeclareRequest declareRequestParameter = getDeclareRequestParameter(taxUnitInfo, declareDataMap, "202408");
  91. //申报数据报送
  92. apiResponse = declarationRequest.send(declareRequestParameter);
  93. logger.error("asyncResultApiResponse-----getCode-------" + apiResponse.getHead().getCode());
  94. logger.error("asyncResultApiResponse-----getMsg--------" + apiResponse.getHead().getMsg());
  95. if (apiResponse.getHead().getCode().equals("00000000")) {
  96. AsyncResult body = apiResponse.getBody();
  97. String requestId = body.getRequestId();
  98. logger.error("requestId-----" + requestId);
  99. logger.error("apiResponse-----" + mapper.writeValueAsString(apiResponse));
  100. //查询反算反馈结果
  101. ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
  102. //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
  103. //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
  104. JSONObject json = new JSONObject();
  105. json.put("requestId", requestId);
  106. //json.put("param", jsonObject.toString());
  107. isyUtilsFacade.addTask("synIncomeTaxDeclareService", json.toJSONString(), TaskCatalogEnum.TAX, "");
  108. }
  109. }
  110. JSONUtils.writeJson(response, mapper.writeValueAsString(apiResponse));
  111. logger.error("taxDeclareAction-----end-------");
  112. } catch (IOException e) {
  113. throw new RuntimeException(e);
  114. } catch (EASBizException e) {
  115. throw new RuntimeException(e);
  116. } catch (SQLException e) {
  117. throw new RuntimeException(e);
  118. }
  119. }
  120. ///**
  121. // * 个税申报
  122. // *
  123. // * @param request
  124. // * @param response
  125. // * @param modelMap
  126. // */
  127. //@Override
  128. //public void taxDeclareAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
  129. // super.taxDeclareAction(request, response, modelMap);
  130. // logger.error("taxDeclareAction-----start-------");
  131. //
  132. // Context ctx = SHRContext.getInstance().getContext();
  133. // //个税申报
  134. // String selectedId = request.getParameter("selectedId");
  135. // String sqlInString = CmpUtils.spiltToSqlString(selectedId);
  136. // if (StringUtils.isEmpty(sqlInString)) {
  137. // sqlInString = "''";
  138. // }
  139. // try {
  140. // 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 + " )";
  141. // IncomeTaxDeclarCollection declareCollection = IncomeTaxDeclarFactory.getLocalInstance(ctx).getIncomeTaxDeclarCollection(oqlBuffer);
  142. // Map<String, List<Map<String, Object>>> declareDataMap = null;
  143. // if (declareCollection.size() == 0) {
  144. // declareCollection.add(new IncomeTaxDeclarInfo());
  145. // }
  146. // for (int i = 0; i < declareCollection.size(); i++) {
  147. // IncomeTaxDeclarInfo incomeTaxDeclarInfo = declareCollection.get(i);
  148. // //纳税单位
  149. // //TaxUnitInfo taxUnitInfo = incomeTaxDeclarInfo.getTaxUnit();
  150. // TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(ctx).getTaxUnitInfo(new ObjectUuidPK("FqEAAACXVqyPHZiq"));
  151. // //年月
  152. // //String yearMonth = incomeTaxDeclarInfo.getYearMonth();
  153. // //反算服务
  154. // ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
  155. // //算税请求接口
  156. // DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
  157. // //获取请求参数
  158. // //获取请求参数
  159. // CompanyDeclareRequest declareRequestParameter = getDeclareRequestParameter(taxUnitInfo, declareDataMap, "202408");
  160. // //申报数据报送
  161. // ApiResponse<AsyncResult> apiResponse = declarationRequest.send(declareRequestParameter);
  162. // logger.error("asyncResultApiResponse-----getCode-------" + apiResponse.getHead().getCode());
  163. // logger.error("asyncResultApiResponse-----getMsg--------" + apiResponse.getHead().getMsg());
  164. // if (apiResponse.getHead().getCode().equals("00000000")) {
  165. // AsyncResult body = apiResponse.getBody();
  166. // String requestId = body.getRequestId();
  167. // logger.error("requestId-----" + requestId);
  168. // //查询反算反馈结果
  169. // ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
  170. // //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
  171. // //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
  172. // JSONObject json = new JSONObject();
  173. // json.put("requestId", requestId);
  174. // //json.put("param", jsonObject.toString());
  175. // isyUtilsFacade.addTask("synIncomeTaxDeclareService", json.toJSONString(), TaskCatalogEnum.TAX, "");
  176. // }
  177. // }
  178. // logger.error("taxDeclareAction-----end-------");
  179. //
  180. // } catch (IOException e) {
  181. // throw new RuntimeException(e);
  182. // } catch (EASBizException e) {
  183. // throw new RuntimeException(e);
  184. // }
  185. //}
  186. /**
  187. * 获取请求参数
  188. * 注意:
  189. * 1.解除劳动合同一次性补偿金、全年一次性奖金所得,不能单独申报,需要同正常工资薪金一起申报。
  190. * 2.解除劳动合同一次性补偿金、稿酬所得,由于税务规则需要,解除劳动合同一次性补偿金、稿酬所得必须填写免税附表。
  191. *
  192. * @param taxUnitInfo
  193. * @param declareDataMap
  194. * @param yearMonth
  195. * @return
  196. */
  197. private CompanyDeclareRequest getDeclareRequestParameter(TaxUnitInfo taxUnitInfo,
  198. Map<String, List<Map<String, Object>>> declareDataMap,
  199. String yearMonth) throws BOSException, SQLException, EASBizException {
  200. CompanyDeclareRequest declareRequestPara = new CompanyDeclareRequest();
  201. //随机id
  202. String bizNo = UUID.randomUUID().toString();
  203. logger.error("bizNo:" + bizNo);
  204. //外部业务订单号*
  205. declareRequestPara.setBizNo(bizNo);
  206. //企业名称*
  207. declareRequestPara.setName(taxUnitInfo.getName());
  208. //税号*
  209. declareRequestPara.setTaxNo(taxUnitInfo.getTaxNumber());
  210. //行政区划代码*
  211. declareRequestPara.setArea(taxUnitInfo.getAreaCode());
  212. //登记序号
  213. declareRequestPara.setRegistrationNumber(taxUnitInfo.getRegNumber());
  214. //部门编号
  215. //declareRequestPara.setDeptNo("");
  216. //部门名称
  217. //declareRequestPara.setDeptName("");
  218. //税款所属期YYYYMM*
  219. declareRequestPara.setMonth(yearMonth);
  220. //实名账号
  221. //declareRequestPara.setRealNameAccount();
  222. //实名密码
  223. //declareRequestPara.setRealNamePassword();
  224. //加密实名密码
  225. //declareRequestPara.setEncryptedRealNamePassword();
  226. //申报密码
  227. //declareRequestPara.setDeclarePassword("Aa123456");
  228. String declPassword = taxUnitInfo.getDeclPassword();
  229. if (StringUtils.isEmpty(declPassword)) {
  230. throw new BOSException("申报密码不能为空!");
  231. }
  232. declareRequestPara.setDeclarePassword(Base64Utils.decode(declPassword));
  233. //加密申报密码
  234. //taxRequestPara.setEncryptedDeclarePassword();
  235. //密码类型*
  236. declareRequestPara.setPasswordType("0");
  237. //离职日期处理策略 1、不传或传1,代表离职日期自动清空,即人员状态由“非正常”变更为“正常”时,离职日期字段自动清空,默认逻辑。
  238. //2、传2离职日期不自动清空,即人员状态由“非正常”变更为“正常”时,离职日期不自动清空,客户如需清空需对离职日期字段传入空字符串。
  239. //declareRequestPara.setResignDateStrategy();
  240. //企业员工列表
  241. List<DetailCompanyEmployee> companyEmployeeList = getCompanyEmployeeList();
  242. declareRequestPara.setCompanyEmployeeList(companyEmployeeList);
  243. //综合所得
  244. //综合所得对象
  245. ComplexIncomeRequest complexIncomeRequest = new ComplexIncomeRequest();
  246. //纳税人次
  247. //complexIncomeRequest.setTaxCount();
  248. //应扣缴税额
  249. //complexIncomeRequest.setRefundTax();
  250. //减免方式
  251. //complexIncomeRequest.setDeductionMode();
  252. //减免比例
  253. //complexIncomeRequest.setRatio();
  254. //减免限额
  255. //complexIncomeRequest.setLimitAmount();
  256. ////正常工资薪金对象
  257. //NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncome(declareDataMap);
  258. //complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
  259. //全年一次性奖金收入列表
  260. //List<ComplexIncome> annualOneTimeBonusIncomeList = getAnnualOneTimeBonusIncomeList(declareDataMap);
  261. //List<ComplexIncome> annualOneTimeBonusIncomeList = new ArrayList();
  262. //ComplexIncome annualOneTimeBonusIncome = getAnnualOneTimeBonusIncome();
  263. //annualOneTimeBonusIncomeList.add(annualOneTimeBonusIncome);
  264. //complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncomeList);
  265. //一般劳务报酬所得列表
  266. //List<ComplexIncome> laborRemunerationIncome = getLaborRemunerationIncome(declareDataMap);
  267. ////解除劳动合同一次性补偿金列表
  268. //List<ComplexIncome> compensateIncome = getCompensateIncome(declareDataMap);
  269. //complexIncomeRequest.setCompensateIncome(compensateIncome);
  270. //测试 正常工资薪金对象
  271. NormalSalarySpecIncome normalSalarySpecIncome = getNormalSalarySpecIncomes();
  272. complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
  273. //测试 全年一次性奖金
  274. List<ComplexIncome> annualOneTimeBonusIncome = getAnnualOneTimeBonusIncomes();
  275. complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncome);
  276. ////测试 一般劳务报酬所得列表
  277. //List<ComplexIncome> laborRemunerationIncome = getLaborRemunerationIncomes();
  278. //complexIncomeRequest.setLaborRemunerationIncome(laborRemunerationIncome);
  279. declareRequestPara.setComplexIncomeRequest(complexIncomeRequest);
  280. return declareRequestPara;
  281. }
  282. /**
  283. * 获取一般劳务报酬所得
  284. * taxItemPlanName 个税项目名称
  285. * cmpschemeid 计算规则ID
  286. *
  287. * @return
  288. */
  289. public List<ComplexIncome> getLaborRemunerationIncomes() {
  290. List<ComplexIncome> complexIncomeList = new ArrayList();
  291. ComplexIncome complexIncome = new ComplexIncome();
  292. //姓名
  293. complexIncome.setName(personName);
  294. //证照类型
  295. complexIncome.setLicenseType(cardType);
  296. complexIncome.setLicenseNumber(cardNumber);
  297. //税后收入额
  298. complexIncome.setAbroadIncome(new BigDecimal("123123"));
  299. //收入额
  300. complexIncome.setIncome(new BigDecimal("10000"));
  301. //所得项目名称
  302. complexIncome.setIncomeItemName("一般劳务报酬所得");
  303. complexIncomeList.add(complexIncome);
  304. return complexIncomeList;
  305. }
  306. /**
  307. * 获取全年一次性奖金
  308. * taxItemPlanName 个税项目名称
  309. * cmpschemeid 计算规则ID
  310. *
  311. * @return
  312. */
  313. public List<ComplexIncome> getAnnualOneTimeBonusIncomes() {
  314. List<ComplexIncome> complexIncomeList = new ArrayList();
  315. ComplexIncome complexIncome = new ComplexIncome();
  316. //姓名
  317. complexIncome.setName(personName);
  318. //证照类型
  319. complexIncome.setLicenseType(cardType);
  320. complexIncome.setLicenseNumber(cardNumber);
  321. //税后收入额
  322. complexIncome.setAbroadIncome(new BigDecimal("123123"));
  323. //收入额
  324. complexIncome.setIncome(new BigDecimal("10000"));
  325. //所得项目名称
  326. complexIncome.setIncomeItemName("全年一次性奖金收入");
  327. complexIncomeList.add(complexIncome);
  328. return complexIncomeList;
  329. }
  330. /**
  331. * 企业员工列表*
  332. *
  333. * @return
  334. */
  335. private List<DetailCompanyEmployee> getCompanyEmployeeList() {
  336. List<DetailCompanyEmployee> companyEmployeeList = new ArrayList<DetailCompanyEmployee>();
  337. //获取人员数据
  338. DetailCompanyEmployee detailCompanyEmployee = getDetailCompanyEmployee();
  339. companyEmployeeList.add(detailCompanyEmployee);
  340. return companyEmployeeList;
  341. }
  342. /**
  343. * 解除劳动合同一次性补偿金列表
  344. *
  345. * @param caluDataMap
  346. * @return
  347. */
  348. private List<ComplexIncome> getCompensateIncome(
  349. Map<String, List<Map<String, Object>>> caluDataMap) {
  350. List<ComplexIncome> compensateIncome = new ArrayList<ComplexIncome>();
  351. List<Map<String, Object>> list = caluDataMap.get("jcldhtlb");
  352. for (int i = 0; list != null && i < list.size(); i++) {
  353. //个税应用+税款计算初算明细表
  354. Map<String, Object> map = list.get(i);
  355. ComplexIncome complexIncome = new ComplexIncome();
  356. //姓名*
  357. complexIncome.setName((String) map.get("personName"));
  358. //证件类型名称*
  359. complexIncome.setLicenseType((String) map.get("cardType"));
  360. //证件号码*
  361. complexIncome.setLicenseNumber((String) map.get("cardNumber"));
  362. //todo 是否自动生成免税附表
  363. complexIncome.setIsAutoGenerateExempt("是");
  364. //当期收入额*
  365. complexIncome.setIncome((BigDecimal) map.get("t39"));
  366. //免税收入
  367. complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
  368. //其他
  369. //complexIncome.setOther(BigDecimal.ZERO);
  370. //减免税额 无
  371. complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
  372. //备注
  373. //complexIncome.setRemark("");
  374. //所得项目名称*
  375. complexIncome.setIncomeItemName("解除劳动合同一次性补偿金");
  376. //准予扣除的捐赠额 无
  377. complexIncome.setDeductibleDonation((BigDecimal) map.get("t16"));
  378. compensateIncome.add(complexIncome);
  379. }
  380. return compensateIncome;
  381. }
  382. /**
  383. * 一般劳务报酬所得列表
  384. *
  385. * @param caluDataMap
  386. * @return
  387. */
  388. private List<ComplexIncome> getLaborRemunerationIncome(Map<String, List<Map<String, Object>>> caluDataMap) {
  389. List<ComplexIncome> laborRemunerationIncome = new ArrayList<>();
  390. List<Map<String, Object>> list = caluDataMap.get("lwbclb");
  391. for (int i = 0; list != null && i < list.size(); i++) {
  392. Map<String, Object> map = list.get(i);
  393. ComplexIncome complexIncome = new ComplexIncome();
  394. //姓名*
  395. complexIncome.setName((String) map.get("personName"));
  396. //证件类型名称*
  397. complexIncome.setLicenseType((String) map.get("cardType"));
  398. //证件号码*
  399. complexIncome.setLicenseNumber((String) map.get("cardNumber"));
  400. //是否明细申报
  401. //complexIncome.setIsDetailedDeclaration("");
  402. //当期收入额*
  403. complexIncome.setIncome((BigDecimal) map.get("t1"));
  404. //免税收入
  405. complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
  406. //商业健康保险
  407. complexIncome.setCommercialHealthInsurance((BigDecimal) map.get("t13"));
  408. //税延养老保险
  409. complexIncome.setExtensionEndowmentInsurance((BigDecimal) map.get("t14"));
  410. //其他
  411. //complexIncome.setOther(BigDecimal.ZERO);
  412. //减免税额
  413. complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
  414. //备注
  415. //complexIncome.setRemark("");
  416. //减除费用
  417. // complexIncome.setDeductionAmount(BigDecimal.ZERO);
  418. //应纳税额
  419. //complexIncome.setPayableAmount(BigDecimal.ZERO);
  420. //税率
  421. //complexIncome.setTaxRate(BigDecimal.ZERO);
  422. //所得项目名称*
  423. complexIncome.setIncomeItemName("一般劳务报酬所得");
  424. //允许扣除的税费
  425. complexIncome.setTaxDeductible((BigDecimal) map.get("t18"));
  426. laborRemunerationIncome.add(complexIncome);
  427. }
  428. return laborRemunerationIncome;
  429. }
  430. /**
  431. * 获取全年一次性奖金
  432. * taxItemPlanName 个税项目名称
  433. * cmpschemeid 计算规则ID
  434. *
  435. * @return
  436. */
  437. public ComplexIncome getAnnualOneTimeBonusIncome() throws SQLException, BOSException {
  438. ComplexIncome complexIncome = new ComplexIncome();
  439. //姓名
  440. complexIncome.setName(personName);
  441. //证照类型
  442. complexIncome.setLicenseType(cardType);
  443. complexIncome.setLicenseNumber(cardNumber);
  444. //税后收入额
  445. complexIncome.setAbroadIncome(new BigDecimal("123123"));
  446. //收入额
  447. complexIncome.setIncome(new BigDecimal("10000"));
  448. return complexIncome;
  449. }
  450. /**
  451. * 全年一次性奖金收入列表
  452. *
  453. * @return
  454. */
  455. private List<ComplexIncome> getAnnualOneTimeBonusIncomeList(
  456. Map<String, List<Map<String, Object>>> caluDataMap) {
  457. List<ComplexIncome> annualOneTimeBonusIncome = new ArrayList<>();
  458. List<Map<String, Object>> list = caluDataMap.get("qnycxjjsslb");
  459. for (int i = 0; list != null && i < list.size(); i++) {
  460. Map<String, Object> map = list.get(i);
  461. ComplexIncome complexIncome = new ComplexIncome();
  462. //姓名*
  463. complexIncome.setName((String) map.get("personName"));
  464. //证件类型名称*
  465. complexIncome.setLicenseType((String) map.get("cardType"));
  466. //证件号码*
  467. complexIncome.setLicenseNumber((String) map.get("cardNumber"));
  468. //当期收入额*
  469. complexIncome.setIncome((BigDecimal) map.get("t1"));
  470. //免税收入
  471. complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
  472. //其他
  473. //complexIncome.setOther(BigDecimal.ZERO);
  474. //减免税额
  475. complexIncome.setTaxDeduction((BigDecimal) map.get("t17"));
  476. //备注
  477. //complexIncome.setRemark("");
  478. //所得项目名称*
  479. complexIncome.setIncomeItemName("全年一次性奖金收入");
  480. //准予扣除的捐赠额
  481. complexIncome.setDeductibleDonation((BigDecimal) map.get("t16"));
  482. annualOneTimeBonusIncome.add(complexIncome);
  483. }
  484. return annualOneTimeBonusIncome;
  485. }
  486. /**
  487. * 获取正常工资薪金对象
  488. *
  489. * @return
  490. */
  491. public NormalSalarySpecIncome getNormalSalarySpecIncomes() throws BOSException, EASBizException {
  492. //正常工资薪金对象
  493. NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
  494. //正常工资薪金列表
  495. List<ComplexIncome> normalSalarySpec = new ArrayList();
  496. ComplexIncome complexIncome = new ComplexIncome();
  497. //姓名
  498. complexIncome.setName(personName);
  499. //证照类型
  500. complexIncome.setLicenseType(cardType);
  501. complexIncome.setLicenseNumber(cardNumber);
  502. //税后收入额
  503. complexIncome.setAbroadIncome(new BigDecimal("10000"));
  504. //收入额
  505. complexIncome.setIncome(new BigDecimal("10000"));
  506. //所得项目名称
  507. complexIncome.setIncomeItemName("正常工资薪金");
  508. normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec);
  509. return normalSalarySpecIncome;
  510. }
  511. /**
  512. * 人员
  513. *
  514. * @return
  515. */
  516. public DetailCompanyEmployee getDetailCompanyEmployee() {
  517. //人员对象
  518. DetailCompanyEmployee detailCompanyEmployee = new DetailCompanyEmployee();
  519. //姓名
  520. detailCompanyEmployee.setName(personName);
  521. //证照类型
  522. detailCompanyEmployee.setLicenseType(cardType);
  523. //证照号码
  524. detailCompanyEmployee.setLicenseNumber(cardNumber);
  525. //人员状态
  526. //detailCompanyEmployee.setState(personInfo.getEmployeeType().getName());
  527. ////人员报税信息->任职受雇从业信息
  528. //ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
  529. //TaxPersonRecordEntryCollection taxPersonRecordEntryCollection = iTaxPersonRecordEntry.getTaxPersonRecordEntryCollection("where person.id = '" + personInfo.getId() + "'");
  530. //TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntryCollection.get(0);
  531. //任职受雇类型 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
  532. detailCompanyEmployee.setIsEmployee("雇员");
  533. //手机号
  534. detailCompanyEmployee.setPhone("13333282630");
  535. //detailCompanyEmployee.setIsEmployee(taxPersonRecordEntryInfo.getEmployedType().getAlias());
  536. //受雇日期 YYYY-MM-DD,不能大于当前时间,任职受雇类型选择雇员、保险营销员、证券经纪人时必录
  537. SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
  538. detailCompanyEmployee.setEmployedDate("2022-10-02");
  539. ////性别
  540. detailCompanyEmployee.setGender("女");
  541. ////出生日期
  542. detailCompanyEmployee.setBirthday("2001-01-01");
  543. //国籍 nationality
  544. //NationalityInfo nationality = personInfo.getNationality();
  545. detailCompanyEmployee.setNationality("中国");
  546. return detailCompanyEmployee;
  547. }
  548. /**
  549. * 获取正常工资薪金参数
  550. *
  551. * @return
  552. */
  553. private NormalSalarySpecIncome getNormalSalarySpecIncome
  554. (Map<String, List<Map<String, Object>>> caluDataMap) {
  555. //正常工资薪金对象
  556. NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
  557. //正常工资薪金是否需要专项*
  558. //normalSalarySpecIncome.setZcgzxjsfxyzx("");
  559. //正常工资薪金是否传入累计(申报/单月计算时使用)
  560. //normalSalarySpecIncome.setZcgzxjsfcrlj("");
  561. //年金算税上限选项
  562. normalSalarySpecIncome.setAnnuityAndHouseProvidentFundOption("");
  563. //个人养老金策略
  564. normalSalarySpecIncome.setPersonalPensionOption("");
  565. //上月个人养老金策略
  566. normalSalarySpecIncome.setLastMonthPersonalPensionOption("");
  567. List<ComplexIncome> normalSalarySpec = new ArrayList<>();
  568. //正常工资薪金(带专项)列表*
  569. normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec);
  570. List<Map<String, Object>> list = caluDataMap.get("zcgzxjlb");
  571. for (int i = 0; list != null && i < list.size(); i++) {
  572. Map<String, Object> map = list.get(i);
  573. ComplexIncome complexIncome = new ComplexIncome();
  574. //姓名*
  575. complexIncome.setName((String) map.get("personName"));
  576. //证件类型名称*
  577. complexIncome.setLicenseType((String) map.get("cardType"));
  578. //证件号码*
  579. complexIncome.setLicenseNumber((String) map.get("cardNumber"));
  580. //是否明细申报
  581. //complexIncome.setIsDetailedDeclaration("");
  582. //当期收入额*
  583. complexIncome.setIncome((BigDecimal) map.get("t1"));
  584. //免税收入
  585. complexIncome.setExemptIncome((BigDecimal) map.get("t2"));
  586. //基本养老保险
  587. complexIncome.setEndowmentInsurance((BigDecimal) map.get("t3"));
  588. //基本医疗保险
  589. complexIncome.setMedicalInsurance((BigDecimal) map.get("t4"));
  590. //失业保险
  591. complexIncome.setUnemploymentInsurance((BigDecimal) map.get("t5"));
  592. //住房公积金
  593. complexIncome.setHouseProvidentFund((BigDecimal) map.get("t6"));
  594. //子女教育支出
  595. complexIncome.setChildEducationExpenditure((BigDecimal) map.get("t64"));
  596. //赡养老人支出
  597. complexIncome.setSupportElderExpenditure((BigDecimal) map.get("t65"));
  598. //住房租金支出
  599. complexIncome.setHouseRentExpenditure((BigDecimal) map.get("t67"));
  600. //房屋贷款支出
  601. complexIncome.setHouseLoanExpenditure((BigDecimal) map.get("t66"));
  602. //继续教育支出
  603. complexIncome.setContinueEducationExpenditure((BigDecimal) map.get("t68"));
  604. //婴幼儿照护支出
  605. complexIncome.setBabyCareExpenditure((BigDecimal) map.get("t70"));
  606. //todo 企业年金/职业年金
  607. complexIncome.setAnnuity(BigDecimal.ZERO);
  608. //商业健康保险
  609. complexIncome.setCommercialHealthInsurance((BigDecimal) map.get("t13"));
  610. //税延养老保险
  611. complexIncome.setExtensionEndowmentInsurance((BigDecimal) map.get("t14"));
  612. //其他
  613. complexIncome.setOther(BigDecimal.ZERO);
  614. //减免税额
  615. complexIncome.setTaxDeduction(BigDecimal.ZERO);
  616. //备注 根据政策要求,填写【其他】项,一定在备注中写明具体扣除项目名称
  617. complexIncome.setRemark("");
  618. //应纳税额
  619. complexIncome.setPayableAmount(BigDecimal.ZERO);
  620. //已缴税额
  621. complexIncome.setPaidAmount(BigDecimal.ZERO);
  622. //税率
  623. complexIncome.setTaxRate(BigDecimal.ZERO);
  624. //所得项目名称
  625. complexIncome.setIncomeItemName("正常工资薪金");
  626. //累计收入额 本年累计收入=本期所有的工资薪金所得收入之和+往期工资薪金所得收入之和(见税款计算)
  627. complexIncome.setAccumulatedIncome(BigDecimal.ZERO);
  628. //累计专项扣除额
  629. complexIncome.setAccumulatedSpecDeduction(BigDecimal.ZERO);
  630. //累计其他扣除额
  631. complexIncome.setAccumulatedOtherDeduction(BigDecimal.ZERO);
  632. //累计减除费用额
  633. complexIncome.setAccumulatedDeductionAmount(BigDecimal.ZERO);
  634. //累计子女教育支出
  635. complexIncome.setAccumulatedChildEducation(BigDecimal.ZERO);
  636. //累计继续教育支出
  637. complexIncome.setAccumulatedContinueEducation(BigDecimal.ZERO);
  638. //累计住房租金支出
  639. complexIncome.setAccumulatedHouseRent(BigDecimal.ZERO);
  640. //累计房屋贷款支出
  641. complexIncome.setAccumulatedHouseLoan(BigDecimal.ZERO);
  642. //累计赡养老人支出
  643. complexIncome.setAccumulatedSupportElder(BigDecimal.ZERO);
  644. //累计3岁以下婴幼儿照护支出
  645. complexIncome.setAccumulatedBabyCare(BigDecimal.ZERO);
  646. //累计准予扣除的捐赠额
  647. complexIncome.setAccumulatedDeductibleDonation(BigDecimal.ZERO);
  648. //累计个人养老金
  649. complexIncome.setAccumulatedPersonalPension(BigDecimal.ZERO);
  650. //累计个人养老金校验码
  651. complexIncome.setAccumulatedPersonalPensionCheckCode("");
  652. //准予扣除的捐赠额
  653. complexIncome.setDeductibleDonation(BigDecimal.ZERO);
  654. //试用公式
  655. complexIncome.setFormula("");
  656. //境内工作天数
  657. complexIncome.setDomesticWorkingDays(BigDecimal.ZERO);
  658. //境外工作天数
  659. complexIncome.setAbroadWorkingDays(BigDecimal.ZERO);
  660. //境外支付
  661. complexIncome.setAbroadIncome(BigDecimal.ZERO);
  662. //境内支付
  663. complexIncome.setDomesticIncome(BigDecimal.ZERO);
  664. normalSalarySpec.add(complexIncome);
  665. }
  666. return normalSalarySpecIncome;
  667. }
  668. /**
  669. * 获取企业人员列表
  670. */
  671. private List<DetailCompanyEmployee> getCompanyEmployeeList(Map<String, List<Map<String, Object>>> caluDataMap) {
  672. List<DetailCompanyEmployee> companyEmployeeList = new ArrayList<>();
  673. List<Map<String, Object>> list = caluDataMap.get("zcgzxjlb");
  674. for (int i = 0; list != null && i < list.size(); i++) {
  675. Map<String, Object> map = list.get(i);
  676. DetailCompanyEmployee employee = new DetailCompanyEmployee();
  677. //姓名*
  678. employee.setName((String) map.get("personName"));
  679. //证件类型名称*
  680. employee.setLicenseType((String) map.get("cardType"));
  681. //证件号码*
  682. employee.setLicenseNumber((String) map.get("cardNumber"));
  683. //部门编号
  684. //employee.setDeptNo("");
  685. //工号
  686. employee.setEmployeeNumber((String) map.get("personNumber"));
  687. //所属期
  688. //employee.setPeriod("");
  689. //手机号码 中国籍必填;非中国籍首次入境时间超过一个月必填;
  690. employee.setPhone((String) map.get("phoneNumber"));
  691. //人员状态* 默认为正常,可选择正常/非正常
  692. employee.setState((String) map.get("personstatusName"));
  693. //是否雇员* 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
  694. employee.setIsEmployee((String) map.get("employedtypeName"));
  695. //入职年度就业情况 当雇员保险营销员、证券经纪人时可选择:当年首次入职学生、当年首次入职其他人员。其他情况下填写默认为空
  696. employee.setFirstEmploymentSituation((String) map.get("situationName"));
  697. //受雇日期
  698. employee.setEmployedDate((String) map.get("employeddate"));
  699. //性别* 男/女
  700. employee.setGender((String) map.get("gender"));
  701. //出生日期* YYYY-MM-DD 需要和身份证上保持一致
  702. employee.setBirthday((String) map.get("birthday"));
  703. //国籍*
  704. employee.setNationality((String) map.get("nationalityName"));
  705. //人员地区* 境内/境外
  706. employee.setArea((String) map.get("isoversea"));
  707. //离职日期
  708. employee.setResignDate((String) map.get("departuredate"));
  709. //个人投资总额
  710. employee.setPersonInvestment((BigDecimal) map.get("investmenttotal"));
  711. //个人投资比例
  712. employee.setPersonInvestmentRatio((BigDecimal) map.get("investmentrate"));
  713. //是否残疾
  714. String isdisability = (String) map.get("isdisability");
  715. employee.setIsDisabled(isdisability);
  716. if ("是".equals(isdisability)) {
  717. //todo 残疾证件类型
  718. employee.setDisableCardTypeName("残疾证");
  719. }
  720. //是否烈属
  721. employee.setIsMartyr((String) map.get("ishero"));
  722. //是否孤老
  723. employee.setIsBereavedGaffer((String) map.get("isold"));
  724. //残疾证号
  725. employee.setDisableCardNumber((String) map.get("discardnumber"));
  726. //烈属证号
  727. employee.setMartyrCardNumber((String) map.get("herocardnumber"));
  728. //电子邮箱
  729. employee.setEmail((String) map.get("email"));
  730. //学历
  731. employee.setEducation((String) map.get("diploma"));
  732. //职务
  733. employee.setPosition((String) map.get("positionName"));
  734. //开户银行省份(名字)
  735. employee.setDepositBankProvinceName((String) map.get("bankcardprovince"));
  736. //开户银行
  737. employee.setDepositBank((String) map.get("bankcardprovince"));
  738. //银行账号
  739. employee.setBankAccount((String) map.get("account"));
  740. //居住省份
  741. employee.setResidentProvince((String) map.get("address"));
  742. //居住城市
  743. employee.setResidentCity((String) map.get("addresscity"));
  744. //居住区县
  745. employee.setResidentDistrict((String) map.get("addresscounty"));
  746. //居住街道
  747. employee.setResidentStreet((String) map.get("addressstreet"));
  748. //户籍省份
  749. employee.setCensusProvince((String) map.get("hometown"));
  750. //户籍城市
  751. employee.setCensusCity((String) map.get("hometowncity"));
  752. //户籍区县
  753. employee.setCensusDistrict((String) map.get("hometowncountry"));
  754. //户籍街道
  755. employee.setCensusStreet((String) map.get("hometownstreet"));
  756. //户籍详细地址
  757. employee.setCensusAddress((String) map.get("hometowndetailed"));
  758. //备注
  759. employee.setEmpRemark((String) map.get("desc"));
  760. //出生地
  761. employee.setBirthplace((String) map.get("birthplaceName"));
  762. //首次入境时间
  763. employee.setFirstEntryDate((String) map.get("entrydate"));
  764. //预计离境时间
  765. employee.setEstimatedDepartureDate((String) map.get("leavedate"));
  766. //联系地省份
  767. employee.setContactProvince((String) map.get("contactaddress"));
  768. //联系地城市
  769. employee.setContactCity((String) map.get("contactcity"));
  770. //联系地区县
  771. employee.setContactDistrict((String) map.get("contactcountry"));
  772. //联系地街道
  773. employee.setContactStreet((String) map.get("contactstreet"));
  774. //联系地详细地址
  775. employee.setContactStreet((String) map.get("contactdetailed"));
  776. //中文名
  777. employee.setChineseName((String) map.get("chinesename"));
  778. //涉税事项
  779. employee.setTaxRelatedReason((String) map.get("taxreason"));
  780. //其他证件号码
  781. employee.setOtherLicenseNumber((String) map.get("othercardnumber"));
  782. //其他证件类型 其他证件类型为:外国人永久居留身份证(外国人永久居留证),外国护照,中华人民共和国外国人工作许可证(A类),中华人民共和国外国人工作许可证(B类),中华人民共和国外国人工作许可证(C类),中华人民共和国港澳居民居住证,中华人民共和国台湾居民居住证,中国护照,港澳居民来往内地通行证,台湾居民来往大陆通行证,其他证件号码必填
  783. employee.setOtherLicenseType((String) map.get("othercardtype"));
  784. //是否扣除减除费用(原是否主单位)
  785. employee.setIsMainUnits((String) map.get("deductfees"));
  786. companyEmployeeList.add(employee);
  787. }
  788. return companyEmployeeList;
  789. }
  790. }