コード例 #1
0
ファイル: ZcDingDianService.java プロジェクト: jielen/dtnw
  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;
  }
コード例 #2
0
ファイル: Util.java プロジェクト: jielen/SFJD
package com.ufgov.zc.server.system.util;
コード例 #3
0
package com.ufgov.zc.server.zc.service.impl;
コード例 #4
0
ファイル: ZcDingDianService.java プロジェクト: jielen/dtnw
  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;
  }