liuling 9 月之前
父節點
當前提交
a9bf9a10a1

+ 163 - 14
websrc/com/kingdee/eas/custom/TaxUnitListHandlerEx.java

@@ -16,11 +16,9 @@ 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;
@@ -250,6 +248,13 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
         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();
@@ -261,15 +266,18 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
                 String smzh = "";//实名账号
                 String smmm = "";//实名密码
                 String jmsmmm = "";//加密实名密码
-                byte[] decode = Base64.getDecoder().decode(taxUnitInfo.getDeclPassword());
-                String sbmm = new String(decode);//;//申报密码
+                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 = "";//所属期  ----还不知道怎么定这个东西
+                String skssq = taxPeriodDate;//所属期  ----还不知道怎么定这个东西
                 String lzrqcl = "";
                 JSONObject postBody = new JSONObject();
                 postBody.put("bizNo",bizNo);
@@ -289,9 +297,16 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
                 postBody.put("lzrqcl", lzrqcl);
                 BOSUuid id = taxUnitInfo.getId();
                 //STaxPersonRecordEntry
-                TaxPersonRecordEntryCollection taxPersonRecordEntrys =
-                        TaxPersonRecordEntryFactory.getLocalInstance(context).
-                                getTaxPersonRecordEntryCollection("select * , bill.* where taxUnit = '" + id.toString() + "'");
+                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();
@@ -302,7 +317,7 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
                     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 xm = bill.getReportName();//姓名
                     String zzlx = bill.getCardType().getAlias();//证件类型
                     String zzhm = bill.getCardNumber();//证件号码
                     String s = cardTypeReflection(zzlx);//证件类型
@@ -316,7 +331,7 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
                     String bmbh1 = "";//部门编码
                     String rybscl = "";//人员报送策略
                     String gh = "";//工号
-                    String skssq1 = "";//所属期
+                    String skssq1 = taxPeriodDate;//所属期
                     String lxdh = bill.getPhoneNumber(); //电话
                     String nsrzt = taxPersonRecordEntryInfo.getPersonStatus().getValue();//人员状态
                     String sfgy = taxPersonRecordEntryInfo.getEmployedType().getAlias();//任职受雇类型
@@ -467,26 +482,160 @@ public class TaxUnitListHandlerEx extends TaxUnitListHandler {
                 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 jsonObject = JSONObject.parseObject(post);
-                JSONObject jsonObject1 = jsonObject.getJSONObject("body");
-                String string = jsonObject1.getString("requestId");
-                localInstance.backTask(url,string,"service",null, TaskCatalogEnum.PERSON);
+                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);

+ 33 - 0
websrc/com/kingdee/eas/custom/shuiyou/service/PensionInfoService.java

@@ -0,0 +1,33 @@
+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.eas.common.EASBizException;
+import org.apache.log4j.Logger;
+
+import java.util.Map;
+
+public class PensionInfoService implements IHRMsfService {
+    private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.shuiyou.service.PensionInfoService");
+    @Override
+    public Object process(Context context, Map map) throws EASBizException, BOSException {
+        logger.error("com.kingdee.eas.custom.shuiyou.service.PensionInfoService.process");
+        Object o = map.get("result");
+        if (o == null) {
+            throw new RuntimeException("参数result为空");
+        }
+        JSONObject jsonObject = JSONObject.parseObject(o.toString());
+        logger.error("入参:"+jsonObject);
+        JSONObject body = jsonObject.getJSONObject("body");
+        //明细结果
+        JSONArray mxjg = body.getJSONArray("mxjg");
+
+        //累计结果
+        JSONArray ljjg = body.getJSONArray("ljjg");
+
+        return null;
+    }
+}

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

@@ -11,17 +11,21 @@ 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 org.apache.log4j.Logger;
 
 import java.util.Map;
 
 public class PersonnelReportService implements IHRMsfService {
+    private static Logger logger = Logger.getLogger("com.kingdee.eas.custom.shuiyou.service.PersonnelReportService");
     @Override
     public Object process(Context context, Map map) throws EASBizException, BOSException {
+        logger.error("com.kingdee.eas.custom.shuiyou.service.PersonnelReportService.process");
         Object o = map.get("result");
         if (o == null) {
             throw new RuntimeException("²ÎÊýresultΪ¿Õ");
         }
         JSONObject jsonObject = JSONObject.parseObject(o.toString());
+        logger.error("Èë²Î£º"+jsonObject);
         JSONObject body = jsonObject.getJSONObject("body");
         JSONArray bsjgs = body.getJSONArray("bsjg");
         for (int b = 0; b < bsjgs.size(); b++) {