liuling 9 ヶ月 前
コミット
2c7462f769

+ 531 - 0
websrc/com/kingdee/eas/custom/TaxUnitListHandlerEx.java

@@ -0,0 +1,531 @@
+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.eas.fi.arap.util.DBUtil;
+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.PersonStatusEnum;
+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");
+        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 = "";//部门编码
+                String skssq = "";//所属期  ----还不知道怎么定这个东西
+                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 =
+                        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);//证件类型
+                    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 = "";//所属期
+                    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());
+                //校验 请求是否成功
+                JSONObject jsonObject = JSONObject.parseObject(post);
+                JSONObject jsonObject1 = jsonObject.getJSONObject("body");
+                String string = jsonObject1.getString("requestId");
+                localInstance.backTask(url,string,"service",null, TaskCatalogEnum.PERSON);
+                logger.error("返回参数:"+post);
+
+            }
+
+        } catch (BOSException e) {
+            throw new RuntimeException(e);
+        } catch (FileNotFoundException e) {
+            throw new RuntimeException(e);
+        } catch (IOException e) {
+            throw new RuntimeException(e);
+        } catch (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;
+        }
+    }
+}

+ 0 - 224
websrc/com/kingdee/eas/custom/shuiyou/TaxUnitListHandlerEx.java

@@ -1,224 +0,0 @@
-package com.kingdee.eas.custom.jiuzhoutong.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.eas.common.EASBizException;
-import com.kingdee.eas.custom.jiuzhoutong.utils.SYUtils;
-import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoFactory;
-import com.kingdee.eas.custom.shuiyou.registration.RegistrationInfoInfo;
-import com.kingdee.eas.fi.arap.util.DBUtil;
-import com.kingdee.shr.base.syssetting.context.SHRContext;
-import com.kingdee.shr.base.syssetting.exception.SHRWebException;
-import com.kingdee.shr.compensation.app.tax.TaxUnitFactory;
-import com.kingdee.shr.compensation.app.tax.TaxUnitInfo;
-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.util.Map;
-import java.util.Properties;
-
-public class TaxUnitListHandlerEx extends TaxUnitListHandler {
-    private Properties propt = new Properties();
-    private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.jiuzhoutong.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";
-        logger.error("=========进入:"+entrance+"==========");
-        String id = request.getParameter("id");
-        Context context = SHRContext.getInstance().getContext();
-        SYUtils syUtils =null;
-        Response sYResponse = null;
-        Map<String, String> commonParameter = null;
-        String postBody ="";
-        try {
-            logger.error("=====获取基本信息=====");
-            this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
-            syUtils = new SYUtils(propt);
-
-            commonParameter = syUtils.getCommonParameter();//获取公共参数
-            logger.error("=======公共参数:"+JSONObject.toJSONString(commonParameter)+"===========");
-
-            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));
-            //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();
-            if (sYResponse.isSuccessful()) {
-                String responseData = sYResponse.body().string();
-                logger.error("返回参数:"+responseData);
-                JSONArray jsonArray = JSONArray.parseArray(responseData);
-                RegistrationInfoInfo registrationInfo ;
-                if (jsonArray.size()>0){
-                    logger.error("删除原有的数据以便以写入行的数据");
-                    String sql = "delete from CT_REG_RegistrationInfo";
-                    DBUtil.execute(context,sql);
-                }
-                logger.error("写入数据:");
-                for (int i = 0; i < jsonArray.size(); i++) {
-                    registrationInfo = new RegistrationInfoInfo();
-                    JSONObject jsonObject = jsonArray.getJSONObject(i);
-                    String djxhid = jsonObject.getString("djxhid");//	登记序号
-
-                    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);
-
-                    RegistrationInfoFactory.getLocalInstance(context).save(registrationInfo);
-                }
-                logger.error("记录成功接口日志");
-                syUtils.interfaceLog(context,null,ip+"/gateway/iit/declare/getCompanyRegisterInfo"
-                ,"企业注册",postBody,responseData,entrance,commonParameter.get("xReqNonce"));
-
-            } else {
-                logger.error("记录无参数返回日志");
-                syUtils.interfaceLog(context,sYResponse.message(),ip+"/gateway/iit/declare/getCompanyRegisterInfo"
-                        ,"企业注册",postBody,null,entrance,commonParameter!=null?commonParameter.get("xReqNonce"):null);
-                System.out.println("Error Code:" + sYResponse.message());
-            }
-
-        } catch (BOSException e) {
-            logger.error("记录BOSException报错接口日志");
-            syUtils.interfaceLog(context,e.getMessage(),propt.getProperty("ip")+"/gateway/iit/declare/getCompanyRegisterInfo"
-                    ,"企业注册",postBody,null,entrance,commonParameter!=null?commonParameter.get("xReqNonce"):null);
-            throw new RuntimeException(e);
-        } catch (EASBizException e) {
-            logger.error("记录 EASBizException 报错接口日志");
-            syUtils.interfaceLog(context,e.getMessage(),propt.getProperty("ip")+"/gateway/iit/declare/getCompanyRegisterInfo"
-                    ,"企业注册",postBody,null,entrance,commonParameter!=null?commonParameter.get("xReqNonce"):null);
-            throw new RuntimeException(e);
-        } catch (FileNotFoundException e) {
-            logger.error("记录 FileNotFoundException 报错接口日志");
-            syUtils.interfaceLog(context,e.getMessage(),propt.getProperty("ip")+"/gateway/iit/declare/getCompanyRegisterInfo"
-                    ,"企业注册",postBody,null,entrance,commonParameter!=null?commonParameter.get("xReqNonce"):null);
-            throw new RuntimeException(e);
-        } catch (IOException e) {
-            logger.error("记录 IOException 报错接口日志");
-            syUtils.interfaceLog(context,e.getMessage(),propt.getProperty("ip")+"/gateway/iit/declare/getCompanyRegisterInfo"
-                    ,"企业注册",postBody,null,entrance,commonParameter!=null?commonParameter.get("xReqNonce"):null);
-            throw new RuntimeException(e);
-        }
-        logger.error("======================退出==================================");
-    }
-
-
-
-}

