TaxUnitListHandlerEx.java 34 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680
  1. package com.kingdee.eas.custom.shuiyou;
  2. import com.alibaba.fastjson.JSONArray;
  3. import com.alibaba.fastjson.JSONObject;
  4. import com.kingdee.bos.BOSException;
  5. import com.kingdee.bos.Context;
  6. import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
  7. import com.kingdee.bos.util.BOSUuid;
  8. import com.kingdee.eas.basedata.hraux.BirthplaceFactory;
  9. import com.kingdee.eas.basedata.hraux.NationalityFactory;
  10. import com.kingdee.eas.basedata.person.PersonFactory;
  11. import com.kingdee.eas.common.EASBizException;
  12. import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoCollection;
  13. import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoFactory;
  14. import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoInfo;
  15. import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
  16. import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
  17. import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
  18. import com.kingdee.shr.base.syssetting.context.SHRContext;
  19. import com.kingdee.shr.base.syssetting.exception.SHRWebException;
  20. import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
  21. import com.kingdee.shr.compensation.app.incomeTax.*;
  22. import com.kingdee.shr.compensation.app.tax.TaxUnitCollection;
  23. import com.kingdee.shr.compensation.app.tax.TaxUnitFactory;
  24. import com.kingdee.shr.compensation.app.tax.TaxUnitInfo;
  25. import com.kingdee.shr.compensation.util.Base64Utils;
  26. import com.kingdee.shr.compensation.web.handler.tax.taxUnit.TaxUnitListHandler;
  27. import okhttp3.*;
  28. import org.apache.log4j.Logger;
  29. import org.springframework.ui.ModelMap;
  30. import javax.servlet.http.HttpServletRequest;
  31. import javax.servlet.http.HttpServletResponse;
  32. import java.io.FileInputStream;
  33. import java.io.FileNotFoundException;
  34. import java.io.IOException;
  35. import java.math.BigDecimal;
  36. import java.text.SimpleDateFormat;
  37. import java.util.*;
  38. public class TaxUnitListHandlerEx extends TaxUnitListHandler {
  39. private Properties propt = new Properties();
  40. private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx");
  41. /**
  42. * 企业注册
  43. *
  44. * @param request
  45. * @param response
  46. * @param modelMap
  47. * @throws SHRWebException
  48. */
  49. public void businessAegistrationAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
  50. String entrance = "com.kingdee.eas.custom.jiuzhoutong.shuiyou.TaxUnitListHandlerEx.businessAegistrationAction";
  51. Map<String, Object> returnMap = new HashMap<String, Object>();
  52. logger.error("=========进入:" + entrance + "==========");
  53. String id = request.getParameter("id");
  54. Context context = SHRContext.getInstance().getContext();
  55. Map<String, String> commonParameter = null;
  56. String postBody = "";
  57. String post = "";
  58. try {
  59. logger.error("=====获取基本信息=====");
  60. this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
  61. logger.error("=======获取报税企业信息=====");
  62. TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(context).getTaxUnitInfo(new ObjectUuidPK(id));
  63. String name = taxUnitInfo.getName();//企业名称
  64. String taxNumber = taxUnitInfo.getTaxNumber();//税号
  65. String areaCode = taxUnitInfo.getAreaCode();//行政区代码
  66. logger.error("企业名称:" + name);
  67. logger.error("税号:" + taxNumber);
  68. logger.error("行政区代码:" + areaCode);
  69. logger.error("==========================");
  70. logger.error("==========发送请求 post================");
  71. OkHttpClient client = new OkHttpClient();
  72. String ip = propt.getProperty("ip");
  73. String url = ip + "/gateway/iit/declare/getCompanyRegisterInfo";
  74. logger.error("地址:" + url);
  75. postBody = "{\"qymc\":\"" + name + "\",\"nsrsbh\":\"" + taxNumber + "\",\"areaid\":\"" + areaCode + "\"}";
  76. logger.error("参数:" + postBody);
  77. logger.error("公共参数:" + JSONObject.toJSONString(commonParameter));
  78. post = SYUtilsFacadeFactory.getLocalInstance(context).post(url, postBody);
  79. //gateway/iit/declare/getCompanyRegisterInfo
  80. // RequestBody body = RequestBody.create(MediaType.parse("application/json"), postBody);
  81. // Request sYRequest = new Request.Builder()
  82. // .url(url)
  83. // .post(body).headers(Headers.of(commonParameter))
  84. // .build();
  85. // sYResponse = client.newCall(sYRequest).execute();
  86. logger.error("返回参数:" + post);
  87. //返回值需要改 不是JSONArray 类型 需要更具 正常返回值来判断
  88. //JSONArray jsonArray = JSONArray.parseArray(post);
  89. JSONObject returnDate = JSONObject.parseObject(post);
  90. JSONObject head = returnDate.getJSONObject("head");
  91. String description = head.getString("description");
  92. RegistrationInfoInfo registrationInfo;
  93. if (!"成功".equals(description)) {
  94. returnMap.put("code", 500);
  95. returnMap.put("error", "接口调用失败,请看日志");
  96. JSONUtils.SUCCESS(returnMap);
  97. return;
  98. }
  99. JSONArray body = returnDate.getJSONArray("body");
  100. // if (body.size() > 0) {
  101. // logger.error("写入数据:"+body.toJSONString());
  102. // logger.error("删除原有的数据以便以写入行的数据");
  103. // String sql = "delete from CT_REG_RegistrationInfo";
  104. // DBUtil.execute(context, sql);
  105. // }
  106. logger.error("写入数据:");
  107. for (int i = 0; i < body.size(); i++) {
  108. JSONObject jsonObject = body.getJSONObject(i);
  109. String djxhid = jsonObject.getString("djxhid");// 登记序号
  110. RegistrationInfoCollection registrationInfoCollection = RegistrationInfoFactory.getLocalInstance(context).getRegistrationInfoCollection("where djxhid = '" + djxhid + "'");
  111. if (registrationInfoCollection.size() == 0) {
  112. registrationInfo = new RegistrationInfoInfo();
  113. } else {
  114. registrationInfo = registrationInfoCollection.get(0);
  115. }
  116. registrationInfo.setDjxhid(djxhid);
  117. String qymc = jsonObject.getString("qymc");// 企业名称
  118. registrationInfo.setQymc(qymc);
  119. String frxm = jsonObject.getString("frxm");// 法人姓名
  120. registrationInfo.setFrxm(frxm);
  121. String lxdh = jsonObject.getString("lxdh");// 联系电话
  122. registrationInfo.setLxdh(lxdh);
  123. String scjydz = jsonObject.getString("scjydz");// 生产经营地址
  124. registrationInfo.setScjydz(scjydz);
  125. String hymc = jsonObject.getString("hymc");// 行业名称
  126. registrationInfo.setHymc(hymc);
  127. String zgswjgmc = jsonObject.getString("zgswjgmc");// 主管税务机关名称
  128. registrationInfo.setZgswjgmc(zgswjgmc);
  129. String zgswjg = jsonObject.getString("zgswjg");// 主管税务机关代码
  130. registrationInfo.setZgswjg(zgswjg);
  131. String zgswjgskdm = jsonObject.getString("zgswjgskdm");// 主管税务分局所科代码
  132. registrationInfo.setZgswjgskdm(zgswjgskdm);
  133. String zgswjgskmc = jsonObject.getString("zgswjgskmc");// 主管税务分局所科名称
  134. registrationInfo.setZgswjgskmc(zgswjgskmc);
  135. String fbmba = jsonObject.getString("fbmba");// 是否分部门备案
  136. registrationInfo.setFbmba(fbmba);
  137. String smzh = jsonObject.getString("smzh");// 实名账号
  138. registrationInfo.setSmzh(smzh);
  139. String shxydm = jsonObject.getString("shxydm");// 社会信用代码
  140. registrationInfo.setShxydm(shxydm);
  141. String nsrsbm = jsonObject.getString("nsrsbm");// 纳税人识别码
  142. registrationInfo.setNsrsbm(nsrsbm);
  143. String yzbm = jsonObject.getString("yzbm");// 邮政编码
  144. registrationInfo.setYzbm(yzbm);
  145. String cwxm = jsonObject.getString("cwxm");// 财务负责人
  146. registrationInfo.setCwxm(cwxm);
  147. String hydm = jsonObject.getString("hydm");// 行业代码
  148. registrationInfo.setHydm(hydm);
  149. String jjlxdm = jsonObject.getString("jjlxdm");// 经济类型名称代码
  150. registrationInfo.setJjlxdm(jjlxdm);
  151. String jjlxmc = jsonObject.getString("jjlxmc");// 经济类型名称
  152. registrationInfo.setJjlxmc(jjlxmc);
  153. String ssglydm = jsonObject.getString("ssglydm");// 税收管理员代码
  154. registrationInfo.setSsglydm(ssglydm);
  155. String bsrxm = jsonObject.getString("bsrxm");// 报税人姓名
  156. registrationInfo.setBsrxm(bsrxm);
  157. String jdxzdm = jsonObject.getString("jdxzdm");// 街道乡镇代码
  158. registrationInfo.setJdxzdm(jdxzdm);
  159. String kjywrdm = jsonObject.getString("kjywrdm");// 扣缴义务人代码
  160. registrationInfo.setKjywrdm(kjywrdm);
  161. String djrq = jsonObject.getString("djrq");// 登记日期
  162. registrationInfo.setDjrq(djrq);
  163. String swjgdm = jsonObject.getString("swjgdm");// 税务机关代码
  164. registrationInfo.setSwjgdm(swjgdm);
  165. String swjgmc = jsonObject.getString("swjgmc");// 税务机关名称
  166. registrationInfo.setSwjgmc(swjgmc);
  167. String sfscjyqy = jsonObject.getString("sfscjyqy");// 是否是生产经营企业
  168. registrationInfo.setSfscjyqy(sfscjyqy);
  169. String nsrztdm = jsonObject.getString("nsrztdm");// 纳税人状态代码
  170. registrationInfo.setNsrztdm(nsrztdm);
  171. String nsrztmc = jsonObject.getString("nsrztmc");// 纳税人状态名称
  172. registrationInfo.setNsrztmc(nsrztmc);
  173. if (registrationInfoCollection.size() == 0) {
  174. RegistrationInfoFactory.getLocalInstance(context).save(registrationInfo);
  175. } else {
  176. RegistrationInfoFactory.getLocalInstance(context).update(new ObjectUuidPK(registrationInfo.getId()), registrationInfo);
  177. }
  178. }
  179. logger.error("记录成功接口日志");
  180. returnMap.put("code", 200);
  181. returnMap.put("error", "");
  182. returnMap.put("info", "注册成功");
  183. } catch (BOSException e) {
  184. logger.error("记录BOSException报错接口日志");
  185. returnMap.put("code", 500);
  186. returnMap.put("error", e);
  187. } catch (EASBizException e) {
  188. logger.error("记录 EASBizException 报错接口日志");
  189. returnMap.put("code", 500);
  190. returnMap.put("error", e);
  191. } catch (FileNotFoundException e) {
  192. logger.error("记录 FileNotFoundException 报错接口日志");
  193. returnMap.put("code", 500);
  194. returnMap.put("error", e);
  195. } catch (IOException e) {
  196. logger.error("记录 IOException 报错接口日志");
  197. returnMap.put("code", 500);
  198. returnMap.put("error", e);
  199. }
  200. JSONUtils.SUCCESS(returnMap);
  201. logger.error("======================退出==================================");
  202. }
  203. /**
  204. * @param request
  205. * @param response
  206. * @param modelMap
  207. * @throws SHRWebException
  208. */
  209. public void personnelReportAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
  210. logger.error("==进入到==com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx.personnelReportAction=====================");
  211. Context context = SHRContext.getInstance().getContext();
  212. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  213. Map<String,Object> returnMap = new HashMap<String,Object>();
  214. String selectedIds = request.getParameter("selectedIds");
  215. String taxPeriodDate = request.getParameter("taxPeriodDate");
  216. if (taxPeriodDate==null||"".equals(taxPeriodDate)){
  217. SimpleDateFormat taxPeriodFormat = new SimpleDateFormat("yyyyMM");
  218. taxPeriodDate=taxPeriodFormat.format(new Date());
  219. }
  220. try {
  221. this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
  222. TaxUnitCollection taxUnitCollection = TaxUnitFactory.getLocalInstance(context).getTaxUnitCollection();
  223. for (int i = 0; i < taxUnitCollection.size(); i++) {
  224. TaxUnitInfo taxUnitInfo = taxUnitCollection.get(i);
  225. String bizNo = UUID.randomUUID().toString().replace("-", "");
  226. String qymc = taxUnitInfo.getName();//企业名称
  227. String mmlx = "0";//密码类型 0表示申报密码;2表示实名账号实名密码
  228. String smzh = "";//实名账号
  229. String smmm = "";//实名密码
  230. String jmsmmm = "";//加密实名密码
  231. String sbmm = "";
  232. if (taxUnitInfo.getDeclPassword()!=null&&!"".equals(taxUnitInfo.getDeclPassword())){
  233. byte[] decode = Base64.getDecoder().decode(taxUnitInfo.getDeclPassword());
  234. sbmm = new String(decode);//;//申报密码
  235. }
  236. String jmsbmm = "";//申报密码加密
  237. String djxhid = taxUnitInfo.getRegNumber();//登记序号
  238. String nsrsbh = taxUnitInfo.getTaxNumber();//税号
  239. String areaid = taxUnitInfo.getAreaCode();//地区编码
  240. String bmbh = "";//部门编号
  241. String bmmc = "";//部门编码
  242. String skssq = taxPeriodDate;//所属期 ----还不知道怎么定这个东西
  243. String lzrqcl = "";
  244. JSONObject postBody = new JSONObject();
  245. postBody.put("bizNo",bizNo);
  246. postBody.put("qymc", qymc);
  247. postBody.put("mmlx", mmlx);
  248. postBody.put("smzh", smzh);
  249. postBody.put("smmm", smmm);
  250. postBody.put("jmsmmm", jmsmmm);
  251. postBody.put("sbmm", sbmm);
  252. postBody.put("jmsbmm", jmsbmm);
  253. postBody.put("djxhid", djxhid);
  254. postBody.put("nsrsbh", nsrsbh);
  255. postBody.put("areaid", areaid);
  256. postBody.put("bmbh", bmbh);
  257. postBody.put("bmmc", bmmc);
  258. postBody.put("skssq", skssq);
  259. postBody.put("lzrqcl", lzrqcl);
  260. BOSUuid id = taxUnitInfo.getId();
  261. //STaxPersonRecordEntry
  262. TaxPersonRecordEntryCollection taxPersonRecordEntrys = null;
  263. if (selectedIds!=null&&!selectedIds.equals("")){
  264. taxPersonRecordEntrys = TaxPersonRecordEntryFactory.getLocalInstance(context).
  265. getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "' and id in (" + selectedIds + ")");
  266. }else {
  267. taxPersonRecordEntrys = TaxPersonRecordEntryFactory.getLocalInstance(context).
  268. getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "' ");
  269. }
  270. JSONArray rylb = new JSONArray();
  271. JSONObject personInfo = null;
  272. int size = taxPersonRecordEntrys.size();
  273. if (size==0){
  274. break;
  275. }
  276. for (int j = 0; j < size; j++) {
  277. personInfo = new JSONObject();
  278. TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntrys.get(j);
  279. TaxPersonRecordInfo bill = taxPersonRecordEntryInfo.getBill();
  280. String xm = bill.getReportName();//姓名
  281. String zzlx = bill.getCardType().getAlias();//证件类型
  282. String zzhm = bill.getCardNumber();//证件号码
  283. String s = cardTypeReflection(zzlx);//证件类型
  284. Boolean cardType = isCardType(s);
  285. String qtzzlx = "";//其他证件类型
  286. String qtzzhm = "";//其他证件号码
  287. if (cardType) {
  288. qtzzlx = cardTypeReflection(bill.getOtherCardType().getAlias());//其他证件类型
  289. qtzzhm = bill.getOtherCardNumber();//其他证件号码
  290. }
  291. String bmbh1 = "";//部门编码
  292. String rybscl = "";//人员报送策略
  293. String gh = "";//工号
  294. String skssq1 = taxPeriodDate;//所属期
  295. String lxdh = bill.getPhoneNumber(); //电话
  296. String nsrzt = taxPersonRecordEntryInfo.getPersonStatus().getValue();//人员状态
  297. String sfgy = taxPersonRecordEntryInfo.getEmployedType().getAlias();//任职受雇类型
  298. String rzndjyqk = "";//入职年度就业情形
  299. String rzsgrq = "";//受雇日期
  300. if ("雇员、保险营销员、证券经纪人".indexOf(sfgy) >= 0) {
  301. Date employedDate = taxPersonRecordEntryInfo.getEmployedDate();
  302. rzsgrq = simpleDateFormat.format(employedDate);
  303. }
  304. String xb = bill.getGender().getAlias();//性别
  305. String csny = simpleDateFormat.format(bill.getBirthday());//出生日期
  306. String gj = NationalityFactory.getLocalInstance(context).getNationalityInfo(new ObjectUuidPK(bill.getNationality().getId())).getName();//国际
  307. String rydq = bill.getIsOversea().getAlias();//是否境内
  308. if (rydq.equals("否")) {
  309. rydq = "境内";
  310. } else {
  311. rydq = "境外";
  312. }
  313. String lzrq = "";//离职日期
  314. if (nsrzt.equals("0")) {
  315. lzrq = simpleDateFormat.format(taxPersonRecordEntryInfo.getDepartureDate());
  316. }
  317. BigDecimal grgbbl = bill.getInvestmentRate();//个人投资总额
  318. BigDecimal grgbze = bill.getInvestmentTotal();//个人投资比例
  319. String sfcj = bill.isIsDisability() ? "是" : "否";
  320. String cjzjlx = "";//残疾证件类型
  321. String cjzh = "";//残疾证号
  322. if ("是".equals(sfcj)) {
  323. cjzjlx = "";// 系统没有需要加
  324. cjzh = bill.getDisCardNumber();
  325. }
  326. String sfls = bill.isIsHero() ? "是" : "否";
  327. String lszh = "";
  328. if ("是".equals(sfls)) {
  329. lszh = bill.getHeroCardNumber();
  330. }
  331. String sfgl = ""; //是否孤老
  332. String sfzdw = "";//是否扣除减除费用
  333. String dzyx = "";//邮箱
  334. String xl = "";
  335. String zw = "";// 职务
  336. String khyh = "";// 开户银行
  337. String khyhsfmz = "";// 开户银行省份
  338. String yhzh = "";// 银行账号
  339. String lxdz_sheng = "";// 居住省份
  340. String lxdz_shi = "";// 居住城市
  341. String lxdz_qx = "";// 居住区县
  342. String lxdz_jd = "";// 居住街道
  343. String lxdz = "";// 居住详细地址
  344. String hjszd_sheng = "";// 户籍省份
  345. String hjszd_shi = "";// 户籍城市
  346. String hjszd_qx = "";// 户籍区县
  347. String hjszd_jd = "";// 户籍街道
  348. String hjszd_xxdz = "";// 户籍详细地址
  349. String bz = "";// 备注
  350. String csd = "";
  351. String sssx = "";
  352. if (gj.indexOf("中国") < 0) {
  353. logger.error(JSONObject.toJSONString(bill.getBirthPlace()));
  354. logger.error(bill.getBirthPlace().getId());
  355. csd = BirthplaceFactory.getLocalInstance(context).
  356. getBirthplaceInfo(new ObjectUuidPK(bill.getBirthPlace().getId())).getName();
  357. sssx = bill.getTaxReason().getAlias();
  358. }
  359. String ss = "港澳居民来往内地通行证、港澳居民居住证、台湾居民来往大陆通行证、台湾居民居住证、外国护照、外国人永久居留身份证、外国人来华工作许可证A、外国人来华工作许可证B、外国人来华工作许可证C时";
  360. String scrjsj = "";
  361. String yjljsj = "";
  362. if (ss.indexOf(s) >= 0) {
  363. scrjsj = simpleDateFormat.format(bill.getEntryDate());
  364. yjljsj = simpleDateFormat.format(bill.getLeaveDate());
  365. }
  366. String wjrlxdz_sheng = "";// 联系地省份
  367. String wjrlxdz_shi = "";// 联系地城市
  368. String wjrlxdz_qx = "";// 联系地区县
  369. String wjrlxdz_jd = "";// 联系地街道
  370. String wjrlxdz_xxdz = "";// 联系地详细地址
  371. String xmzw = "";// 中文名
  372. ss = "外国护照、外国人永久居留身份证、外国人工作许可证(A类)、外国人工作许可证(B类)、外国人工作许可证(C类)";
  373. if (ss.indexOf(s) < 0) {
  374. xmzw = bill.getChineseName();
  375. }
  376. personInfo.put("xm", xm);
  377. personInfo.put("zzlx", s);
  378. personInfo.put("zzhm", zzhm);
  379. personInfo.put("qtzzlx", qtzzlx);
  380. personInfo.put("qtzzhm", qtzzhm);
  381. personInfo.put("bmbh", bmbh1);
  382. personInfo.put("rybscl", rybscl);
  383. personInfo.put("gh", gh);
  384. personInfo.put("skssq", skssq1);
  385. personInfo.put("lxdh", lxdh);
  386. if (nsrzt.equals("1")){
  387. nsrzt="正常";
  388. }else{
  389. nsrzt = "非正常";
  390. }
  391. personInfo.put("nsrzt", nsrzt);
  392. personInfo.put("sfgy", sfgy);
  393. personInfo.put("rzndjyqk", rzndjyqk);
  394. personInfo.put("rzsgrq", rzsgrq);
  395. personInfo.put("xb", xb);
  396. personInfo.put("csny", csny);
  397. personInfo.put("gj", gj);
  398. personInfo.put("rydq", rydq);
  399. personInfo.put("lzrq", lzrq);
  400. personInfo.put("grgbbl", grgbbl);
  401. personInfo.put("grgbze", grgbze);
  402. personInfo.put("sfcj", sfcj);
  403. personInfo.put("cjzjlx", cjzjlx);
  404. personInfo.put("cjzh", cjzh);
  405. personInfo.put("sfls", sfls);
  406. personInfo.put("lszh", lszh);
  407. personInfo.put("sfgl", sfgl);
  408. personInfo.put("sfzdw", sfzdw);
  409. personInfo.put("dzyx", dzyx);
  410. personInfo.put("xl", xl);
  411. personInfo.put("zw", zw);
  412. personInfo.put("khyh", khyh);
  413. personInfo.put("khyhsfmz", khyhsfmz);
  414. personInfo.put("yhzh", yhzh);
  415. personInfo.put("lxdz_sheng", lxdz_sheng);
  416. personInfo.put("lxdz_shi", lxdz_shi);
  417. personInfo.put("lxdz_qx", lxdz_qx);
  418. personInfo.put("lxdz_jd", lxdz_jd);
  419. personInfo.put("lxdz", lxdz);
  420. personInfo.put("hjszd_sheng", hjszd_sheng);
  421. personInfo.put("hjszd_shi", hjszd_shi);
  422. personInfo.put("hjszd_qx", hjszd_qx);
  423. personInfo.put("hjszd_jd", hjszd_jd);
  424. personInfo.put("hjszd_xxdz", hjszd_xxdz);
  425. personInfo.put("bz", bz);
  426. personInfo.put("csd", csd);
  427. personInfo.put("sssx", sssx);
  428. personInfo.put("scrjsj", scrjsj);
  429. personInfo.put("yjljsj", yjljsj);
  430. personInfo.put("wjrlxdz_sheng", wjrlxdz_sheng);
  431. personInfo.put("wjrlxdz_shi", wjrlxdz_shi);
  432. personInfo.put("wjrlxdz_qx", wjrlxdz_qx);
  433. personInfo.put("wjrlxdz_jd", wjrlxdz_jd);
  434. personInfo.put("wjrlxdz_xxdz", wjrlxdz_xxdz);
  435. personInfo.put("xmzw", xmzw);
  436. rylb.add(personInfo);
  437. }
  438. postBody.put("rylb", rylb);
  439. String ip = propt.getProperty("ip");
  440. String url = ip + "/gateway/iit/declare/declareEmployeeInfo";
  441. logger.error("===请求参数=="+postBody+"========");
  442. ISYUtilsFacade localInstance = SYUtilsFacadeFactory.getLocalInstance(context);
  443. String post = localInstance.post(url, postBody.toJSONString());
  444. System.out.println(post);
  445. JSONObject postJSON = JSONObject.parseObject(post);
  446. //校验 请求是否成功
  447. JSONObject head = postJSON.getJSONObject("head");
  448. if (head.getString("status").equals("N")){
  449. returnMap.put("code",500);
  450. returnMap.put("error","请求失败");
  451. JSONUtils.SUCCESS(returnMap);
  452. return;
  453. }
  454. JSONObject body = postJSON.getJSONObject("body");
  455. String string = body.getString("requestId");
  456. url = ip+"/gateway/iit/declare/getEmployeeInfoFeedback";
  457. String s = localInstance.backTask(url, string, "personnelReportService", null, TaskCatalogEnum.PERSON);
  458. logger.error("返回参数:"+post);
  459. logger.error("返回参数:"+s);
  460. returnMap.put("code",200);
  461. returnMap.put("info","报送成功");
  462. JSONUtils.SUCCESS(returnMap);
  463. }
  464. } catch (BOSException e) {
  465. JSONUtils.ERROR("BOSException",e);
  466. throw new RuntimeException(e);
  467. } catch (FileNotFoundException e) {
  468. JSONUtils.ERROR("FileNotFoundException",e);
  469. throw new RuntimeException(e);
  470. } catch (IOException e) {
  471. JSONUtils.ERROR("IOException",e);
  472. throw new RuntimeException(e);
  473. } catch (EASBizException e) {
  474. JSONUtils.ERROR("EASBizException",e);
  475. throw new RuntimeException(e);
  476. }
  477. }
  478. /**
  479. * 养老金下载
  480. * @param request
  481. * @param response
  482. * @param modelMap
  483. * @throws SHRWebException
  484. */
  485. public void pensionInfoAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
  486. logger.error("==进入到==com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx.personnelReportAction=====================");
  487. Context context = SHRContext.getInstance().getContext();
  488. SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
  489. SimpleDateFormat skssqFormat = new SimpleDateFormat("yyyyMM");
  490. Map<String,Object> returnMap = new HashMap<String,Object>();
  491. try {
  492. this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
  493. TaxUnitCollection taxUnitCollection = TaxUnitFactory.getLocalInstance(context).getTaxUnitCollection();
  494. for (int i = 0; i < taxUnitCollection.size(); i++) {
  495. TaxUnitInfo taxUnitInfo = taxUnitCollection.get(i);
  496. String bizNo = UUID.randomUUID().toString().replace("-", "");
  497. String qymc = taxUnitInfo.getName();//企业名称
  498. String mmlx = "0";//密码类型 0表示申报密码;2表示实名账号实名密码
  499. String smzh = "";//实名账号
  500. String smmm = "";//实名密码
  501. String jmsmmm = "";//加密实名密码
  502. byte[] decode = Base64.getDecoder().decode(taxUnitInfo.getDeclPassword());
  503. String sbmm = new String(decode);//;//申报密码
  504. String jmsbmm = "";//申报密码加密
  505. String djxhid = taxUnitInfo.getRegNumber();//登记序号
  506. String nsrsbh = taxUnitInfo.getTaxNumber();//税号
  507. String areaid = taxUnitInfo.getAreaCode();//地区编码
  508. String bmbh = "";//部门编号
  509. String bmmc = "";//部门编码
  510. Integer year = new Date().getYear();
  511. String skssq = skssqFormat.format(new Date());
  512. String lzrqcl = "";
  513. JSONObject postBody = new JSONObject();
  514. postBody.put("bizNo",bizNo);
  515. postBody.put("qymc", qymc);
  516. postBody.put("mmlx", mmlx);
  517. postBody.put("smzh", smzh);
  518. postBody.put("smmm", smmm);
  519. postBody.put("jmsmmm", jmsmmm);
  520. postBody.put("sbmm", sbmm);
  521. postBody.put("jmsbmm", jmsbmm);
  522. postBody.put("djxhid", djxhid);
  523. postBody.put("nsrsbh", nsrsbh);
  524. postBody.put("areaid", areaid);
  525. postBody.put("bmbh", bmbh);
  526. postBody.put("bmmc", bmmc);
  527. postBody.put("year", year);
  528. postBody.put("skssq",skssq);
  529. postBody.put("lzrqcl", lzrqcl);
  530. BOSUuid id = taxUnitInfo.getId();
  531. //STaxPersonRecordEntry
  532. TaxPersonRecordEntryCollection taxPersonRecordEntrys =
  533. TaxPersonRecordEntryFactory.getLocalInstance(context).
  534. getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "'");
  535. JSONArray rylb = new JSONArray();
  536. JSONObject personInfo = null;
  537. int size = taxPersonRecordEntrys.size();
  538. if (size==0){
  539. break;
  540. }
  541. for (int j = 0; j < size; j++) {
  542. personInfo = new JSONObject();
  543. TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntrys.get(j);
  544. TaxPersonRecordInfo bill = taxPersonRecordEntryInfo.getBill();
  545. String xm = PersonFactory.getLocalInstance(context).getPersonInfo(new ObjectUuidPK(bill.getPerson().getId())).getName();//姓名
  546. String zzlx = bill.getCardType().getAlias();//证件类型
  547. String zzhm = bill.getCardNumber();//证件号码
  548. String s = cardTypeReflection(zzlx);//证件类型
  549. personInfo.put("xm",xm);
  550. personInfo.put("zzlx",s );
  551. personInfo.put("zzhm",zzhm);
  552. rylb.add(personInfo);
  553. }
  554. postBody.put("rylb", rylb);
  555. String ip = propt.getProperty("ip");
  556. String url = ip + "/gateway/iit/personalPension/download";
  557. logger.error("===请求参数=="+postBody+"========");
  558. ISYUtilsFacade localInstance = SYUtilsFacadeFactory.getLocalInstance(context);
  559. String post = localInstance.post(url, postBody.toJSONString());
  560. JSONObject postJSON = JSONObject.parseObject(post);
  561. //校验 请求是否成功
  562. JSONObject head = postJSON.getJSONObject("head");
  563. if (head.getString("status").equals("N")){
  564. returnMap.put("code",500);
  565. returnMap.put("error","请求失败");
  566. JSONUtils.SUCCESS(returnMap);
  567. return;
  568. }
  569. JSONObject body = postJSON.getJSONObject("body");
  570. String string = body.getString("requestId");
  571. url = ip+"/gateway/iit/personalPension/getDownloadFeedback";
  572. String s = localInstance.backTask(url, string, "", null, TaskCatalogEnum.PERSON);
  573. logger.error("返回参数:"+post);
  574. returnMap.put("code",200);
  575. returnMap.put("info","下载中");
  576. JSONUtils.SUCCESS(returnMap);
  577. }
  578. } catch (BOSException e) {
  579. JSONUtils.ERROR("BOSException",e);
  580. throw new RuntimeException(e);
  581. } catch (FileNotFoundException e) {
  582. JSONUtils.ERROR("FileNotFoundException",e);
  583. throw new RuntimeException(e);
  584. } catch (IOException e) {
  585. JSONUtils.ERROR("IOException",e);
  586. throw new RuntimeException(e);
  587. } catch (EASBizException e) {
  588. JSONUtils.ERROR("EASBizException",e);
  589. throw new RuntimeException(e);
  590. }
  591. }
  592. public static void main(String[] args) {
  593. String encode = Base64Utils.encode("asdasd");
  594. System.out.println(encode);
  595. }
  596. public String cardTypeReflection(String cardTypeName) {
  597. switch (cardTypeName) {
  598. case "居民身份证":
  599. return "居民身份证";
  600. case "中国护照":
  601. return "中国护照";
  602. case "港澳居民来往内地通行证":
  603. return "港澳居民来往内地通行证";
  604. case "中华人民共和国港澳居民居住证":
  605. return "港澳居民来往内地通行证";
  606. case "台湾居民来往大陆通行证":
  607. return "台湾居民来往大陆通行证";
  608. case "中华人民共和国台湾居民居住证":
  609. return "台湾居民居住证";
  610. case "外国护照":
  611. return "外国护照";
  612. case "外国人永久居留身份证":
  613. return "外国人永久居留身份证";
  614. case "中华人民共和国外国人工作许可证(A类)":
  615. return "外国人工作许可证(A类)";
  616. case "中华人民共和国外国人工作许可证(B类)":
  617. return "外国人工作许可证(B类)";
  618. case "中华人民共和国外国人工作许可证(C类)":
  619. return "外国人工作许可证(C类)";
  620. }
  621. return "";
  622. }
  623. public Boolean isCardType(String cardType) {
  624. String cardTypes = "港澳居民居住证,台湾居民居住证,外国人永久居留身份证,外国人工作许可证(A类),外国人工作许可证(B类),外国人工作许可证(C类)";
  625. if (cardTypes.indexOf(cardType) >= 0) {
  626. return true;
  627. } else {
  628. return false;
  629. }
  630. }
  631. }