IncomeTaxDeclareListHandlerEx.java 63 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291
  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.declare.DeclareCancelRequest;
  6. import cn.com.servyou.dto.declare.DeclareCorrectRequest;
  7. import cn.com.servyou.dto.tax.*;
  8. import cn.com.servyou.rmi.client.ClientProxyFactory;
  9. import cn.com.servyou.service.DeclarationRequest;
  10. import com.alibaba.fastjson.JSONObject;
  11. import com.fasterxml.jackson.core.JsonProcessingException;
  12. import com.fasterxml.jackson.databind.ObjectMapper;
  13. import com.google.gson.Gson;
  14. import com.google.gson.reflect.TypeToken;
  15. import com.kingdee.bos.BOSException;
  16. import com.kingdee.bos.Context;
  17. import com.kingdee.bos.dao.ormapping.impl.ImplUtils;
  18. import com.kingdee.bos.metadata.entity.*;
  19. import com.kingdee.bos.metadata.query.util.CompareType;
  20. import com.kingdee.bos.util.EASResource;
  21. import com.kingdee.eas.basedata.hraux.NationalityInfo;
  22. import com.kingdee.eas.basedata.person.PersonCollection;
  23. import com.kingdee.eas.basedata.person.PersonFactory;
  24. import com.kingdee.eas.basedata.person.PersonInfo;
  25. import com.kingdee.eas.common.EASBizException;
  26. import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
  27. import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
  28. import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
  29. import com.kingdee.eas.custom.shuiyou.utils.ClientProxyFactoryUtils;
  30. import com.kingdee.eas.util.app.DbUtil;
  31. import com.kingdee.jdbc.rowset.IRowSet;
  32. import com.kingdee.jdbc.rowset.IRowSetMetaData;
  33. import com.kingdee.shr.base.syssetting.context.SHRContext;
  34. import com.kingdee.shr.base.syssetting.exception.SHRWebException;
  35. import com.kingdee.shr.base.syssetting.exception.ShrWebBizException;
  36. import com.kingdee.shr.base.syssetting.web.dynamic.util.DynamicUtil;
  37. import com.kingdee.shr.base.syssetting.web.dynamic.util.MD5;
  38. import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
  39. import com.kingdee.shr.base.syssetting.web.util.UserUtil;
  40. import com.kingdee.shr.compensation.TaxDeclareStatusEnum;
  41. import com.kingdee.shr.compensation.TbTypeEnum;
  42. import com.kingdee.shr.compensation.app.incomeTax.ITaxPersonRecordEntry;
  43. import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordEntryCollection;
  44. import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordEntryFactory;
  45. import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordEntryInfo;
  46. import com.kingdee.shr.compensation.app.tax.*;
  47. import com.kingdee.shr.compensation.app.tax.base.TaxIncomeItemInfo;
  48. import com.kingdee.shr.compensation.app.taxCal.*;
  49. import com.kingdee.shr.compensation.helper.CmpConstants;
  50. import com.kingdee.shr.compensation.taxCal.util.TaxCalcFileUtils;
  51. import com.kingdee.shr.compensation.util.*;
  52. import com.kingdee.shr.compensation.web.handler.tax.IncomeTaxDeclareListHandler;
  53. import com.kingdee.shr.compensation.web.handler.tax.dto.TaxDeclarExcelRowDTO;
  54. import com.kingdee.shr.compensation.web.handler.tax.dto.TaxDeclareDTO;
  55. import com.kingdee.util.StringUtils;
  56. import org.apache.log4j.Logger;
  57. import org.apache.poi.hssf.usermodel.*;
  58. import org.springframework.ui.ModelMap;
  59. import javax.servlet.http.HttpServletRequest;
  60. import javax.servlet.http.HttpServletResponse;
  61. import java.io.File;
  62. import java.io.FileNotFoundException;
  63. import java.io.FileOutputStream;
  64. import java.io.IOException;
  65. import java.lang.reflect.Type;
  66. import java.math.BigDecimal;
  67. import java.net.URLEncoder;
  68. import java.sql.SQLException;
  69. import java.text.SimpleDateFormat;
  70. import java.util.*;
  71. /**
  72. * @author qingwu
  73. * @date 2024/9/18
  74. * @apiNote 个税申报扩展
  75. */
  76. public class IncomeTaxDeclareListHandlerEx extends IncomeTaxDeclareListHandler {
  77. private static final Logger LOG = Logger.getLogger(IncomeTaxDeclareListHandlerEx.class);
  78. private Context ctx = SHRContext.getInstance().getContext();
  79. private ObjectMapper mapper = new ObjectMapper();
  80. /**
  81. * 个税申报
  82. *
  83. * @param request
  84. * @param response
  85. * @param modelMap
  86. */
  87. @Override
  88. public void taxDeclareAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws BOSException, SHRWebException {
  89. LOG.error("taxDeclareAction-----------start-----------");
  90. Context ctx = SHRContext.getInstance().getContext();
  91. try {
  92. boolean isHaveTaxService = CmpTaxUtil.isHaveTaxService(ctx);
  93. if (!isHaveTaxService) {
  94. throw new ShrWebBizException(EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label136", ctx.getLocale()));
  95. } else {
  96. String selectedId = request.getParameter("selectedId");
  97. Map<String, Object> resultMap = new HashMap();
  98. Map<String, Object> declareData = this.getDeclareData(ctx, selectedId);
  99. Map<String, Object> paramMap = new HashMap();
  100. paramMap.put("declaData", declareData.get("WATI_TO_DECLARE"));
  101. LOG.error("paramMap-----------" + paramMap);
  102. try {
  103. //纳税单位
  104. List<String> advanceDeclareInfo = (List) declareData.get("advanceDeclareInfo");
  105. LOG.error("advanceDeclareInfo------------" + advanceDeclareInfo);
  106. if (!advanceDeclareInfo.isEmpty()) {
  107. throw new ShrWebBizException(this.combineError(advanceDeclareInfo));
  108. }
  109. //个税审批 审批状态=审批通过的数据
  110. List<IncomeTaxDeclarInfo> waitToDeclareList = (List) paramMap.get("declaData");
  111. if (waitToDeclareList.size() <= 0) {
  112. resultMap.put("success", false);
  113. resultMap.put("excel", "");
  114. resultMap.put("hasErrData", true);
  115. resultMap.put("hasCheckDataErr", true);
  116. resultMap.put("info", "不可重复声申报!!");
  117. JSONUtils.SUCCESS(resultMap);
  118. return;
  119. }
  120. //检查纳税申报数据
  121. Map<String, Object> checkResultMap = this.checkTaxDeclareData(ctx, request, waitToDeclareList);
  122. Boolean hasErr = (Boolean) checkResultMap.get("hasErrData");
  123. if (hasErr != null && hasErr) {
  124. resultMap.put("success", false);
  125. resultMap.put("excel", checkResultMap.get("excel"));
  126. resultMap.put("hasErrData", true);
  127. resultMap.put("hasCheckDataErr", true);
  128. resultMap.put("info", "");
  129. JSONUtils.SUCCESS(resultMap);
  130. return;
  131. }
  132. String errMsg = this.checkTaxCalStatus(ctx, waitToDeclareList);
  133. if (null != errMsg) {
  134. resultMap.put("success", false);
  135. resultMap.put("dataError", true);
  136. resultMap.put("errMsg", errMsg);
  137. JSONUtils.SUCCESS(resultMap);
  138. return;
  139. }
  140. checkResultMap = this.checkIncomeTaxIssue(ctx, waitToDeclareList);
  141. if (checkResultMap != null) {
  142. checkResultMap.put("success", false);
  143. JSONUtils.SUCCESS(checkResultMap);
  144. return;
  145. }
  146. //errMsg = this.checkReductionItems(ctx, waitToDeclareList);
  147. //if (null != errMsg) {
  148. // resultMap.put("success", false);
  149. // resultMap.put("reductionError", true);
  150. // resultMap.put("errMsg", errMsg);
  151. // JSONUtils.SUCCESS(resultMap);
  152. // return;
  153. //}
  154. //Map<String, Object> taxDeclareResult = IncomeTaxDeclareFacadeFactory.getLocalInstance(ctx).taxDeclare(paramMap);
  155. //调佣税友纳税申报
  156. Map<String, Object> taxDeclareResult = callShuiYouTaxDeclare(paramMap);
  157. Boolean isSuccess = (Boolean) taxDeclareResult.get("success");
  158. resultMap.put("success", isSuccess);
  159. resultMap.put("excel", "");
  160. resultMap.put("hasErrData", !isSuccess);
  161. resultMap.put("hasCheckDataErr", false);
  162. resultMap.put("info", declareData.get("info"));
  163. } catch (Exception var17) {
  164. var17.printStackTrace();
  165. LOG.error(var17.getMessage(), var17);
  166. resultMap.put("success", false);
  167. resultMap.put("excel", "");
  168. resultMap.put("hasErrData", true);
  169. resultMap.put("hasCheckDataErr", false);
  170. resultMap.put("info", declareData.get("info"));
  171. resultMap.put("errorMsg", var17.getMessage());
  172. }
  173. LOG.error("taxDeclareAction-----------end-----------");
  174. JSONUtils.SUCCESS(resultMap);
  175. }
  176. } catch (JsonProcessingException e) {
  177. e.printStackTrace();
  178. throw new RuntimeException(e);
  179. }
  180. }
  181. /**
  182. * 调佣税友纳税申报
  183. *
  184. * @param paramMap
  185. * @return
  186. */
  187. public Map<String, Object> callShuiYouTaxDeclare(Map paramMap) {
  188. LOG.error("callShuiYouTaxDeclare--------------------paramMap" + paramMap);
  189. Map<String, Object> resultMap = new HashMap();
  190. resultMap.put("success", true);
  191. resultMap.put("msg", "");
  192. List<IncomeTaxDeclarInfo> waitToDeclareList = (List) paramMap.get("declaData");
  193. Map<String, Object> requestParamMap = new HashMap();
  194. List<Object[]> paramList = new ArrayList();
  195. try {
  196. if (waitToDeclareList != null && waitToDeclareList.size() > 0) {
  197. for (int i = 0; i < waitToDeclareList.size(); i++) {
  198. IncomeTaxDeclarInfo taxDeclarInfo = waitToDeclareList.get(i);
  199. JSONObject param = new JSONObject();
  200. param.put("taxDeclarId", taxDeclarInfo.getId());
  201. param.put("taxDeclarBatchNo", taxDeclarInfo.getBatchNo());
  202. //纳税单位
  203. TaxUnitInfo taxUnitInfo = taxDeclarInfo.getTaxUnit();
  204. //客户端代理工厂
  205. ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
  206. //算税请求接口
  207. DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
  208. //获取请求参数
  209. CompanyDeclareRequest declareRequestParameter = getDeclareRequestParameter(taxUnitInfo, taxDeclarInfo);
  210. LOG.error("declareRequestParameter-----------------" + mapper.writeValueAsString(declareRequestParameter));
  211. ApiResponse<AsyncResult> apiResponse = declarationRequest.send(declareRequestParameter);
  212. LOG.error("asyncResultApiResponse-----getCode-------" + apiResponse.getHead().getCode());
  213. LOG.error("asyncResultApiResponse-----getMsg--------" + apiResponse.getHead().getMsg());
  214. resultMap.put("msg", mapper.writeValueAsString(declareRequestParameter));
  215. if (apiResponse.getHead().getCode().equals("00000000")) {
  216. AsyncResult body = apiResponse.getBody();
  217. String requestId = body.getRequestId();
  218. LOG.error("requestId-----" + requestId);
  219. LOG.error("apiResponse-----" + mapper.writeValueAsString(apiResponse));
  220. //查询反算反馈结果
  221. ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
  222. //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
  223. //isyUtilsFacade.backTask(isyUtilsFacade.getConfig().get("ip") + "/gateway/iit/reverseCalculateTax/getASynIndividualIncomeTaxFeedback", requestId, "synIndividualIncomeTaxService", jsonObject.toString(), TaskCatalogEnum.CAL_GET);
  224. JSONObject json = new JSONObject();
  225. json.put("requestId", requestId);
  226. json.put("param", param.toString());
  227. isyUtilsFacade.addTask("synIncomeTaxDeclareService", json.toJSONString(), TaskCatalogEnum.TAX, "");
  228. }
  229. }
  230. }
  231. } catch (Exception e) {
  232. e.printStackTrace();
  233. resultMap.put("success", false);
  234. resultMap.put("msg", e.getMessage());
  235. return resultMap;
  236. }
  237. return resultMap;
  238. }
  239. /**
  240. * 获取请求参数
  241. * 注意:
  242. * 1.解除劳动合同一次性补偿金、全年一次性奖金所得,不能单独申报,需要同正常工资薪金一起申报。
  243. * 2.解除劳动合同一次性补偿金、稿酬所得,由于税务规则需要,解除劳动合同一次性补偿金、稿酬所得必须填写免税附表。
  244. *
  245. * @param taxUnitInfo
  246. * @param taxDeclarInfo
  247. * @return
  248. */
  249. private CompanyDeclareRequest getDeclareRequestParameter(TaxUnitInfo taxUnitInfo,
  250. IncomeTaxDeclarInfo taxDeclarInfo
  251. ) throws BOSException, JsonProcessingException, EASBizException, SQLException {
  252. LOG.error("getDeclareRequestParameter-----------taxDeclarInfo-----" + taxDeclarInfo);
  253. CompanyDeclareRequest declareRequestPara = new CompanyDeclareRequest();
  254. Map<String, Object> requestParamMap = new HashMap();
  255. //随机id
  256. String bizNo = UUID.randomUUID().toString();
  257. LOG.error("bizNo:" + bizNo);
  258. //外部业务订单号*
  259. declareRequestPara.setBizNo(bizNo);
  260. //企业名称*
  261. declareRequestPara.setName(taxUnitInfo.getName());
  262. //税号*
  263. declareRequestPara.setTaxNo(taxUnitInfo.getTaxNumber());
  264. //行政区划代码*
  265. declareRequestPara.setArea(taxUnitInfo.getAreaCode());
  266. //登记序号
  267. declareRequestPara.setRegistrationNumber(taxUnitInfo.getRegNumber());
  268. String declPassword = taxUnitInfo.getDeclPassword();
  269. if (StringUtils.isEmpty(declPassword)) {
  270. throw new BOSException("申报密码不能为空!");
  271. }
  272. declareRequestPara.setDeclarePassword(Base64Utils.decode(declPassword));
  273. //所得月份
  274. String yearMonth = taxDeclarInfo.getYearMonth();
  275. String replaceYearMonth = yearMonth.replace("-", "");
  276. LOG.error("replaceYearMonth----------------" + replaceYearMonth);
  277. //税款所属期YYYYMM*
  278. declareRequestPara.setMonth(replaceYearMonth);
  279. //总金额
  280. //BigDecimal totalMoney = taxDeclarInfo.getTotalMoney();
  281. //应退税额
  282. //BigDecimal taxRebate = taxDeclarInfo.getTaxRebate();
  283. //总人数
  284. //long totalPerson = taxDeclarInfo.getTotalPerson();
  285. //申报表分类 1=预扣预缴申报表 2=分类所得申报表 3=非居民所得申报表
  286. //String tbTble = taxDeclarInfo.getTbType().getValue();
  287. //纳税单位ID
  288. //String taxUnitId = taxUnitInfo.getId().toString();
  289. //Map<String, Object> tbTypeMap = new HashMap();
  290. //if (totalMoney.compareTo(BigDecimal.ZERO) == 0) {
  291. // tbTypeMap.put("zje", 0.0);
  292. //} else {
  293. // tbTypeMap.put("zje", totalMoney);
  294. //}
  295. //
  296. //if (taxRebate.compareTo(BigDecimal.ZERO) == 0) {
  297. // tbTypeMap.put("ynse", 0.0);
  298. //} else {
  299. // tbTypeMap.put("ynse", taxRebate);
  300. //}
  301. //tbTypeMap.put("zrs", totalPerson);
  302. //Map<String, Object> dataMap = new HashMap();
  303. //if ("1".equals(tbTble)) {
  304. // dataMap.put("ykyj", tbTypeMap);
  305. //} else if ("2".equals(tbTble)) {
  306. // dataMap.put("flsd", tbTypeMap);
  307. //} else if ("3".equals(tbTble)) {
  308. // dataMap.put("fjm", tbTypeMap);
  309. //}
  310. //密码类型*
  311. declareRequestPara.setPasswordType("0");
  312. //离职日期处理策略 1、不传或传1,代表离职日期自动清空,即人员状态由“非正常”变更为“正常”时,离职日期字段自动清空,默认逻辑。
  313. //2、传2离职日期不自动清空,即人员状态由“非正常”变更为“正常”时,离职日期不自动清空,客户如需清空需对离职日期字段传入空字符串。
  314. //declareRequestPara.setResignDateStrategy();
  315. //批次号
  316. String batchNo = taxDeclarInfo.getBatchNo();
  317. LOG.error("taxCalConfigDetailCollection--------taxDeclarInfo---------" + taxDeclarInfo);
  318. //个税应用+税款计算最终拆分明细表
  319. ITaxCalConfigDetail taxCalConfigDetail = TaxCalConfigDetailFactory.getLocalInstance(ctx);
  320. TaxCalConfigDetailCollection taxCalConfigDetailCollection = taxCalConfigDetail.getTaxCalConfigDetailCollection("select *,incomeItem.*, person.* where batchNo = '" + batchNo + "' and state = '20'");
  321. LOG.error("taxCalConfigDetailCollection-----------------" + taxCalConfigDetailCollection.size());
  322. //员工信息ID
  323. Set personIds = new HashSet();
  324. //综合所得对象
  325. ComplexIncomeRequest complexIncomeRequest = new ComplexIncomeRequest();
  326. //正常工资薪金对象
  327. NormalSalarySpecIncome normalSalarySpecIncome = new NormalSalarySpecIncome();
  328. //正常工资薪金列表
  329. List<ComplexIncome> normalSalarySpec = new ArrayList();
  330. //全年一次性奖金收入
  331. List<ComplexIncome> annualOneTimeBonusIncome = new ArrayList();
  332. //全年一次性奖金收入
  333. List<ComplexIncome> laborRemunerationIncome = new ArrayList();
  334. if (taxCalConfigDetailCollection.size() > 0) {
  335. for (int i = 0; i < taxCalConfigDetailCollection.size(); i++) {
  336. TaxCalConfigDetailInfo taxCalConfigDetailInfo = taxCalConfigDetailCollection.get(i);
  337. //员工信息
  338. PersonInfo personInfo = taxCalConfigDetailInfo.getPerson();
  339. personIds.add(personInfo.getId().toString());
  340. //所得项目
  341. TaxIncomeItemInfo incomeItem = taxCalConfigDetailInfo.getIncomeItem();
  342. //本期收入
  343. Integer sre = null;
  344. String getSreSql = "select t1 from T_HR_STaxCalConfigDetail where fid ='" + taxCalConfigDetailInfo.getId().toString() + "'";
  345. IRowSet iRowSet = DbUtil.executeQuery(ctx, getSreSql);
  346. while (iRowSet.next()) {
  347. sre = iRowSet.getInt("t1");
  348. }
  349. LOG.error("incomeItem-----------------" + incomeItem);
  350. //所属项目名称
  351. String incomeItemName = incomeItem.getName();
  352. //所属项目编码
  353. String incomeItemNumber = incomeItem.getNumber();
  354. //正常工资薪金
  355. if ("zcgzxjlb".equals(incomeItemNumber)) {
  356. //getComplexIncome(员工信息对象 ,所属项目,本期收入)
  357. normalSalarySpec.add(getComplexIncome(personInfo, incomeItemName, sre));
  358. //正常工资薪金列表 保存数据
  359. normalSalarySpecIncome.setNormalSalarySpec(normalSalarySpec);
  360. LOG.error("normalSalarySpecIncome-----------------" + mapper.writeValueAsString(normalSalarySpecIncome));
  361. complexIncomeRequest.setNormalSalarySpecIncome(normalSalarySpecIncome);
  362. }
  363. //全年一次性奖金收入
  364. if ("qnycxjjlb".equals(incomeItemNumber)) {
  365. annualOneTimeBonusIncome.add(getComplexIncome(personInfo, incomeItemName, sre));
  366. LOG.error("annualOneTimeBonusIncome-----------------" + mapper.writeValueAsString(annualOneTimeBonusIncome));
  367. LOG.error("annualOneTimeBonusIncome-----------------" + annualOneTimeBonusIncome);
  368. LOG.error("annualOneTimeBonusIncome.size()-----------------" + annualOneTimeBonusIncome.size());
  369. //全年一次性奖金收入 保存数据
  370. complexIncomeRequest.setAnnualOneTimeBonusIncome(annualOneTimeBonusIncome);
  371. }
  372. //一般劳务报酬所得
  373. if ("lwbclb".equals(incomeItemNumber)) {
  374. laborRemunerationIncome.add(getComplexIncome(personInfo, incomeItemName, sre));
  375. LOG.error("laborRemunerationIncome-----------------" + mapper.writeValueAsString(laborRemunerationIncome));
  376. //一般劳务报酬所得 保存数据
  377. complexIncomeRequest.setLaborRemunerationIncome(laborRemunerationIncome);
  378. }
  379. }
  380. }
  381. //综合所得
  382. declareRequestPara.setComplexIncomeRequest(complexIncomeRequest);
  383. //企业员工列表
  384. List<DetailCompanyEmployee> companyEmployeeList = getCompanyEmployeeList(personIds);
  385. declareRequestPara.setCompanyEmployeeList(companyEmployeeList);
  386. LOG.error("companyEmployeeList-----------------" + mapper.writeValueAsString(companyEmployeeList));
  387. return declareRequestPara;
  388. }
  389. /***
  390. * 员工
  391. * @return
  392. */
  393. private ComplexIncome getComplexIncome(PersonInfo personInfo, String incomeItemName, Integer sre) {
  394. ComplexIncome complexIncome = new ComplexIncome();
  395. //姓名
  396. complexIncome.setName(personInfo.getName());
  397. //居民身份证
  398. if (personInfo.getIdCardNO() != null) {
  399. //证照号码
  400. complexIncome.setLicenseNumber(personInfo.getIdCardNO());
  401. //证照类型
  402. complexIncome.setLicenseType("居民身份证");
  403. }
  404. //中国护照不
  405. if (personInfo.getPassportNO() != null) {
  406. //证照类型
  407. complexIncome.setLicenseType("中国护照");
  408. //证照号码
  409. complexIncome.setLicenseNumber(personInfo.getPassportNO());
  410. }
  411. //收入额
  412. complexIncome.setIncome(new BigDecimal(sre));
  413. complexIncome.setIncomeItemName(incomeItemName);
  414. return complexIncome;
  415. }
  416. /**
  417. * 企业员工列表*
  418. *
  419. * @return
  420. */
  421. private List<DetailCompanyEmployee> getCompanyEmployeeList(Set personIds) throws BOSException, EASBizException {
  422. List<DetailCompanyEmployee> companyEmployeeList = new ArrayList<DetailCompanyEmployee>();
  423. SelectorItemCollection sic = new SelectorItemCollection();
  424. sic.add("*");
  425. FilterInfo filterInfo = new FilterInfo();
  426. filterInfo.getFilterItems().add(new FilterItemInfo("id", personIds, CompareType.INCLUDE));
  427. EntityViewInfo entityViewInfo = EntityViewInfo.getInstance(filterInfo, sic, null); //获取人员数据
  428. PersonCollection personCollection = PersonFactory.getLocalInstance(ctx).getPersonCollection(entityViewInfo);
  429. if (personCollection.size() > 0) {
  430. for (int i = 0; i < personCollection.size(); i++) {
  431. PersonInfo personInfo = personCollection.get(i);
  432. companyEmployeeList.add(getDetailCompanyEmployee(personInfo));
  433. }
  434. }
  435. return companyEmployeeList;
  436. }
  437. /**
  438. * 人员
  439. *
  440. * @return
  441. */
  442. public DetailCompanyEmployee getDetailCompanyEmployee(PersonInfo personInfo) throws BOSException, EASBizException {
  443. //人员对象
  444. DetailCompanyEmployee detailCompanyEmployee = new DetailCompanyEmployee();
  445. ////姓名
  446. //detailCompanyEmployee.setName("何云");
  447. ////证件类型
  448. //detailCompanyEmployee.setLicenseType("居民身份证");
  449. ////证照号码
  450. //detailCompanyEmployee.setLicenseNumber("429004198601085125");
  451. //姓名
  452. detailCompanyEmployee.setName(personInfo.getName());
  453. //complexIncome.setName("何云");
  454. //居民身份证
  455. if (personInfo.getIdCardNO() != null) {
  456. //证照号码
  457. detailCompanyEmployee.setLicenseNumber(personInfo.getIdCardNO());
  458. //证照类型
  459. detailCompanyEmployee.setLicenseType("居民身份证");
  460. //人员地区
  461. detailCompanyEmployee.setArea("境内");
  462. }
  463. //中国护照
  464. if (personInfo.getPassportNO() != null) {
  465. //证照类型
  466. detailCompanyEmployee.setLicenseType("中国护照");
  467. //证照号码
  468. detailCompanyEmployee.setLicenseNumber(personInfo.getPassportNO());
  469. //人员地区
  470. detailCompanyEmployee.setArea("境外");
  471. }
  472. //电话号码
  473. detailCompanyEmployee.setPhone(personInfo.getCell());
  474. //人员状态
  475. detailCompanyEmployee.setState(personInfo.getEmployeeType().getName());
  476. //人员报税信息->任职受雇从业信息
  477. ITaxPersonRecordEntry iTaxPersonRecordEntry = TaxPersonRecordEntryFactory.getLocalInstance(ctx);
  478. TaxPersonRecordEntryCollection taxPersonRecordEntryCollection = iTaxPersonRecordEntry.getTaxPersonRecordEntryCollection("where person.id = '" + personInfo.getId() + "'");
  479. TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntryCollection.get(0);
  480. //任职受雇类型 可选择雇员、保险营销员、证券经纪人、其他、实习学生(全日制学历教育)
  481. //detailCompanyEmployee.setIsEmployee("其他");
  482. detailCompanyEmployee.setIsEmployee(taxPersonRecordEntryInfo.getEmployedType().getAlias());
  483. //受雇日期 YYYY-MM-DD,不能大于当前时间,任职受雇类型选择雇员、保险营销员、证券经纪人时必录
  484. SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd");
  485. detailCompanyEmployee.setEmployedDate(inputFormat.format(taxPersonRecordEntryInfo.getEmployedDate()));
  486. //性别
  487. detailCompanyEmployee.setGender(personInfo.getGender().getAlias());
  488. //出生日期
  489. detailCompanyEmployee.setBirthday(inputFormat.format(personInfo.getBirthday()));
  490. //国籍 nationality
  491. NationalityInfo nationality = personInfo.getNationality();
  492. detailCompanyEmployee.setNationality(nationality.getName());
  493. return detailCompanyEmployee;
  494. }
  495. private String getCheckSqlByType(Map<String, Object> incomeIdMap, String taxUnitId, String yearMonth, TbTypeEnum typeEnum) {
  496. StringBuilder sqlBuf = new StringBuilder();
  497. sqlBuf.append(" SELECT distinct tx.FTAXUNITID,t1.Fname_l2 as TAXNAME,p1.FNUMBER,p1.Fname_l2 as PERSONNAME, ti.fIncomeCode ");
  498. sqlBuf.append(" FROM T_HR_STaxCalConfigDetail tx ");
  499. sqlBuf.append(" left join T_HR_TAXUNIT as t1 on t1.fid = tx.FTaxUnitID ");
  500. sqlBuf.append(" left join T_BD_PERSON as p1 on p1.fid = tx.FPersonId ");
  501. sqlBuf.append(" left join t_hr_sTaxIncomeItem as ti on tx.fIncomeItemId = ti.fid ");
  502. String dateFilter = CmpSQLUtil.generateSqlDateFilter("tx.FPeriodBegin", "tx.FPeriodEnd", yearMonth);
  503. sqlBuf.append(" where ").append(dateFilter);
  504. sqlBuf.append(" and tx.FTAXUNITID='").append(taxUnitId).append("'");
  505. sqlBuf.append(" and tx.FSTATE=10");
  506. sqlBuf.append(" and tx.FIsLast=1");
  507. sqlBuf.append(" and tx.FIncomeItemId in ").append(incomeIdMap.get(typeEnum.getValue()));
  508. return sqlBuf.toString();
  509. }
  510. //private Map<String, Object> checkTaxDeclareData(Context ctx, List<IncomeTaxDeclarInfo> waitToDeclareList) throws BOSException {
  511. // Map<String, Object> checkDataResultMap = new HashMap();
  512. // return null;
  513. //}
  514. private Map<String, Object> checkTaxDeclareData(Context ctx, HttpServletRequest request, List<IncomeTaxDeclarInfo> waitToDeclareList) throws BOSException, SQLException, ShrWebBizException {
  515. Map<String, Object> checkDataResultMap = new HashMap();
  516. boolean hasErrData = false;
  517. if (waitToDeclareList != null && waitToDeclareList.size() > 0) {
  518. List<String> preCheckSql = new ArrayList();
  519. List<String> specCheckForPre = new ArrayList();
  520. List<String> notPersonCheckSql = new ArrayList();
  521. List<String> classifyCheckSql = new ArrayList();
  522. Map<String, Object> incomeIdMap = new HashMap();
  523. incomeIdMap.put("1", CmpTaxUtil.genIncomeItemId(ctx, "1"));
  524. incomeIdMap.put("2", CmpTaxUtil.genIncomeItemId(ctx, "2"));
  525. incomeIdMap.put("3", CmpTaxUtil.genIncomeItemId(ctx, "3"));
  526. Iterator i$ = waitToDeclareList.iterator();
  527. String yearMonth;
  528. while (i$.hasNext()) {
  529. IncomeTaxDeclarInfo declareInfo = (IncomeTaxDeclarInfo) i$.next();
  530. TbTypeEnum tbType = declareInfo.getTbType();
  531. String taxUnitId = declareInfo.getTaxUnit().getId().toString();
  532. yearMonth = declareInfo.getYearMonth();
  533. if (tbType != null) {
  534. if ("1".equals(tbType.getValue())) {
  535. preCheckSql.add(this.getCheckSqlByType(incomeIdMap, taxUnitId, yearMonth, TbTypeEnum.SB0701));
  536. specCheckForPre.add(this.getPreCheckSql(declareInfo));
  537. } else if ("3".equals(tbType.getValue())) {
  538. notPersonCheckSql.add(this.getCheckSqlByType(incomeIdMap, taxUnitId, yearMonth, TbTypeEnum.SB0703));
  539. } else {
  540. classifyCheckSql.add(this.getCheckSqlByType(incomeIdMap, taxUnitId, yearMonth, TbTypeEnum.SB0702));
  541. }
  542. }
  543. }
  544. Map<String, String> reasonOperaMap = new HashMap();
  545. reasonOperaMap.put("noCalDataReson", EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label140", ctx.getLocale()));
  546. reasonOperaMap.put("noCalDataOper", EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label141", ctx.getLocale()));
  547. reasonOperaMap.put("preDataReason", EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label142", ctx.getLocale()));
  548. reasonOperaMap.put("preDataOpera", EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label143", ctx.getLocale()));
  549. List<TaxDeclarExcelRowDTO> taxDeclareExcelRowDTOS = new ArrayList();
  550. taxDeclareExcelRowDTOS.addAll(this.getExceptData(ctx, preCheckSql, specCheckForPre, reasonOperaMap, TbTypeEnum.SB0701));
  551. taxDeclareExcelRowDTOS.addAll(this.getExceptData(ctx, classifyCheckSql, specCheckForPre, reasonOperaMap, TbTypeEnum.SB0702));
  552. taxDeclareExcelRowDTOS.addAll(this.getExceptData(ctx, notPersonCheckSql, specCheckForPre, reasonOperaMap, TbTypeEnum.SB0703));
  553. String filePath = "";
  554. if (taxDeclareExcelRowDTOS.size() > 0) {
  555. hasErrData = true;
  556. HSSFWorkbook workbook = new HSSFWorkbook();
  557. yearMonth = EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label144", ctx.getLocale());
  558. this.fillTitle(ctx, workbook, yearMonth.split(","));
  559. this.fillWorkdBookData(workbook, taxDeclareExcelRowDTOS);
  560. SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
  561. File dir = new File(UserUtil.getUserTempDirAbsolutePath(request.getSession()));
  562. if (!dir.exists()) {
  563. dir.mkdirs();
  564. }
  565. String fileName = EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label145", ctx.getLocale()) + "_" + format.format(new Date()) + ".xls";
  566. String realFileName = MD5.md5Hash(fileName);
  567. File file = new File(dir, realFileName);
  568. FileOutputStream out = null;
  569. try {
  570. out = new FileOutputStream(file);
  571. workbook.write(out);
  572. out.flush();
  573. } catch (FileNotFoundException var33) {
  574. LOG.error(var33.getMessage(), var33);
  575. } catch (IOException var34) {
  576. LOG.error(var34.getMessage(), var34);
  577. } finally {
  578. if (out != null) {
  579. try {
  580. out.close();
  581. } catch (IOException var32) {
  582. LOG.error(var32.getMessage(), var32);
  583. }
  584. }
  585. }
  586. Map<String, String> params = new HashMap();
  587. params.put("method", "tmp");
  588. params.put("file", realFileName);
  589. params.put("filename", fileName);
  590. filePath = DynamicUtil.assembleUrl("/downloadfile.do", params);
  591. }
  592. checkDataResultMap.put("excel", filePath);
  593. }
  594. checkDataResultMap.put("hasErrData", hasErrData);
  595. return checkDataResultMap;
  596. }
  597. private void fillTitle(Context ctx, HSSFWorkbook workbook, String[] titleArr) {
  598. HSSFSheet sheet = workbook.createSheet();
  599. HSSFRow createRow = sheet.createRow(0);
  600. HSSFCell infoCell = createRow.createCell(0);
  601. infoCell.setCellValue(EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label146", ctx.getLocale()));
  602. sheet.setColumnWidth(0, 12800);
  603. createRow = sheet.createRow(1);
  604. HSSFFont font = workbook.createFont();
  605. font.setColor((short) 8);
  606. font.setFontHeightInPoints((short) 12);
  607. font.setBoldweight((short) 700);
  608. HSSFCellStyle style = workbook.createCellStyle();
  609. style.setFont(font);
  610. style.setAlignment((short) 2);
  611. style.setVerticalAlignment((short) 1);
  612. if (titleArr != null && titleArr.length > 0) {
  613. for (int i = 0; i < titleArr.length; ++i) {
  614. HSSFCell cell = createRow.createCell(i);
  615. cell.setCellStyle(style);
  616. cell.setCellValue(titleArr[i]);
  617. if (i > 3) {
  618. sheet.setColumnWidth(i, 15360);
  619. } else {
  620. sheet.setColumnWidth(i, 7680);
  621. }
  622. }
  623. }
  624. }
  625. private void fillWorkdBookData(HSSFWorkbook workbook, List<TaxDeclarExcelRowDTO> dataList) {
  626. HSSFSheet sheet = workbook.getSheetAt(0);
  627. if (dataList != null && dataList.size() > 0) {
  628. for (int i = 0; i < dataList.size(); ++i) {
  629. HSSFRow row = sheet.createRow(i + 2);
  630. TaxDeclarExcelRowDTO excelRowDTO = (TaxDeclarExcelRowDTO) dataList.get(i);
  631. HSSFCell cell = row.createCell(0);
  632. cell.setCellValue(excelRowDTO.getPersonNum());
  633. cell = row.createCell(1);
  634. cell.setCellValue(excelRowDTO.getPersonName());
  635. cell = row.createCell(2);
  636. cell.setCellValue(excelRowDTO.getTaxName());
  637. cell = row.createCell(3);
  638. cell.setCellValue(excelRowDTO.getDeclarType());
  639. cell = row.createCell(4);
  640. cell.setCellValue(excelRowDTO.getReason());
  641. cell = row.createCell(5);
  642. cell.setCellValue(excelRowDTO.getOperation());
  643. }
  644. }
  645. }
  646. private String getSqlDateFilterLqDate(String dateStr) {
  647. String[] beginDateArr = dateStr.split("-");
  648. Calendar calendar = Calendar.getInstance();
  649. calendar.set(Integer.parseInt(beginDateArr[0]), Integer.parseInt(beginDateArr[1]) - 1, 1, 0, 0, 0);
  650. Date beginDate = calendar.getTime();
  651. return CmpDateUtil.toKSqlDate(beginDate);
  652. }
  653. private List<TaxDeclarExcelRowDTO> getExceptData(Context ctx, List<String> preCheckSql, List<String> specCheckForPre, Map<String, String> noCalDataOper, TbTypeEnum typeEnum) throws BOSException, SQLException, ShrWebBizException {
  654. List<TaxDeclarExcelRowDTO> taxDeclarExcelRowDTOS = new ArrayList();
  655. Iterator i$;
  656. String s;
  657. IRowSet rowSet;
  658. TaxDeclarExcelRowDTO taxDeclareExcelRow;
  659. if (preCheckSql != null && preCheckSql.size() > 0) {
  660. i$ = preCheckSql.iterator();
  661. while (i$.hasNext()) {
  662. s = (String) i$.next();
  663. rowSet = DbUtil.executeQuery(ctx, s);
  664. while (rowSet.next()) {
  665. taxDeclareExcelRow = new TaxDeclarExcelRowDTO();
  666. taxDeclareExcelRow.setPersonNum(rowSet.getString("FNUMBER"));
  667. taxDeclareExcelRow.setPersonName(rowSet.getString("PERSONNAME"));
  668. String taxUnitName = rowSet.getString("TAXNAME");
  669. taxDeclareExcelRow.setTaxName(taxUnitName);
  670. taxDeclareExcelRow.setDeclarType(typeEnum.getAlias());
  671. taxDeclareExcelRow.setReason((String) noCalDataOper.get("noCalDataReson"));
  672. taxDeclareExcelRow.setOperation((String) noCalDataOper.get("noCalDataOper"));
  673. String incomeCode = (String) noCalDataOper.get("fIncomeCode");
  674. taxDeclarExcelRowDTOS.add(taxDeclareExcelRow);
  675. }
  676. }
  677. }
  678. if ("1".equals(typeEnum.getValue()) && specCheckForPre != null && specCheckForPre.size() > 0) {
  679. i$ = specCheckForPre.iterator();
  680. while (i$.hasNext()) {
  681. s = (String) i$.next();
  682. rowSet = DbUtil.executeQuery(ctx, s);
  683. while (rowSet.next()) {
  684. taxDeclareExcelRow = new TaxDeclarExcelRowDTO();
  685. taxDeclareExcelRow.setPersonNum(rowSet.getString("FNUMBER"));
  686. taxDeclareExcelRow.setPersonName(rowSet.getString("PERSONNAME"));
  687. taxDeclareExcelRow.setTaxName(rowSet.getString("TAXNAME"));
  688. taxDeclareExcelRow.setDeclarType(typeEnum.getAlias());
  689. taxDeclareExcelRow.setReason((String) noCalDataOper.get("preDataReason"));
  690. taxDeclareExcelRow.setOperation((String) noCalDataOper.get("preDataOpera"));
  691. taxDeclarExcelRowDTOS.add(taxDeclareExcelRow);
  692. }
  693. }
  694. }
  695. return taxDeclarExcelRowDTOS;
  696. }
  697. private String getPreCheckSql(IncomeTaxDeclarInfo incomeTaxDeclarInfo) {
  698. StringBuilder sqlBuf = new StringBuilder();
  699. String yearMonth = incomeTaxDeclarInfo.getYearMonth();
  700. String taxUnitId = incomeTaxDeclarInfo.getTaxUnit().getId().toString();
  701. String sql = "select FPersonID from T_HR_STaxCalConfigDetail where FTaxUnitId='" + taxUnitId + "' and FPeriodBegin = " + CmpDateUtil.toKSqlDate(incomeTaxDeclarInfo.getYearMonthDate());
  702. sqlBuf.append(" SELECT distinct ent.FTAXUNITID, t.Fname_l2 as TAXNAME, p.FNUMBER, p.Fname_l2 as PERSONNAME ");
  703. sqlBuf.append(" FROM T_HR_STaxPersonRecordEntry ent ");
  704. sqlBuf.append(" left join T_HR_TAXUNIT as t on t.fid = ent.FTaxUnitID ");
  705. sqlBuf.append(" left join T_BD_PERSON as p on p.fid = ent.FPersonId ");
  706. sqlBuf.append(" where ent.FSubmitStatus='2' and ent.FPersonStatus='1' ");
  707. sqlBuf.append(" and ent.FTaxUnitID='").append(taxUnitId).append("'");
  708. sqlBuf.append(" and ent.FENDDATE <=").append(this.getSqlDateFilterLqDate(yearMonth));
  709. sqlBuf.append(" and ent.FPersonID not in ( ").append(sql).append(" )");
  710. return sqlBuf.toString();
  711. }
  712. private Map<String, Object> checkIncomeTaxIssue(Context ctx, List<IncomeTaxDeclarInfo> waitToDeclareList) throws BOSException {
  713. StringBuilder taxUnitIds = new StringBuilder();
  714. IncomeTaxDeclarInfo declareInfo;
  715. for (Iterator i$ = waitToDeclareList.iterator(); i$.hasNext(); taxUnitIds.append(declareInfo.getTaxUnit().getId().toString())) {
  716. declareInfo = (IncomeTaxDeclarInfo) i$.next();
  717. if (taxUnitIds.length() > 0) {
  718. taxUnitIds.append(",");
  719. }
  720. }
  721. String oql = "select person.person.name where taxUnit.id in " + CmpStrUtil.buildInSql(taxUnitIds.toString()) + " and result = " + 1 + " and status = " + 2 + " and inviteStatus = " + 0;
  722. IncomeTaxIssueCollection collection = IncomeTaxIssueFactory.getLocalInstance(ctx).getIncomeTaxIssueCollection(oql);
  723. if (collection != null && !collection.isEmpty()) {
  724. StringBuilder errMsg = new StringBuilder();
  725. for (int i = 0; i < collection.size() && i != 5; ++i) {
  726. if (errMsg.length() > 0) {
  727. errMsg.append(",");
  728. }
  729. errMsg.append("[").append(collection.get(i).getPerson().getPerson().getName()).append("]");
  730. }
  731. Map<String, Object> map = new HashMap();
  732. map.put("errMsg", "以下员工存在申诉属实争议,且未进行邀请确认,需要进行发送邀请确认后才可进行个税申报或者进行非正常人员报送(更新人员报税信息中的人员状态为非正常,并进行人员报送成功),员工姓名:" + errMsg.toString() + ",选择[是]则跳转到[申诉争议-申诉属实人员]列表,选择[否]则跳转到[人员报税信息]列表。");
  733. map.put("issueError", true);
  734. return map;
  735. } else {
  736. return null;
  737. }
  738. }
  739. private String checkTaxCalStatus(Context ctx, List<IncomeTaxDeclarInfo> waitToDeclareList) throws SHRWebException {
  740. String sql = "select t.fState, u.fName_l2 taxUnitName, d.fIncomeItemId from t_hr_sTaxCalConfigDetail d left join t_hr_sTaxCalInitDetail t on d.fCmpCalTableId = t.fCmpCalTableId and d.fIncomeItemId = t.fIncomeItemId left join t_hr_taxUnit u on d.fTaxUnitId = u.fid where d.fTaxUnitId = ? and d.fPeriodBegin = ?";
  741. try {
  742. Iterator i$ = waitToDeclareList.iterator();
  743. boolean isTaxCalFinished;
  744. String taxUnitName;
  745. do {
  746. if (!i$.hasNext()) {
  747. return null;
  748. }
  749. IncomeTaxDeclarInfo declareInfo = (IncomeTaxDeclarInfo) i$.next();
  750. String taxUnitId = declareInfo.getTaxUnit().getId().toString();
  751. Date periodDate = declareInfo.getYearMonthDate();
  752. Object[] param = new Object[]{taxUnitId, CmpDateUtil.toSqlDate(periodDate)};
  753. IRowSet rs = DbUtil.executeQuery(ctx, sql, param);
  754. boolean havingSalaryIncome = false;
  755. isTaxCalFinished = true;
  756. taxUnitName = "";
  757. while (rs.next()) {
  758. int state = rs.getInt("fState");
  759. taxUnitName = rs.getString("taxUnitName");
  760. String incomeItemId = rs.getString("fIncomeItemId");
  761. if (state != 40) {
  762. isTaxCalFinished = false;
  763. }
  764. if ("8r0AAABCg2PDiOoP".equals(incomeItemId)) {
  765. havingSalaryIncome = true;
  766. }
  767. }
  768. TbTypeEnum typeEnum = declareInfo.getTbType();
  769. if (!havingSalaryIncome && typeEnum == TbTypeEnum.SB0701) {
  770. return "纳税单位[" + taxUnitName + "]当期预扣预缴申报表未包含所得项目为正常工资薪金所得的员工,不允许申报,请确认";
  771. }
  772. } while (isTaxCalFinished);
  773. return "纳税单位【" + taxUnitName + "】存在接口算税未完成的数据,请确认";
  774. } catch (Exception var15) {
  775. LOG.error("checkTaxCalStatus error: ", var15);
  776. throw new SHRWebException(var15.getMessage());
  777. }
  778. }
  779. /**
  780. * 异常提醒
  781. *
  782. * @param advanceDeclareInfo
  783. * @return
  784. */
  785. private String combineError(List<String> advanceDeclareInfo) {
  786. StringBuilder error = new StringBuilder();
  787. error.append("以下纳税单位尚未到申报时间,请不要提前申报:");
  788. Iterator i$ = advanceDeclareInfo.iterator();
  789. while (i$.hasNext()) {
  790. String taxUnitInfo = (String) i$.next();
  791. if (advanceDeclareInfo.indexOf(taxUnitInfo) == 5) {
  792. error.append("...");
  793. break;
  794. }
  795. if (advanceDeclareInfo.indexOf(taxUnitInfo) > 0) {
  796. error.append(",");
  797. }
  798. String[] arr = taxUnitInfo.split("_");
  799. error.append(arr[0]).append("【").append(arr[1]).append("】");
  800. }
  801. return error.toString();
  802. }
  803. /**
  804. * 获取个税申报审批通过数据
  805. *
  806. * @param ctx
  807. * @param selectedId
  808. * @return
  809. * @throws BOSException
  810. */
  811. private Map<String, Object> getDeclareData(Context ctx, String selectedId) throws BOSException, JsonProcessingException {
  812. Map<String, Object> resultMap = new HashMap();
  813. List<TaxDeclareDTO> declaredList = new ArrayList();
  814. List<IncomeTaxDeclarInfo> waitToDeclareList = new ArrayList();
  815. String sqlInString = CmpUtils.spiltToSqlString(selectedId);
  816. if (StringUtils.isEmpty(sqlInString)) {
  817. sqlInString = "''";
  818. }
  819. String currentYearMonth = CmpDateUtil.getDateStr(new Date(), "yyyy-MM");
  820. 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 + " )";
  821. LOG.error("getDeclareData----------oqlBuffer------" + oqlBuffer);
  822. IncomeTaxDeclarCollection declareCollection = IncomeTaxDeclarFactory.getLocalInstance(ctx).getIncomeTaxDeclarCollection(oqlBuffer);
  823. LOG.error("getDeclareData----------declareCollection------" + declareCollection.size());
  824. String ms1 = EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label137", ctx.getLocale());
  825. String ms2 = EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label138", ctx.getLocale());
  826. String ms3 = EASResource.getString("com.kingdee.shr.compensation.resource.CommonResource", "label139", ctx.getLocale());
  827. List<String> taxUnitInfo = new ArrayList();
  828. if (declareCollection != null && declareCollection.size() > 0) {
  829. for (int i = 0; i < declareCollection.size(); ++i) {
  830. IncomeTaxDeclarInfo declareInfo = declareCollection.get(i);
  831. String declareStatus = declareInfo.getDeclareStatus().getValue();
  832. LOG.error("getDeclareData----------declareStatus------" + declareStatus);
  833. String taxUnitName = declareInfo.getTaxUnit().getName();
  834. String tbTypeAlia = declareInfo.getTbType().getAlias();
  835. if (currentYearMonth.compareTo(declareInfo.getYearMonth()) <= 0) {
  836. taxUnitInfo.add(declareInfo.getTaxUnit().getName() + "_" + declareInfo.getYearMonth());
  837. }
  838. if (!"1".equals(declareStatus) && !"2".equals(declareStatus)) {
  839. waitToDeclareList.add(declareInfo);
  840. LOG.error("getDeclareData----------waitToDeclareList------" + waitToDeclareList);
  841. } else {
  842. TaxDeclareDTO dto = new TaxDeclareDTO(taxUnitName, tbTypeAlia);
  843. declaredList.add(dto);
  844. }
  845. }
  846. if (declaredList.size() == declareCollection.size()) {
  847. resultMap.put("info", ms1);
  848. } else if (declaredList.size() == 0) {
  849. resultMap.put("info", ms2);
  850. } else {
  851. resultMap.put("info", ms3);
  852. }
  853. }
  854. LOG.error("getDeclareData----------resultMap------" + resultMap);
  855. resultMap.put("DECLARED", declaredList);
  856. resultMap.put("advanceDeclareInfo", taxUnitInfo);
  857. resultMap.put("WATI_TO_DECLARE", waitToDeclareList);
  858. return resultMap;
  859. }
  860. private void updateOrCancel(HttpServletRequest request, HttpServletResponse response, TaskCatalogEnum catalog)
  861. throws SHRWebException {
  862. Context ctx = SHRContext.getInstance().getContext();
  863. String selectedId = request.getParameter("selectedId");
  864. String oql = "select id, tbType, yearMonth, yearMonthDate, taxUnit.id, taxUnit.name, taxUnit.areaCode, taxUnit.taxNumber, taxUnit.regNumber, taxUnit.declPassword, taxUnit.realPassword, acceptId where id = '"
  865. + selectedId + "'";
  866. try {
  867. IncomeTaxDeclarCollection collection = IncomeTaxDeclarFactory.getLocalInstance(ctx)
  868. .getIncomeTaxDeclarCollection(oql);
  869. if (null != collection && collection.size() != 0) {
  870. IncomeTaxDeclarInfo incomeTaxDeclare = collection.get(0);
  871. if (TaskCatalogEnum.TaxDeclareUpdate == catalog) {
  872. //更新
  873. updateDeclare(ctx,incomeTaxDeclare);
  874. } else {
  875. //更新以外的
  876. if (TaskCatalogEnum.CancelTaxDeclare != catalog) {
  877. //撤销更正
  878. System.out.print("撤销更正找到方法");
  879. cancelUpdate( ctx ,incomeTaxDeclare);
  880. return;
  881. }
  882. //撤销申报
  883. System.out.print("作废申报找到方法");
  884. cancelDeclare(ctx,incomeTaxDeclare);
  885. System.out.print("作废申报完成");
  886. }
  887. String templateId = "4i4AAAAS76+Vh943";
  888. String columnSQL = "select t.fieldsn, f.FPROPNAME,f.fname_l2,f.fcustomfield from T_BS_SHRFileTemplateFields f left join t_HR_sTaxItem t on f.FPROPNAME = t.FNUMBER where f.fcmpimporttempid = '"
  889. + templateId + "' order by f.fsortsn ";
  890. IRowSet columnSet = DbUtil.executeQuery(ctx, columnSQL);
  891. StringBuilder tmpSQL = new StringBuilder();
  892. tmpSQL.append("select ");
  893. String dynamicFieldPrefix = "t";
  894. String local = SHRContext.getInstance().getContext().getLocale().getDisplayLanguage();
  895. int columnSize = columnSet.size();
  896. while (columnSet.next()) {
  897. int index = columnSet.getInt(1);
  898. String propName = columnSet.getString(2);
  899. int isCustom = columnSet.getInt(4);
  900. if (isCustom == 1 && index > 0) {
  901. tmpSQL.append(dynamicFieldPrefix).append(index).append(",");
  902. } else if (propName.endsWith("_")) {
  903. tmpSQL.append(propName).append(local).append(",");
  904. } else {
  905. tmpSQL.append(propName).append(",");
  906. }
  907. }
  908. String sql = tmpSQL.substring(0, tmpSQL.length() - 1);
  909. Date date = incomeTaxDeclare.getYearMonthDate();
  910. String taxUnitId = incomeTaxDeclare.getTaxUnit().getId().toString();
  911. TbTypeEnum tbType = incomeTaxDeclare.getTbType();
  912. String personType = CmpConstants.getPayerTypeByTbType(tbType.getValue());
  913. String dataSQL = sql
  914. + " from t_hr_sTaxCalConfigDetail t left join T_BD_Person person on t.fPersonId = person.fid left join T_HR_STaxPersonRecord taxPersonRec on t.fPersonId = taxPersonRec.fPersonId left join T_HR_TaxUnit taxUnit on t.fTaxUnitId = taxUnit.fid left join T_HR_STaxIncomeItem item on t.fIncomeItemId = item.fid left join T_HR_STaxPersonRecordEntry pEntry on taxPersonRec.fid = pEntry.fBillId where t.fPeriodBegin = "
  915. + CmpDateUtil.toKSqlDate(date) + " and t.fTaxUnitId = '" + taxUnitId
  916. + "' and pEntry.fTaxUnitId = '" + taxUnitId + "' and pEntry.fPayerType = '" + personType
  917. + "'";
  918. IRowSet dataSet = DbUtil.executeQuery(ctx, dataSQL);
  919. List<List<Object>> dataList = new ArrayList();
  920. IRowSetMetaData metaData = dataSet.getRowSetMetaData();
  921. for (int rowIndex = 1; dataSet.next(); ++rowIndex) {
  922. List<Object> row = new ArrayList();
  923. row.add(rowIndex);
  924. for (int i = 1; i <= columnSize; ++i) {
  925. int dataType = metaData.getColumnType(i);
  926. row.add(ImplUtils.getDataFromDr(dataType, dataSet, i));
  927. }
  928. dataList.add(row);
  929. }
  930. String template = request.getSession().getServletContext().getRealPath("/")
  931. + "addon/compensation/web/resource/incomeTaxSbbExportTemplate.xlsx";
  932. String taxUnitName = incomeTaxDeclare.getTaxUnit().getName();
  933. String tbTypeName = incomeTaxDeclare.getTbType().getAlias();
  934. String period = TaxCalcFileUtils.getCnPeriod1(incomeTaxDeclare.getYearMonthDate());
  935. String timestamp = TaxCalcFileUtils.getTimestamp(new Date());
  936. String userTempDirAbsolutePath = UserUtil.getUserTempDirAbsolutePath(request.getSession());
  937. userTempDirAbsolutePath = userTempDirAbsolutePath + "/exportExcel";
  938. File dir = new File(userTempDirAbsolutePath);
  939. if (!dir.exists()) {
  940. dir.mkdirs();
  941. }
  942. String fileName = "个税申报表_" + taxUnitName + "_" + tbTypeName + "_" + period + "_" + timestamp
  943. + ".xlsx";
  944. String path = dir.getAbsolutePath() + File.separator + fileName;
  945. Map<String, String> params = new HashMap();
  946. params.put("startAndEnd", TaxCalcFileUtils.getCnPeriod2(incomeTaxDeclare.getYearMonthDate()));
  947. params.put("taxUnitName", taxUnitName);
  948. params.put("taxUnitNumber", incomeTaxDeclare.getTaxUnit().getTaxNumber());
  949. CmpExcelUtil.writeData2Template(dataList, template, 8, path, params);
  950. String headerStr = "attachment;filename=" + URLEncoder.encode(fileName, "utf-8");
  951. response.setHeader("Content-disposition", headerStr);
  952. response.getOutputStream().write(TaxCalcFileUtils.file2ByteArray(new File(path)));
  953. response.getOutputStream().flush();
  954. return;
  955. } else {
  956. throw new SHRWebException("没有找到申报记录");
  957. }
  958. } catch (Exception var37) {
  959. LOG.error("updateDeclareAction error: ", var37);
  960. throw new SHRWebException(var37.getMessage());
  961. }
  962. }
  963. protected Map cancelUpdate(Context ctx, IncomeTaxDeclarInfo taxDeclare) throws BOSException {
  964. try {
  965. String sql = "select t.fAccept_id as acceptId from t_hr_sIncomeTaxDeclar d left join t_hr_sTaskIncomeTaxRelation r on d.fid = r.fBizId left join t_hr_sTaxCalTask t on r.fTaskId = t.fid where d.fid = '"
  966. + taxDeclare.getId().toString() + "' and t.fCatalog = " + 120;
  967. IRowSet rowSet = DbUtil.executeQuery(ctx, sql);
  968. if (rowSet.size() == 0) {
  969. throw new BOSException("找不到更正申报任务受理id");
  970. } else {
  971. while (rowSet.next()) {
  972. taxDeclare.setAcceptId(rowSet.getString("acceptId"));
  973. }
  974. return updateOrCancel(ctx, taxDeclare, TaskCatalogEnum.CancelTaxUpdate);
  975. }
  976. } catch (SQLException var5) {
  977. LOG.error("_cancelUpdate error: ", var5);
  978. throw new BOSException(var5.getMessage());
  979. }
  980. }
  981. private Map updateOrCancel(Context ctx, IncomeTaxDeclarInfo taxDeclare, TaskCatalogEnum catalog)
  982. throws BOSException {
  983. JSONObject param = new JSONObject();
  984. String billId = StringUtils.cnulls(taxDeclare.getId());
  985. param.put("taxDeclarId", billId);
  986. param.put("taxDeclarBatchNo", StringUtils.cnulls(taxDeclare.getBatchNo()) );
  987. Map<String, Object> paramMap = new HashMap();
  988. DeclareCancelRequest requestObj = new DeclareCancelRequest();
  989. TaxUnitInfo taxUnit = taxDeclare.getTaxUnit();
  990. /// bizNo 外部业务编号 String(64) 是 外部业务编号,唯一,幂等需要,最长64位,建议使用UUID
  991. String bizNo = UUID.randomUUID().toString();
  992. paramMap.put("bizNo" , bizNo);
  993. requestObj.setBizNo(bizNo);
  994. //qymc 企业名称 String(64) 是 代报企业全称
  995. System.out.print("企业名称为:"+taxUnit.getName());
  996. paramMap.put("qymc" , taxUnit.getName() );
  997. requestObj.setName(taxUnit.getName());
  998. //djxhid 登记序号 String(64) 条件必填 存在多个登记序号时,需要指定传入一个.例:10117440105249764755
  999. paramMap.put("djxhid" , taxUnit.getRegNumber());
  1000. requestObj.setRegistrationNumber(taxUnit.getRegNumber());
  1001. //nsrsbh 税号 String(64) 是 扣缴单位纳税人识别号
  1002. paramMap.put("nsrsbh" , taxUnit.getTaxNumber());
  1003. requestObj.setTaxNo(taxUnit.getTaxNumber());
  1004. //areaid 地区编号 String(64) 是 6位行政区划代码,精确到市级,例如:440100,参考省市区编码
  1005. paramMap.put("areaid" , taxUnit.getAreaCode());
  1006. requestObj.setArea(taxUnit.getAreaCode());
  1007. //bmbh 部门编号 String(64) 条件必填 分部门代报时必传
  1008. //bmmc 部门名称 String(64) 否
  1009. //skssq 所属期 String(64) 是 格式YYYYMM。为空时, 根据任职受雇日期判断:
  1010. String period = taxDeclare.getYearMonth();
  1011. period = period.contains("-") ? period.replace("-", "") : period;
  1012. period = period.substring(0, 6);
  1013. requestObj.setMonth(period);
  1014. paramMap.put("skssq" , period);
  1015. //sblx 申报类型 String(64) 必填 1:综合所得;2:分类所得;3:非居民所得;4:限售股所得
  1016. paramMap.put("sblx" , "1");
  1017. requestObj.setDeclarationType("1");
  1018. //sfqksd 是否清空所得数据 String(64) 否 0:不清空 1 清空, 默认为0, 作废申报的同时清空数据
  1019. requestObj.setCancelImportDataOption("0");
  1020. //jmsmmm 加密实名密码 String(64) 否 默认不传则设置为0,0表示不加密;1表示加密
  1021. paramMap.put("jmsbmm" , "0");
  1022. requestObj.setEncryptedRealNamePassword("0");
  1023. if (!StringUtils.isEmpty(taxUnit.getRealPassword())) {
  1024. //mmlx 密码类型 String(64) 否 默认不传则设置为0, 0表示申报密码;2表示实名账号实名密码
  1025. paramMap.put("mmlx" , "2");
  1026. requestObj.setPasswordType("2");
  1027. //smzh 实名账号 String(64) 条件必填 当mmlx=2时,必填。
  1028. paramMap.put("smzh", false);
  1029. requestObj.setRealNameAccount("");
  1030. //smmm 实名密码 String(64) 条件必填 当mmlx=2时,必填
  1031. paramMap.put("smmm", Base64Utils.decode(taxUnit.getRealPassword()));
  1032. requestObj.setRealNamePassword(Base64Utils.decode(taxUnit.getRealPassword()));
  1033. }
  1034. if (!StringUtils.isEmpty(taxUnit.getDeclPassword())) {
  1035. //sbmm 申报密码 String(64) 条件必填 当mmlx=0时,必填
  1036. paramMap.put("sbmm", Base64Utils.decode(taxUnit.getDeclPassword()));
  1037. requestObj.setDeclarePassword(Base64Utils.decode(taxUnit.getDeclPassword()));
  1038. //mmlx 密码类型 String(64) 否 默认不传则设置为0, 0表示申报密码;2表示实名账号实名密码
  1039. paramMap.put("mmlx" , "0");
  1040. requestObj.setPasswordType("0");
  1041. }
  1042. //客户端代理工厂
  1043. try {
  1044. ClientProxyFactory clientProxyFactory = ClientProxyFactoryUtils.getClientProxyFactory();
  1045. //算税请求接口
  1046. DeclarationRequest declarationRequest = clientProxyFactory.getDeclarationRequest();
  1047. //获取请求参数
  1048. if( catalog.equals(TaskCatalogEnum.CancelTaxDeclare) ) {
  1049. // Gson gson = new Gson();
  1050. // Type personType = new TypeToken<DeclareCancelRequest>(){}.getType();
  1051. // DeclareCancelRequest newObj = gson.fromJson(gson.toJson(requestObj), personType);
  1052. LOG.error("撤销申报执行参数:"+mapper.writeValueAsString(requestObj));
  1053. //CancelTaxDeclare 作废申报 140
  1054. ApiResponse<AsyncResult> apiResponse = declarationRequest.cancel (requestObj);
  1055. LOG.error("撤销申报执行结果"+apiResponse.getHead().getMsg());
  1056. if (apiResponse.getHead().getCode().equals("00000000")) {
  1057. AsyncResult body = apiResponse.getBody();
  1058. String requestId = body.getRequestId();
  1059. LOG.error("requestId-----" + requestId);
  1060. ISYUtilsFacade isyUtilsFacade = SYUtilsFacadeFactory.getLocalInstance(ctx);
  1061. //backTask(url,requestId,回调osf服务,自定义参数,任务类型)
  1062. JSONObject json = new JSONObject();
  1063. json.put("requestId", requestId);
  1064. json.put("reportType", "1");
  1065. //
  1066. // JSONObject paramJson = new JSONObject();
  1067. // paramJson.put("taxDeclarId", taxDeclare.getId().toString());
  1068. // paramJson.put("taxDeclarBatchNo", taxDeclare.getBatchNo());
  1069. json.put("param", param );
  1070. LOG.error("撤销申报执行调用后台开始"+param);
  1071. isyUtilsFacade.addTask("CancelDeclareService", json.toJSONString(), TaskCatalogEnum.CancelTaxDeclare, "");
  1072. LOG.error("撤销申报执行调用后台完成");
  1073. }
  1074. }else if(catalog.equals(TaskCatalogEnum.TaxDeclareUpdate)) {
  1075. //更正申报 120
  1076. // Gson gson = new Gson();
  1077. // Type personType = new TypeToken<DeclareCorrectRequest>(){}.getType();
  1078. // DeclareCorrectRequest newObj = gson.fromJson(gson.toJson(paramMap), personType);
  1079. ObjectMapper mapper = new ObjectMapper();
  1080. DeclareCorrectRequest newObj = mapper.convertValue(paramMap, DeclareCorrectRequest.class);
  1081. LOG.error("更正申报执行参数:"+mapper.writeValueAsString(newObj));
  1082. ApiResponse<AsyncResult> apiResponse = declarationRequest.correct (newObj);
  1083. LOG.error("更正申报执行结果"+apiResponse.getHead().getMsg());
  1084. if (apiResponse.getHead().getCode().equals("00000000")) {
  1085. //同步接口;
  1086. //个税申报批次号
  1087. String taxDeclarBatchNo = taxDeclare.getBatchNo();
  1088. IIncomeTaxDeclar iIncomeTaxDeclar = IncomeTaxDeclarFactory.getLocalInstance(ctx);
  1089. IncomeTaxDeclarInfo incomeTaxDeclarInfo = iIncomeTaxDeclar.getIncomeTaxDeclarInfo(new ObjectUuidPK(billId));
  1090. SelectorItemCollection updateSic = new SelectorItemCollection();
  1091. updateSic.add("declareStatus");
  1092. if (null != incomeTaxDeclarInfo) {
  1093. incomeTaxDeclarInfo.setDeclareStatus(TaxDeclareStatusEnum.DECLARE_NO);
  1094. iIncomeTaxDeclar.updatePartial(incomeTaxDeclarInfo, updateSic);
  1095. }
  1096. }
  1097. }else if(catalog.equals(TaskCatalogEnum.CancelTaxUpdate )) {
  1098. System.out.print("撤销更正执行");
  1099. //撤销更正申报
  1100. // Gson gson = new Gson();
  1101. // Type personType = new TypeToken<DeclareCorrectRequest>(){}.getType();
  1102. // DeclareCorrectRequest newObj = gson.fromJson(gson.toJson(paramMap), personType);
  1103. ObjectMapper mapper = new ObjectMapper();
  1104. DeclareCorrectRequest convertValue = mapper.convertValue(paramMap, DeclareCorrectRequest.class);
  1105. LOG.error("撤销更正执行参数:"+mapper.writeValueAsString(convertValue));
  1106. ApiResponse<AsyncResult> apiResponse = declarationRequest.cancelCorrect (convertValue);
  1107. LOG.error("撤销更正执行结果"+apiResponse.getHead().getMsg());
  1108. if (apiResponse.getHead().getCode().equals("00000000")) {
  1109. //同步接口;
  1110. //个税申报批次号
  1111. String taxDeclarBatchNo = taxDeclare.getBatchNo();
  1112. IIncomeTaxDeclar iIncomeTaxDeclar = IncomeTaxDeclarFactory.getLocalInstance(ctx);
  1113. // IncomeTaxDeclarCollection incomeTaxDeclarCollection = iIncomeTaxDeclar.getIncomeTaxDeclarCollection("where batchNo = '" + taxDeclarBatchNo + "'");
  1114. IncomeTaxDeclarInfo incomeTaxDeclarInfo = iIncomeTaxDeclar.getIncomeTaxDeclarInfo(new ObjectUuidPK(billId));
  1115. SelectorItemCollection updateSic = new SelectorItemCollection();
  1116. updateSic.add("declareStatus");
  1117. if (null != incomeTaxDeclarInfo) {
  1118. // IncomeTaxDeclarInfo incomeTaxDeclarInfo = incomeTaxDeclarCollection.get(0);
  1119. incomeTaxDeclarInfo.setDeclareStatus(TaxDeclareStatusEnum.DECLARE_SUCCESS);
  1120. iIncomeTaxDeclar.updatePartial(incomeTaxDeclarInfo, updateSic);
  1121. }
  1122. }
  1123. }
  1124. } catch (IOException e) {
  1125. e.printStackTrace();
  1126. } catch (EASBizException e) {
  1127. e.printStackTrace();
  1128. }
  1129. return paramMap;
  1130. }
  1131. /**
  1132. * 撤销申请
  1133. * @param ctx
  1134. * @param taxDeclare
  1135. * @return
  1136. * @throws BOSException
  1137. */
  1138. protected Map cancelDeclare(Context ctx, IncomeTaxDeclarInfo taxDeclare) throws BOSException {
  1139. return this.updateOrCancel(ctx, taxDeclare, TaskCatalogEnum.CancelTaxDeclare);
  1140. }
  1141. /**
  1142. * 更正
  1143. * @param ctx
  1144. * @param taxDeclare
  1145. * @return
  1146. * @throws BOSException
  1147. */
  1148. protected Map updateDeclare(Context ctx, IncomeTaxDeclarInfo taxDeclare) throws BOSException {
  1149. return updateOrCancel(ctx, taxDeclare, TaskCatalogEnum.TaxDeclareUpdate);
  1150. }
  1151. /**
  1152. * 撤销申报
  1153. *
  1154. */
  1155. public void cancelDeclareAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
  1156. throws SHRWebException {
  1157. this.updateOrCancel(request, response, TaskCatalogEnum.CancelTaxDeclare);
  1158. request.setAttribute(CmpConstants.CMP_LOG_OPERATE, "cancelDeclare");
  1159. }
  1160. /**
  1161. * 更正申请
  1162. */
  1163. public void updateDeclareAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
  1164. throws SHRWebException {
  1165. this.updateOrCancel(request, response, TaskCatalogEnum.TaxDeclareUpdate);
  1166. request.setAttribute(CmpConstants.CMP_LOG_OPERATE, "updateDeclare");
  1167. }
  1168. /**
  1169. * 撤销更正
  1170. *
  1171. */
  1172. public void cancelUpdateAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap)
  1173. throws SHRWebException {
  1174. this.updateOrCancel(request, response, TaskCatalogEnum.CancelTaxUpdate);
  1175. request.setAttribute(CmpConstants.CMP_LOG_OPERATE, "cancelUpdate");
  1176. }
  1177. }