Example #1
0
 public void deleteFN(ZcDingdian bill, RequestMeta requestMeta) {
   // TCJLODO Auto-generated method stub
   ddDao.deleteByPrimaryKey(bill.getDdCode());
   ddBiDao.deleteBiByDdCode(bill.getDdCode());
   ddItemDao.deleteItemByDdCode(bill.getDdCode());
   // 同步到另一个网端
   insertDeleteInfoToDataExchage(bill.getDdCode());
 }
Example #2
0
  public ZcDingdian sendPayFN(ZcDingdian bill, RequestMeta requestMeta) throws Exception {
    bill = updateFN(bill, requestMeta);
    Map map = null;
    BudgetUtil bu = new BudgetUtil();
    // 指标接口和支付接口分开,这样指标接口出错时则不掉用取消结冻指标操作
    try {
      /*
       * 释放指标金额,本次支付金额10w,则应该修改采购计划金额=原采购计划金额-10w
       */
      map = bu.getDingDianShiFangBudget(baseDao, true, bill);
      bu.callService(map, requestMeta.getSvNd());
      Map rtn = new PayForZcUtil().PayByDingDian(bill, requestMeta);
      if (rtn == null) {
        // 目前没有处理,应该不会出现这种情况
        // throw new RuntimeException(e1.getMessage());
      } else {
        String rtnType = (String) rtn.get(PayForZcUtil.RTN_RESULT);
        String returnMsg = (String) rtn.get(PayForZcUtil.RTN_MESSAGE);
        if (rtnType.equalsIgnoreCase(PayForZcUtil.RTN_RESULT_FALSE)) {
          throw new RuntimeException("定点采购【" + bill.getDdCode() + "】生成支付出错:" + returnMsg);
        } else { // 保存支付凭证号与当前支付单的关联关系
          String vouIds = (String) rtn.get(PayForZcUtil.RTN_DATA);
          _savePayVouId(vouIds, bill, requestMeta);
        }
      }
    } catch (ZcPayInterfaceException e) {
      try {
        bu.cancelCallService(map, requestMeta.getSvNd());
      } catch (Exception e1) {
        String errorInfo = "";
        errorInfo = "定点采购【" + bill.getDdCode() + "】生成支付出错时,取消结冻的指标出现异常\n";
        List biLst = bill.getBiList();
        for (int i = 0; i < biLst.size(); i++) {
          ZcDingdianBi bi = (ZcDingdianBi) biLst.get(i);
          errorInfo +=
              "指标编号:"
                  + bi.getZcBiNo()
                  + " 金额:"
                  + (bi.getZcBiJhuaSum() == null ? "" : bi.getZcBiJhuaSum().toString())
                  + "\n";
        }

        System.err.println("异常信息如下:" + errorInfo);
        e1.printStackTrace();
        throw new RuntimeException(e1.getMessage() + errorInfo);
      }
      e.printStackTrace();
      throw new RuntimeException(e.getMessage());
    }
    bill = auditFN(bill, requestMeta);
    // 支付指标
    return bill;
  }
Example #3
0
  public String importDelDataFN(String id, RequestMeta meta) throws DataExchangeException {

    ZcDingdian dd = selectByPrimaryKey(id, meta);
    if (dd == null) return "定点采购" + id + "同步删除成功";
    if (dd != null
        && ("exec".equalsIgnoreCase(dd.getStatus()) || "sendGk".equalsIgnoreCase(dd.getStatus()))) {
      throw new DataExchangeException("定点采购" + dd.getDdCode() + "已经送国库支付了,不能再次导入!");
    }
    ddDao.deleteByPrimaryKey(id);
    ddBiDao.deleteBiByDdCode(id);
    ddItemDao.deleteItemByDdCode(id);
    return "定点采购" + id + "同步删除成功";
  }