+ 57 - 0
websrc/com/kingdee/eas/custom/shuiyou/service/PersonnelReportService.java

@@ -0,0 +1,57 @@
+package com.kingdee.eas.custom.shuiyou.service;
+
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.kingdee.bos.BOSException;
+import com.kingdee.bos.Context;
+import com.kingdee.bos.bsf.service.app.IHRMsfService;
+import com.kingdee.bos.dao.ormapping.ObjectUuidPK;
+import com.kingdee.bos.util.BOSUuid;
+import com.kingdee.eas.common.EASBizException;
+import com.kingdee.shr.compensation.SubmitStatusEnum;
+import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordEntryFactory;
+import com.kingdee.shr.compensation.app.incomeTax.TaxPersonRecordEntryInfo;
+
+import java.util.Map;
+
+public class PersonnelReportService implements IHRMsfService {
+    @Override
+    public Object process(Context context, Map map) throws EASBizException, BOSException {
+        Object o = map.get("result");
+        if (o == null) {
+            throw new RuntimeException("参数result为空");
+        }
+        JSONObject jsonObject = JSONObject.parseObject(o.toString());
+        JSONObject body = jsonObject.getJSONObject("body");
+        JSONArray bsjgs = body.getJSONArray("bsjg");
+        for (int b = 0; b < bsjgs.size(); b++) {
+            JSONObject bsjg = bsjgs.getJSONObject(b);
+            String nsrsbh = bsjg.getString("nsrsbh");
+            TaxPersonRecordEntryInfo taxPersonRecordEntry =
+                    TaxPersonRecordEntryFactory.getLocalInstance(context).
+                            getTaxPersonRecordEntryInfo("select * , bill.* where taxNumber = '" + nsrsbh + "'");
+            String sbzt = bsjg.getString("sbzt");//报送状态 1	待报送 2	代报中 3	代报失败 4	代报成功
+            taxPersonRecordEntry.setSubmitStatus(StartReflection(sbzt));
+            bsjg.getString("rzzt");//验证状态0	若是身份证,状态为验证中;其他证件为暂不验证 1	验证通过 2	验证不通过 4	待验证 9	同代码0处理
+            //bsjg.getString("sfyjd");//是否建档
+            String sbyy = bsjg.getString("sbyy");//失败原因
+            taxPersonRecordEntry.setFailReason(sbyy);
+            BOSUuid id = taxPersonRecordEntry.getId();
+            TaxPersonRecordEntryFactory.getLocalInstance(context).update(new ObjectUuidPK(id),taxPersonRecordEntry);
+        }
+        return null;
+    }
+    public SubmitStatusEnum StartReflection(String start){
+        switch (start){
+            case "1":
+                return SubmitStatusEnum.NotSubmit;
+            case "2":
+                return SubmitStatusEnum.Submiting;
+            case "3":
+                return SubmitStatusEnum.SubmitFail;
+            case "4":
+                return SubmitStatusEnum.HaveSubmit;
+        }
+        return null;
+    }
+}

