IncomeTaxDeclareListHandlerEx.java 63 KB

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