Example #4
0
 private void _savePayVouId(String vouIds, ZcDingdian dd, RequestMeta requestMeta) {
   // TCJLODO Auto-generated method stub
   if (vouIds == null) return;
   baseDao.delete("ZC_PAY_GK_INFO.deleteByZcBillId", dd.getDdCode());
   StringTokenizer st = new StringTokenizer(vouIds, PayForZcUtil.RTN_DATA_SPLIT);
   String interfaceType = AsOptionUtil.getInstance().getOptionVal(ZcPayGkInfo.GK_INTERFACE_TYPE);
   String vouType =
       interfaceType.equalsIgnoreCase("Y")
           ? ZcPayGkInfo.GK_VOU_TYPE_ZFPZ
           : ZcPayGkInfo.GK_VOU_TYPE_ZFSQ;
   while (st.hasMoreTokens()) {
     String vouId = st.nextToken();
     ZcPayGkInfo info = new ZcPayGkInfo();
     info.setZcBillType(ZcPayGkInfo.ZC_BILL_TYPE_DINGDIAN);
     info.setZcBillId(dd.getDdCode());
     info.setGkVouId(vouId);
     info.setGkReturnFlag("N");
     info.setSendGkDate(requestMeta.getSysDate());
     info.setGkVouType(vouType);
     baseDao.insert("ZC_PAY_GK_INFO.insert", info);
   }
 }
Example #5
0
  public ZcDingdian selectByPrimaryKey(String ddCode, RequestMeta requestMeta) {

    ZcDingdian dd = ddDao.selectByPrimaryKey(ddCode);
    if (dd == null) return null;
    dd.setBiList(getBiLst(ddCode));
    dd.setItemList(getItemLst(ddCode));

    dd.setDbDigest(null);
    dd.setDbDigest(dd.digest()); // 统一入口

    return dd;
  }
Example #6
0
  public String importTransDatasFN(ZcDingdian bill, RequestMeta meta) throws DataExchangeException {

    ZcDingdian bal = selectByPrimaryKey(bill.getDdCode(), meta);
    if (bal != null
        && ("exec".equalsIgnoreCase(bal.getStatus())
            || "sendGk".equalsIgnoreCase(bal.getStatus()))) {
      throw new DataExchangeException("定点采购" + bill.getDdCode() + "已经送国库支付了,不能再次导入!");
    }
    String rtn = bill.getDdCode() + "导入成功";
    try {
      _updateFN(bill, meta, true);
    } catch (Exception e) {
      // TCJLODO Auto-generated catch block
      e.printStackTrace();
      rtn = bill.getDdCode() + "导入异常:\n" + e.getMessage();
    }
    return rtn;
  }
Example #7
0
 public ZcDingdian newCommitFN(ZcDingdian bill, RequestMeta requestMeta) {
   wfEngineAdapter.newCommit(bill.getComment(), bill, requestMeta);
   return selectByPrimaryKey(bill.getDdCode(), requestMeta);
 }
Example #8
0
  public ZcDingdian callbackFN(ZcDingdian bill, RequestMeta requestMeta) {

    wfEngineAdapter.callback(bill.getComment(), bill, requestMeta);

    return bill;
  }
