123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680 |
- package com.kingdee.eas.custom.shuiyou;
- import com.alibaba.fastjson.JSONArray;
- import com.alibaba.fastjson.JSONObject;
- import com.kingdee.bos.BOSException;
- import com.kingdee.bos.Context;
- import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
- import com.kingdee.bos.util.BOSUuid;
- import com.kingdee.eas.basedata.hraux.BirthplaceFactory;
- import com.kingdee.eas.basedata.hraux.NationalityFactory;
- import com.kingdee.eas.basedata.person.PersonFactory;
- import com.kingdee.eas.common.EASBizException;
- import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoCollection;
- import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoFactory;
- import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoInfo;
- import com.kingdee.eas.custom.shuiyou.task.TaskCatalogEnum;
- import com.kingdee.eas.custom.shuiyou.uitls.ISYUtilsFacade;
- import com.kingdee.eas.custom.shuiyou.uitls.SYUtilsFacadeFactory;
- import com.kingdee.shr.base.syssetting.context.SHRContext;
- import com.kingdee.shr.base.syssetting.exception.SHRWebException;
- import com.kingdee.shr.base.syssetting.web.json.JSONUtils;
- import com.kingdee.shr.compensation.app.incomeTax.*;
- import com.kingdee.shr.compensation.app.tax.TaxUnitCollection;
- import com.kingdee.shr.compensation.app.tax.TaxUnitFactory;
- import com.kingdee.shr.compensation.app.tax.TaxUnitInfo;
- import com.kingdee.shr.compensation.util.Base64Utils;
- import com.kingdee.shr.compensation.web.handler.tax.taxUnit.TaxUnitListHandler;
- import okhttp3.*;
- import org.apache.log4j.Logger;
- import org.springframework.ui.ModelMap;
- import javax.servlet.http.HttpServletRequest;
- import javax.servlet.http.HttpServletResponse;
- import java.io.FileInputStream;
- import java.io.FileNotFoundException;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.text.SimpleDateFormat;
- import java.util.*;
- public class TaxUnitListHandlerEx extends TaxUnitListHandler {
- private Properties propt = new Properties();
- private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx");
- /**
- * 企业注册
- *
- * @param request
- * @param response
- * @param modelMap
- * @throws SHRWebException
- */
- public void businessAegistrationAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
- String entrance = "com.kingdee.eas.custom.jiuzhoutong.shuiyou.TaxUnitListHandlerEx.businessAegistrationAction";
- Map<String, Object> returnMap = new HashMap<String, Object>();
- logger.error("=========进入:" + entrance + "==========");
- String id = request.getParameter("id");
- Context context = SHRContext.getInstance().getContext();
- Map<String, String> commonParameter = null;
- String postBody = "";
- String post = "";
- try {
- logger.error("=====获取基本信息=====");
- this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
- logger.error("=======获取报税企业信息=====");
- TaxUnitInfo taxUnitInfo = TaxUnitFactory.getLocalInstance(context).getTaxUnitInfo(new ObjectUuidPK(id));
- String name = taxUnitInfo.getName();//企业名称
- String taxNumber = taxUnitInfo.getTaxNumber();//税号
- String areaCode = taxUnitInfo.getAreaCode();//行政区代码
- logger.error("企业名称:" + name);
- logger.error("税号:" + taxNumber);
- logger.error("行政区代码:" + areaCode);
- logger.error("==========================");
- logger.error("==========发送请求 post================");
- OkHttpClient client = new OkHttpClient();
- String ip = propt.getProperty("ip");
- String url = ip + "/gateway/iit/declare/getCompanyRegisterInfo";
- logger.error("地址:" + url);
- postBody = "{\"qymc\":\"" + name + "\",\"nsrsbh\":\"" + taxNumber + "\",\"areaid\":\"" + areaCode + "\"}";
- logger.error("参数:" + postBody);
- logger.error("公共参数:" + JSONObject.toJSONString(commonParameter));
- post = SYUtilsFacadeFactory.getLocalInstance(context).post(url, postBody);
- //gateway/iit/declare/getCompanyRegisterInfo
- // RequestBody body = RequestBody.create(MediaType.parse("application/json"), postBody);
- // Request sYRequest = new Request.Builder()
- // .url(url)
- // .post(body).headers(Headers.of(commonParameter))
- // .build();
- // sYResponse = client.newCall(sYRequest).execute();
- logger.error("返回参数:" + post);
- //返回值需要改 不是JSONArray 类型 需要更具 正常返回值来判断
- //JSONArray jsonArray = JSONArray.parseArray(post);
- JSONObject returnDate = JSONObject.parseObject(post);
- JSONObject head = returnDate.getJSONObject("head");
- String description = head.getString("description");
- RegistrationInfoInfo registrationInfo;
- if (!"成功".equals(description)) {
- returnMap.put("code", 500);
- returnMap.put("error", "接口调用失败,请看日志");
- JSONUtils.SUCCESS(returnMap);
- return;
- }
- JSONArray body = returnDate.getJSONArray("body");
- // if (body.size() > 0) {
- // logger.error("写入数据:"+body.toJSONString());
- // logger.error("删除原有的数据以便以写入行的数据");
- // String sql = "delete from CT_REG_RegistrationInfo";
- // DBUtil.execute(context, sql);
- // }
- logger.error("写入数据:");
- for (int i = 0; i < body.size(); i++) {
- JSONObject jsonObject = body.getJSONObject(i);
- String djxhid = jsonObject.getString("djxhid");// 登记序号
- RegistrationInfoCollection registrationInfoCollection = RegistrationInfoFactory.getLocalInstance(context).getRegistrationInfoCollection("where djxhid = '" + djxhid + "'");
- if (registrationInfoCollection.size() == 0) {
- registrationInfo = new RegistrationInfoInfo();
- } else {
- registrationInfo = registrationInfoCollection.get(0);
- }
- registrationInfo.setDjxhid(djxhid);
- String qymc = jsonObject.getString("qymc");// 企业名称
- registrationInfo.setQymc(qymc);
- String frxm = jsonObject.getString("frxm");// 法人姓名
- registrationInfo.setFrxm(frxm);
- String lxdh = jsonObject.getString("lxdh");// 联系电话
- registrationInfo.setLxdh(lxdh);
- String scjydz = jsonObject.getString("scjydz");// 生产经营地址
- registrationInfo.setScjydz(scjydz);
- String hymc = jsonObject.getString("hymc");// 行业名称
- registrationInfo.setHymc(hymc);
- String zgswjgmc = jsonObject.getString("zgswjgmc");// 主管税务机关名称
- registrationInfo.setZgswjgmc(zgswjgmc);
- String zgswjg = jsonObject.getString("zgswjg");// 主管税务机关代码
- registrationInfo.setZgswjg(zgswjg);
- String zgswjgskdm = jsonObject.getString("zgswjgskdm");// 主管税务分局所科代码
- registrationInfo.setZgswjgskdm(zgswjgskdm);
- String zgswjgskmc = jsonObject.getString("zgswjgskmc");// 主管税务分局所科名称
- registrationInfo.setZgswjgskmc(zgswjgskmc);
- String fbmba = jsonObject.getString("fbmba");// 是否分部门备案
- registrationInfo.setFbmba(fbmba);
- String smzh = jsonObject.getString("smzh");// 实名账号
- registrationInfo.setSmzh(smzh);
- String shxydm = jsonObject.getString("shxydm");// 社会信用代码
- registrationInfo.setShxydm(shxydm);
- String nsrsbm = jsonObject.getString("nsrsbm");// 纳税人识别码
- registrationInfo.setNsrsbm(nsrsbm);
- String yzbm = jsonObject.getString("yzbm");// 邮政编码
- registrationInfo.setYzbm(yzbm);
- String cwxm = jsonObject.getString("cwxm");// 财务负责人
- registrationInfo.setCwxm(cwxm);
- String hydm = jsonObject.getString("hydm");// 行业代码
- registrationInfo.setHydm(hydm);
- String jjlxdm = jsonObject.getString("jjlxdm");// 经济类型名称代码
- registrationInfo.setJjlxdm(jjlxdm);
- String jjlxmc = jsonObject.getString("jjlxmc");// 经济类型名称
- registrationInfo.setJjlxmc(jjlxmc);
- String ssglydm = jsonObject.getString("ssglydm");// 税收管理员代码
- registrationInfo.setSsglydm(ssglydm);
- String bsrxm = jsonObject.getString("bsrxm");// 报税人姓名
- registrationInfo.setBsrxm(bsrxm);
- String jdxzdm = jsonObject.getString("jdxzdm");// 街道乡镇代码
- registrationInfo.setJdxzdm(jdxzdm);
- String kjywrdm = jsonObject.getString("kjywrdm");// 扣缴义务人代码
- registrationInfo.setKjywrdm(kjywrdm);
- String djrq = jsonObject.getString("djrq");// 登记日期
- registrationInfo.setDjrq(djrq);
- String swjgdm = jsonObject.getString("swjgdm");// 税务机关代码
- registrationInfo.setSwjgdm(swjgdm);
- String swjgmc = jsonObject.getString("swjgmc");// 税务机关名称
- registrationInfo.setSwjgmc(swjgmc);
- String sfscjyqy = jsonObject.getString("sfscjyqy");// 是否是生产经营企业
- registrationInfo.setSfscjyqy(sfscjyqy);
- String nsrztdm = jsonObject.getString("nsrztdm");// 纳税人状态代码
- registrationInfo.setNsrztdm(nsrztdm);
- String nsrztmc = jsonObject.getString("nsrztmc");// 纳税人状态名称
- registrationInfo.setNsrztmc(nsrztmc);
- if (registrationInfoCollection.size() == 0) {
- RegistrationInfoFactory.getLocalInstance(context).save(registrationInfo);
- } else {
- RegistrationInfoFactory.getLocalInstance(context).update(new ObjectUuidPK(registrationInfo.getId()), registrationInfo);
- }
- }
- logger.error("记录成功接口日志");
- returnMap.put("code", 200);
- returnMap.put("error", "");
- returnMap.put("info", "注册成功");
- } catch (BOSException e) {
- logger.error("记录BOSException报错接口日志");
- returnMap.put("code", 500);
- returnMap.put("error", e);
- } catch (EASBizException e) {
- logger.error("记录 EASBizException 报错接口日志");
- returnMap.put("code", 500);
- returnMap.put("error", e);
- } catch (FileNotFoundException e) {
- logger.error("记录 FileNotFoundException 报错接口日志");
- returnMap.put("code", 500);
- returnMap.put("error", e);
- } catch (IOException e) {
- logger.error("记录 IOException 报错接口日志");
- returnMap.put("code", 500);
- returnMap.put("error", e);
- }
- JSONUtils.SUCCESS(returnMap);
- logger.error("======================退出==================================");
- }
- /**
- * @param request
- * @param response
- * @param modelMap
- * @throws SHRWebException
- */
- public void personnelReportAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
- logger.error("==进入到==com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx.personnelReportAction=====================");
- Context context = SHRContext.getInstance().getContext();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
- Map<String,Object> returnMap = new HashMap<String,Object>();
- String selectedIds = request.getParameter("selectedIds");
- String taxPeriodDate = request.getParameter("taxPeriodDate");
- if (taxPeriodDate==null||"".equals(taxPeriodDate)){
- SimpleDateFormat taxPeriodFormat = new SimpleDateFormat("yyyyMM");
- taxPeriodDate=taxPeriodFormat.format(new Date());
- }
- try {
- this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
- TaxUnitCollection taxUnitCollection = TaxUnitFactory.getLocalInstance(context).getTaxUnitCollection();
- for (int i = 0; i < taxUnitCollection.size(); i++) {
- TaxUnitInfo taxUnitInfo = taxUnitCollection.get(i);
- String bizNo = UUID.randomUUID().toString().replace("-", "");
- String qymc = taxUnitInfo.getName();//企业名称
- String mmlx = "0";//密码类型 0表示申报密码;2表示实名账号实名密码
- String smzh = "";//实名账号
- String smmm = "";//实名密码
- String jmsmmm = "";//加密实名密码
- String sbmm = "";
- if (taxUnitInfo.getDeclPassword()!=null&&!"".equals(taxUnitInfo.getDeclPassword())){
- byte[] decode = Base64.getDecoder().decode(taxUnitInfo.getDeclPassword());
- sbmm = new String(decode);//;//申报密码
- }
- String jmsbmm = "";//申报密码加密
- String djxhid = taxUnitInfo.getRegNumber();//登记序号
- String nsrsbh = taxUnitInfo.getTaxNumber();//税号
- String areaid = taxUnitInfo.getAreaCode();//地区编码
- String bmbh = "";//部门编号
- String bmmc = "";//部门编码
- String skssq = taxPeriodDate;//所属期 ----还不知道怎么定这个东西
- String lzrqcl = "";
- JSONObject postBody = new JSONObject();
- postBody.put("bizNo",bizNo);
- postBody.put("qymc", qymc);
- postBody.put("mmlx", mmlx);
- postBody.put("smzh", smzh);
- postBody.put("smmm", smmm);
- postBody.put("jmsmmm", jmsmmm);
- postBody.put("sbmm", sbmm);
- postBody.put("jmsbmm", jmsbmm);
- postBody.put("djxhid", djxhid);
- postBody.put("nsrsbh", nsrsbh);
- postBody.put("areaid", areaid);
- postBody.put("bmbh", bmbh);
- postBody.put("bmmc", bmmc);
- postBody.put("skssq", skssq);
- postBody.put("lzrqcl", lzrqcl);
- BOSUuid id = taxUnitInfo.getId();
- //STaxPersonRecordEntry
- TaxPersonRecordEntryCollection taxPersonRecordEntrys = null;
- if (selectedIds!=null&&!selectedIds.equals("")){
- taxPersonRecordEntrys = TaxPersonRecordEntryFactory.getLocalInstance(context).
- getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "' and id in (" + selectedIds + ")");
- }else {
- taxPersonRecordEntrys = TaxPersonRecordEntryFactory.getLocalInstance(context).
- getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "' ");
- }
- JSONArray rylb = new JSONArray();
- JSONObject personInfo = null;
- int size = taxPersonRecordEntrys.size();
- if (size==0){
- break;
- }
- for (int j = 0; j < size; j++) {
- personInfo = new JSONObject();
- TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntrys.get(j);
- TaxPersonRecordInfo bill = taxPersonRecordEntryInfo.getBill();
- String xm = bill.getReportName();//姓名
- String zzlx = bill.getCardType().getAlias();//证件类型
- String zzhm = bill.getCardNumber();//证件号码
- String s = cardTypeReflection(zzlx);//证件类型
- Boolean cardType = isCardType(s);
- String qtzzlx = "";//其他证件类型
- String qtzzhm = "";//其他证件号码
- if (cardType) {
- qtzzlx = cardTypeReflection(bill.getOtherCardType().getAlias());//其他证件类型
- qtzzhm = bill.getOtherCardNumber();//其他证件号码
- }
- String bmbh1 = "";//部门编码
- String rybscl = "";//人员报送策略
- String gh = "";//工号
- String skssq1 = taxPeriodDate;//所属期
- String lxdh = bill.getPhoneNumber(); //电话
- String nsrzt = taxPersonRecordEntryInfo.getPersonStatus().getValue();//人员状态
- String sfgy = taxPersonRecordEntryInfo.getEmployedType().getAlias();//任职受雇类型
- String rzndjyqk = "";//入职年度就业情形
- String rzsgrq = "";//受雇日期
- if ("雇员、保险营销员、证券经纪人".indexOf(sfgy) >= 0) {
- Date employedDate = taxPersonRecordEntryInfo.getEmployedDate();
- rzsgrq = simpleDateFormat.format(employedDate);
- }
- String xb = bill.getGender().getAlias();//性别
- String csny = simpleDateFormat.format(bill.getBirthday());//出生日期
- String gj = NationalityFactory.getLocalInstance(context).getNationalityInfo(new ObjectUuidPK(bill.getNationality().getId())).getName();//国际
- String rydq = bill.getIsOversea().getAlias();//是否境内
- if (rydq.equals("否")) {
- rydq = "境内";
- } else {
- rydq = "境外";
- }
- String lzrq = "";//离职日期
- if (nsrzt.equals("0")) {
- lzrq = simpleDateFormat.format(taxPersonRecordEntryInfo.getDepartureDate());
- }
- BigDecimal grgbbl = bill.getInvestmentRate();//个人投资总额
- BigDecimal grgbze = bill.getInvestmentTotal();//个人投资比例
- String sfcj = bill.isIsDisability() ? "是" : "否";
- String cjzjlx = "";//残疾证件类型
- String cjzh = "";//残疾证号
- if ("是".equals(sfcj)) {
- cjzjlx = "";// 系统没有需要加
- cjzh = bill.getDisCardNumber();
- }
- String sfls = bill.isIsHero() ? "是" : "否";
- String lszh = "";
- if ("是".equals(sfls)) {
- lszh = bill.getHeroCardNumber();
- }
- String sfgl = ""; //是否孤老
- String sfzdw = "";//是否扣除减除费用
- String dzyx = "";//邮箱
- String xl = "";
- String zw = "";// 职务
- String khyh = "";// 开户银行
- String khyhsfmz = "";// 开户银行省份
- String yhzh = "";// 银行账号
- String lxdz_sheng = "";// 居住省份
- String lxdz_shi = "";// 居住城市
- String lxdz_qx = "";// 居住区县
- String lxdz_jd = "";// 居住街道
- String lxdz = "";// 居住详细地址
- String hjszd_sheng = "";// 户籍省份
- String hjszd_shi = "";// 户籍城市
- String hjszd_qx = "";// 户籍区县
- String hjszd_jd = "";// 户籍街道
- String hjszd_xxdz = "";// 户籍详细地址
- String bz = "";// 备注
- String csd = "";
- String sssx = "";
- if (gj.indexOf("中国") < 0) {
- logger.error(JSONObject.toJSONString(bill.getBirthPlace()));
- logger.error(bill.getBirthPlace().getId());
- csd = BirthplaceFactory.getLocalInstance(context).
- getBirthplaceInfo(new ObjectUuidPK(bill.getBirthPlace().getId())).getName();
- sssx = bill.getTaxReason().getAlias();
- }
- String ss = "港澳居民来往内地通行证、港澳居民居住证、台湾居民来往大陆通行证、台湾居民居住证、外国护照、外国人永久居留身份证、外国人来华工作许可证A、外国人来华工作许可证B、外国人来华工作许可证C时";
- String scrjsj = "";
- String yjljsj = "";
- if (ss.indexOf(s) >= 0) {
- scrjsj = simpleDateFormat.format(bill.getEntryDate());
- yjljsj = simpleDateFormat.format(bill.getLeaveDate());
- }
- String wjrlxdz_sheng = "";// 联系地省份
- String wjrlxdz_shi = "";// 联系地城市
- String wjrlxdz_qx = "";// 联系地区县
- String wjrlxdz_jd = "";// 联系地街道
- String wjrlxdz_xxdz = "";// 联系地详细地址
- String xmzw = "";// 中文名
- ss = "外国护照、外国人永久居留身份证、外国人工作许可证(A类)、外国人工作许可证(B类)、外国人工作许可证(C类)";
- if (ss.indexOf(s) < 0) {
- xmzw = bill.getChineseName();
- }
- personInfo.put("xm", xm);
- personInfo.put("zzlx", s);
- personInfo.put("zzhm", zzhm);
- personInfo.put("qtzzlx", qtzzlx);
- personInfo.put("qtzzhm", qtzzhm);
- personInfo.put("bmbh", bmbh1);
- personInfo.put("rybscl", rybscl);
- personInfo.put("gh", gh);
- personInfo.put("skssq", skssq1);
- personInfo.put("lxdh", lxdh);
- if (nsrzt.equals("1")){
- nsrzt="正常";
- }else{
- nsrzt = "非正常";
- }
- personInfo.put("nsrzt", nsrzt);
- personInfo.put("sfgy", sfgy);
- personInfo.put("rzndjyqk", rzndjyqk);
- personInfo.put("rzsgrq", rzsgrq);
- personInfo.put("xb", xb);
- personInfo.put("csny", csny);
- personInfo.put("gj", gj);
- personInfo.put("rydq", rydq);
- personInfo.put("lzrq", lzrq);
- personInfo.put("grgbbl", grgbbl);
- personInfo.put("grgbze", grgbze);
- personInfo.put("sfcj", sfcj);
- personInfo.put("cjzjlx", cjzjlx);
- personInfo.put("cjzh", cjzh);
- personInfo.put("sfls", sfls);
- personInfo.put("lszh", lszh);
- personInfo.put("sfgl", sfgl);
- personInfo.put("sfzdw", sfzdw);
- personInfo.put("dzyx", dzyx);
- personInfo.put("xl", xl);
- personInfo.put("zw", zw);
- personInfo.put("khyh", khyh);
- personInfo.put("khyhsfmz", khyhsfmz);
- personInfo.put("yhzh", yhzh);
- personInfo.put("lxdz_sheng", lxdz_sheng);
- personInfo.put("lxdz_shi", lxdz_shi);
- personInfo.put("lxdz_qx", lxdz_qx);
- personInfo.put("lxdz_jd", lxdz_jd);
- personInfo.put("lxdz", lxdz);
- personInfo.put("hjszd_sheng", hjszd_sheng);
- personInfo.put("hjszd_shi", hjszd_shi);
- personInfo.put("hjszd_qx", hjszd_qx);
- personInfo.put("hjszd_jd", hjszd_jd);
- personInfo.put("hjszd_xxdz", hjszd_xxdz);
- personInfo.put("bz", bz);
- personInfo.put("csd", csd);
- personInfo.put("sssx", sssx);
- personInfo.put("scrjsj", scrjsj);
- personInfo.put("yjljsj", yjljsj);
- personInfo.put("wjrlxdz_sheng", wjrlxdz_sheng);
- personInfo.put("wjrlxdz_shi", wjrlxdz_shi);
- personInfo.put("wjrlxdz_qx", wjrlxdz_qx);
- personInfo.put("wjrlxdz_jd", wjrlxdz_jd);
- personInfo.put("wjrlxdz_xxdz", wjrlxdz_xxdz);
- personInfo.put("xmzw", xmzw);
- rylb.add(personInfo);
- }
- postBody.put("rylb", rylb);
- String ip = propt.getProperty("ip");
- String url = ip + "/gateway/iit/declare/declareEmployeeInfo";
- logger.error("===请求参数=="+postBody+"========");
- ISYUtilsFacade localInstance = SYUtilsFacadeFactory.getLocalInstance(context);
- String post = localInstance.post(url, postBody.toJSONString());
- System.out.println(post);
- JSONObject postJSON = JSONObject.parseObject(post);
- //校验 请求是否成功
- JSONObject head = postJSON.getJSONObject("head");
- if (head.getString("status").equals("N")){
- returnMap.put("code",500);
- returnMap.put("error","请求失败");
- JSONUtils.SUCCESS(returnMap);
- return;
- }
- JSONObject body = postJSON.getJSONObject("body");
- String string = body.getString("requestId");
- url = ip+"/gateway/iit/declare/getEmployeeInfoFeedback";
- String s = localInstance.backTask(url, string, "personnelReportService", null, TaskCatalogEnum.PERSON);
- logger.error("返回参数:"+post);
- logger.error("返回参数:"+s);
- returnMap.put("code",200);
- returnMap.put("info","报送成功");
- JSONUtils.SUCCESS(returnMap);
- }
- } catch (BOSException e) {
- JSONUtils.ERROR("BOSException",e);
- throw new RuntimeException(e);
- } catch (FileNotFoundException e) {
- JSONUtils.ERROR("FileNotFoundException",e);
- throw new RuntimeException(e);
- } catch (IOException e) {
- JSONUtils.ERROR("IOException",e);
- throw new RuntimeException(e);
- } catch (EASBizException e) {
- JSONUtils.ERROR("EASBizException",e);
- throw new RuntimeException(e);
- }
- }
- /**
- * 养老金下载
- * @param request
- * @param response
- * @param modelMap
- * @throws SHRWebException
- */
- public void pensionInfoAction(HttpServletRequest request, HttpServletResponse response, ModelMap modelMap) throws SHRWebException {
- logger.error("==进入到==com.kingdee.eas.custom.shuiyou.TaxUnitListHandlerEx.personnelReportAction=====================");
- Context context = SHRContext.getInstance().getContext();
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
- SimpleDateFormat skssqFormat = new SimpleDateFormat("yyyyMM");
- Map<String,Object> returnMap = new HashMap<String,Object>();
- try {
- this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
- TaxUnitCollection taxUnitCollection = TaxUnitFactory.getLocalInstance(context).getTaxUnitCollection();
- for (int i = 0; i < taxUnitCollection.size(); i++) {
- TaxUnitInfo taxUnitInfo = taxUnitCollection.get(i);
- String bizNo = UUID.randomUUID().toString().replace("-", "");
- String qymc = taxUnitInfo.getName();//企业名称
- String mmlx = "0";//密码类型 0表示申报密码;2表示实名账号实名密码
- String smzh = "";//实名账号
- String smmm = "";//实名密码
- String jmsmmm = "";//加密实名密码
- byte[] decode = Base64.getDecoder().decode(taxUnitInfo.getDeclPassword());
- String sbmm = new String(decode);//;//申报密码
- String jmsbmm = "";//申报密码加密
- String djxhid = taxUnitInfo.getRegNumber();//登记序号
- String nsrsbh = taxUnitInfo.getTaxNumber();//税号
- String areaid = taxUnitInfo.getAreaCode();//地区编码
- String bmbh = "";//部门编号
- String bmmc = "";//部门编码
- Integer year = new Date().getYear();
- String skssq = skssqFormat.format(new Date());
- String lzrqcl = "";
- JSONObject postBody = new JSONObject();
- postBody.put("bizNo",bizNo);
- postBody.put("qymc", qymc);
- postBody.put("mmlx", mmlx);
- postBody.put("smzh", smzh);
- postBody.put("smmm", smmm);
- postBody.put("jmsmmm", jmsmmm);
- postBody.put("sbmm", sbmm);
- postBody.put("jmsbmm", jmsbmm);
- postBody.put("djxhid", djxhid);
- postBody.put("nsrsbh", nsrsbh);
- postBody.put("areaid", areaid);
- postBody.put("bmbh", bmbh);
- postBody.put("bmmc", bmmc);
- postBody.put("year", year);
- postBody.put("skssq",skssq);
- postBody.put("lzrqcl", lzrqcl);
- BOSUuid id = taxUnitInfo.getId();
- //STaxPersonRecordEntry
- TaxPersonRecordEntryCollection taxPersonRecordEntrys =
- TaxPersonRecordEntryFactory.getLocalInstance(context).
- getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "'");
- JSONArray rylb = new JSONArray();
- JSONObject personInfo = null;
- int size = taxPersonRecordEntrys.size();
- if (size==0){
- break;
- }
- for (int j = 0; j < size; j++) {
- personInfo = new JSONObject();
- TaxPersonRecordEntryInfo taxPersonRecordEntryInfo = taxPersonRecordEntrys.get(j);
- TaxPersonRecordInfo bill = taxPersonRecordEntryInfo.getBill();
- String xm = PersonFactory.getLocalInstance(context).getPersonInfo(new ObjectUuidPK(bill.getPerson().getId())).getName();//姓名
- String zzlx = bill.getCardType().getAlias();//证件类型
- String zzhm = bill.getCardNumber();//证件号码
- String s = cardTypeReflection(zzlx);//证件类型
- personInfo.put("xm",xm);
- personInfo.put("zzlx",s );
- personInfo.put("zzhm",zzhm);
- rylb.add(personInfo);
- }
- postBody.put("rylb", rylb);
- String ip = propt.getProperty("ip");
- String url = ip + "/gateway/iit/personalPension/download";
- logger.error("===请求参数=="+postBody+"========");
- ISYUtilsFacade localInstance = SYUtilsFacadeFactory.getLocalInstance(context);
- String post = localInstance.post(url, postBody.toJSONString());
- JSONObject postJSON = JSONObject.parseObject(post);
- //校验 请求是否成功
- JSONObject head = postJSON.getJSONObject("head");
- if (head.getString("status").equals("N")){
- returnMap.put("code",500);
- returnMap.put("error","请求失败");
- JSONUtils.SUCCESS(returnMap);
- return;
- }
- JSONObject body = postJSON.getJSONObject("body");
- String string = body.getString("requestId");
- url = ip+"/gateway/iit/personalPension/getDownloadFeedback";
- String s = localInstance.backTask(url, string, "", null, TaskCatalogEnum.PERSON);
- logger.error("返回参数:"+post);
- returnMap.put("code",200);
- returnMap.put("info","下载中");
- JSONUtils.SUCCESS(returnMap);
- }
- } catch (BOSException e) {
- JSONUtils.ERROR("BOSException",e);
- throw new RuntimeException(e);
- } catch (FileNotFoundException e) {
- JSONUtils.ERROR("FileNotFoundException",e);
- throw new RuntimeException(e);
- } catch (IOException e) {
- JSONUtils.ERROR("IOException",e);
- throw new RuntimeException(e);
- } catch (EASBizException e) {
- JSONUtils.ERROR("EASBizException",e);
- throw new RuntimeException(e);
- }
- }
- public static void main(String[] args) {
- String encode = Base64Utils.encode("asdasd");
- System.out.println(encode);
- }
- public String cardTypeReflection(String cardTypeName) {
- switch (cardTypeName) {
- case "居民身份证":
- return "居民身份证";
- case "中国护照":
- return "中国护照";
- case "港澳居民来往内地通行证":
- return "港澳居民来往内地通行证";
- case "中华人民共和国港澳居民居住证":
- return "港澳居民来往内地通行证";
- case "台湾居民来往大陆通行证":
- return "台湾居民来往大陆通行证";
- case "中华人民共和国台湾居民居住证":
- return "台湾居民居住证";
- case "外国护照":
- return "外国护照";
- case "外国人永久居留身份证":
- return "外国人永久居留身份证";
- case "中华人民共和国外国人工作许可证(A类)":
- return "外国人工作许可证(A类)";
- case "中华人民共和国外国人工作许可证(B类)":
- return "外国人工作许可证(B类)";
- case "中华人民共和国外国人工作许可证(C类)":
- return "外国人工作许可证(C类)";
- }
- return "";
- }
- public Boolean isCardType(String cardType) {
- String cardTypes = "港澳居民居住证,台湾居民居住证,外国人永久居留身份证,外国人工作许可证(A类),外国人工作许可证(B类),外国人工作许可证(C类)";
- if (cardTypes.indexOf(cardType) >= 0) {
- return true;
- } else {
- return false;
- }
- }
- }
|