+ 0 - 156
websrc/com/kingdee/eas/custom/utils/SYUtils.java

@@ -1,156 +0,0 @@
-package com.kingdee.eas.custom.jiuzhoutong.utils;
-
-import com.kingdee.bos.BOSException;
-import com.kingdee.bos.Context;
-import com.kingdee.eas.base.permission.UserInfo;
-import com.kingdee.eas.common.EASBizException;
-import com.kingdee.eas.custom.shuiyou.interfaceiog.LogInfoFactory;
-import com.kingdee.eas.custom.shuiyou.interfaceiog.LogInfoInfo;
-import org.apache.log4j.Logger;
-
-import javax.crypto.Mac;
-import javax.crypto.spec.SecretKeySpec;
-import java.io.FileInputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
-import java.net.URLEncoder;
-import java.security.InvalidKeyException;
-import java.security.NoSuchAlgorithmException;
-import java.security.SignatureException;
-import java.sql.Timestamp;
-import java.util.*;
-
-public class SYUtils {
-    private Properties propt = new Properties();//共用参数
-    private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.jiuzhoutong.utils.SYUtils");
-
-    public  SYUtils(Properties propt){
-        this.propt=propt;
-    }
-    public  SYUtils(String address) throws IOException {
-        this.propt.load(new FileInputStream(address));
-    }
-
-    public  SYUtils() throws IOException {
-        this.propt.load(new FileInputStream(System.getProperty("EAS_HOME") + "/server/properties/sy/syConfig.properties"));
-    }
-    /**
-     * 获取签名
-     * @return
-     * @throws IOException
-     */
-    public  String getSignature(String xReqNonce,String timestamp,TreeMap<String, String> getParam) throws IOException {
-        logger.error("====获取签名===进入到了com.kingdee.eas.custom.jiuzhoutong.utils.SYUtils.getSignature=======");
-        TreeMap<String, String> treeMap = new TreeMap<>();
-        String version = propt.getProperty("version");//版本
-        String appKey = propt.getProperty("appKey");//身份标识
-        String appSecret = propt.getProperty("appSecret");//秘钥
-        logger.error("=============参数列================");
-        logger.error("version:"+version);
-        logger.error("appKey:"+appKey);
-        logger.error("xReqNonce:"+xReqNonce);
-        logger.error("appSecret:"+appSecret);
-        logger.error("==================================");
-        treeMap.put("version", version);
-        treeMap.put("timestamp", String.valueOf(timestamp));
-        treeMap.put("appKey", appKey);
-        treeMap.put("xReqNonce", xReqNonce);
-        treeMap.put("appSecret", appSecret);
-        if (getParam!=null){
-            treeMap.putAll(getParam);
-        }
-        StringBuilder mergeStr = new StringBuilder();
-        for (Map.Entry<String, String> stringStringEntry : treeMap.entrySet()) {
-            mergeStr.append(stringStringEntry.getValue());
-        }
-        logger.error("将以上key=value对的value进行合并,生成一下字符串mergeStr:"+mergeStr.toString());
-        String encodedStr = null;
-        try {
-            encodedStr = URLEncoder.encode(mergeStr.toString(), "UTF-8");
-        } catch (UnsupportedEncodingException e) {
-            // URL 编码失败
-            e.printStackTrace();
-            throw new RuntimeException("url编码失败");
-        }
-        logger.error("将生成的mergeStr进行Url编码:"+encodedStr);
-
-        // 4.利用HmacSHA256算法对signStr进行哈希运算生成消息摘要,摘要结果以Base64结果形式返回,signStr即为请求参数中的signature字段
-        String signatureResult = "";
-        try {
-            Mac mac = Mac.getInstance("HmacSHA256");
-            SecretKeySpec signingKey = new SecretKeySpec(appSecret.getBytes(), "HmacSHA256");
-            mac.init(signingKey);
-            byte[] signData = mac.doFinal(encodedStr.getBytes());
-            byte[] resultBytes = Base64.getEncoder().encode(signData);
-            signatureResult = new String(resultBytes, "UTF-8");
-        } catch (NoSuchAlgorithmException e) {
-            throw new RuntimeException("平台不支持 HmacSHA 摘要方式");
-        } catch (InvalidKeyException e) {
-            throw new RuntimeException("Speicified access secret is not valid.");
-        } catch (UnsupportedEncodingException e) {
-            throw new RuntimeException("转码失败");
-        }
-        logger.error("用HmacSHA256算法对signStr进行哈希运算生成消息摘要,摘要结果以Base64结果形式返回,signStr即为请求参数中的signature字段"+signatureResult);
-        logger.error("==========================退出================================");
-        return signatureResult;
-    }
-
-    public Map<String,String> getCommonParameter(TreeMap<String, String> getParam) throws IOException {
-        String appKey = propt.getProperty("appKey");
-        String timestamp = String.valueOf(new Date().getTime());
-        String version = propt.getProperty("version");
-        String xReqNonce = UUID.randomUUID().toString().replace("-", "");//调用者生成的 UUID(32位),结合时间戳timestamp 防重放
-        String signature = this.getSignature(xReqNonce,timestamp,getParam);
-        Map<String,String> parameters = new HashMap<String,String>();
-        parameters.put("appKey",appKey);
-        parameters.put("timestamp",timestamp);
-        parameters.put("version",version);
-        parameters.put("xReqNonce",xReqNonce);
-        parameters.put("signature",signature);
-        return parameters;
-    }
-
-    /**
-     *
-     * @param context 上下文
-     * @param error 错误信息
-     * @param interfaceAddress 接口地址
-     * @param interfaceName 接口名
-     * @param inParameter 入参
-     * @param outParameter 回参
-     * @param entrance 入口
-     * @param xReqNonce uuid
-     * @throws BOSException
-     * @throws EASBizException
-     */
-    public void interfaceLog(Context context,String error,String interfaceAddress
-                        ,String interfaceName,String inParameter,String outParameter
-                        ,String entrance,String xReqNonce) {
-        LogInfoInfo logInfo = new LogInfoInfo();
-        logInfo.setErrorInfo(error);//错误信息
-        logInfo.setInterfaceAddress(interfaceAddress);//接口地址
-        logInfo.setInterfaceName(interfaceName);//接口名
-        logInfo.setInParameter(inParameter);//入参
-        logInfo.setOutParameter(outParameter);//回参
-        logInfo.setEntrance(entrance);//入口
-        UserInfo userInfo = (UserInfo)context.get("UserInfo");
-        logInfo.setCreator(userInfo);
-        Date date = new Date();
-        Timestamp timestamp = new Timestamp(date.getTime());
-        logInfo.setCreateTime(timestamp);
-        logInfo.setLastUpdateTime(timestamp);
-        logInfo.setLastUpdateUser(userInfo);
-        logInfo.setBizDate(date);
-        logInfo.setXReqNonce(xReqNonce);
-        try {
-            LogInfoFactory.getLocalInstance(context).save(logInfo);
-        } catch (BOSException e) {
-            throw new RuntimeException(e);
-        } catch (EASBizException e) {
-            throw new RuntimeException(e);
-        }
-    }
-
-
-}