Example #9
0
  private ZcDingdian _updateFN(ZcDingdian bill, RequestMeta requestMeta, boolean isImportData)
      throws Exception {
    //    System.out.println("before service 2="+bill.getCoCode()+bill.getCoName());
    String code = "";
    String temp_code = "";

    List biList = bill.getBiList();
    String userId = requestMeta.getSvUserID();
    String compoId = requestMeta.getCompoId();
    boolean isDraft = false;
    if (bill.getProcessInstId() == null || bill.getProcessInstId().longValue() == -1) {
      Long draftid = workflowDao.createDraftId();
      bill.setProcessInstId(draftid);
      isDraft = true;
    }

    Map map = null;
    if ("".equals(ZcSUtil.safeString(bill.getDdCode())) || bill.getDdCode().equals("自动编号")) {
      // 当新建项目的时候,项目编码不进行正式编码,首先创建一个临时编码,等提交送审之后,进行正式编码
      temp_code = NumUtil.getInstance().getNo("ZC_DINGDIAN", "DD_CODE", bill);
      code = temp_code;
      bill.setDdCode(code);
      map =
          new BudgetUtil()
              .getSaveBudgetByZcDingDian(ddBiDao, baseDao, ZcSUtil.isUseBi(), bill, biList);
      //      System.out.println("before service 3="+bill.getCoCode()+bill.getCoName());
      BigDecimal biSum = new BigDecimal(0);
      for (int i = 0; i < biList.size(); i++) {
        ZcDingdianBi bi = (ZcDingdianBi) biList.get(i);
        bi.setDdCode(code);
        if (bi.getZcBiNo() != null && bi.getZcBiNo().trim().length() > 0) {
          biSum = biSum.add(bi.getZcBiJhuaSum());
        }
      }
      bill.setBiSum(biSum);

      for (int i = 0; i < bill.getItemList().size(); i++) {
        ZcDingdianItem item = (ZcDingdianItem) bill.getItemList().get(i);
        item.setDdCode(code);
      }

      //      System.out.println("before service 4="+bill.getCoCode()+bill.getCoName());
      ddDao.insert(bill);
      //      System.out.println("before service 5="+bill.getCoCode()+bill.getCoName());
      ddBiDao.insertList(biList);
      ddItemDao.insertList(bill.getItemList());
      //      System.out.println("before service 6="+bill.getCoCode()+bill.getCoName());
    } else {

      code = bill.getDdCode();

      BigDecimal biSum = new BigDecimal(0);
      for (int i = 0; i < biList.size(); i++) {
        ZcDingdianBi bi = (ZcDingdianBi) biList.get(i);
        bi.setDdCode(code);
        if (bi.getZcBiNo() != null && bi.getZcBiNo().trim().length() > 0) {
          biSum = biSum.add(bi.getZcBiJhuaSum());
        }
      }
      bill.setBiSum(biSum);
      // 使用删除、插入,是考虑导入数据时,code已经有了,直接update没有用,所以采用删、插的模式
      ddDao.deleteByPrimaryKey(bill.getDdCode());
      //        System.out.println("update before="+bill.getCoCode()+bill.getCoName());
      ddDao.insert(bill);

      //      System.out.println("666="+bill.getCoCode()+bill.getCoName());
      map =
          new BudgetUtil()
              .getSaveBudgetByZcDingDian(ddBiDao, baseDao, ZcSUtil.isUseBi(), bill, biList);

      ddBiDao.deleteBiByDdCode(bill.getDdCode());
      ddItemDao.deleteItemByDdCode(bill.getDdCode());
      for (int i = 0; i < biList.size(); i++) {
        ZcDingdianBi mbi = (ZcDingdianBi) biList.get(i);
        mbi.setDdCode(code);
      }
      ddBiDao.insertList(biList);

      for (int i = 0; i < bill.getItemList().size(); i++) {
        ZcDingdianItem item = (ZcDingdianItem) bill.getItemList().get(i);
        item.setDdCode(code);
      }
      ddItemDao.insertList(bill.getItemList());
    }

    if (isDraft) {
      AsWfDraft asWfDraft = new AsWfDraft();
      asWfDraft.setCompoId(compoId);
      asWfDraft.setWfDraftName(bill.getDdCode());
      asWfDraft.setUserId(userId);
      asWfDraft.setMasterTabId(compoId);
      asWfDraft.setWfDraftId(BigDecimal.valueOf(bill.getProcessInstId().longValue()));
      workflowDao.insertAsWfdraft(asWfDraft);
    }

    // 不是导入的数据,且使用指标接口
    if (!isImportData) { //
      new BudgetUtil().callService(map, requestMeta.getSvNd());
    }
    //    System.out.println("return before="+bill.getCoCode()+bill.getCoName());
    return bill;
  }
Example #10
0
  public ZcDingdian auditFN(ZcDingdian bill, RequestMeta requestMeta) throws Exception {

    bill = updateFN(bill, requestMeta);
    wfEngineAdapter.commit(bill.getComment(), bill, requestMeta);
    return bill;
  }
Example #11
0
 public ZcDingdian untreadFN(ZcDingdian bill, RequestMeta requestMeta) {
   wfEngineAdapter.untread(bill.getComment(), bill, requestMeta);
   return bill;
 }