コード例 #1
0
  /**
   * 插入新的傭金資料
   *
   * @param ProjectCommissionRequestVo vo
   * @return ProjectCommissionResponseVo
   * @throws Exception
   */
  public ProjectCommissionResponseVo newCommission(ProjectCommissionRequestVo vo) {

    ProjectCommissionResponseVo resp = new ProjectCommissionResponseVo();
    long newId = 0;
    String txStatus = "";
    boolean chk = false;
    String newPro = "";
    try {
      // logger.debug("newProjectCommission entry=======================");
      // logger.debug("ProjectCommissionRequestVo vo:" + vo);

      CommissionVo rvo = new CommissionVo();
      CommissionDao dao = new CommissionDao();

      rvo.setCost(vo.getCost());
      rvo.setProjectprice(vo.getProjectprice());
      rvo.setVoice_reward(vo.getVoice_reward());
      rvo.setVoice_data_reward(vo.getData_reward());
      rvo.setData_reward(vo.getData_reward());
      rvo.setBonus(vo.getBonus());
      rvo.setCost_gap(vo.getCost_gap());
      rvo.setRatesid(vo.getRatesid());

      newPro = StringTK.cleanInvalidString(Strings.nullToEmpty(vo.getPrmotion_code()));
      rvo.setPrmotion_code(newPro);

      // 插入新的傭金資料
      chk = dao.insert(rvo);

      if (!chk) {
        throw new Exception("EC001:新增專案主檔失敗");
      }

      newId = rvo.getId();
      View_project_commissionVo f = dao.viewFindByCommissionId(newId);

      List<View_project_commissionVo> list = new ArrayList<View_project_commissionVo>();
      list.add(f);
      resp.setTxCode(vo.getTxCode());
      resp.setData(list);
      resp.setTxStatus(ApplicationConstant.TX_SUCCESS); // 設定交易成功狀態		

    } catch (Exception e) {
      txStatus = e.getMessage();
      logger.error(e.getMessage());
      resp.setTxStatus(txStatus);
    } finally {
      try {
        String ac = getResource().getRequestTranslet().getAccount();
        long aUid = UsersTK.getIdFromAccount(ac);
        LogTK.info(aUid, LogTK.CATEGORY_PROJECT, "新增傭金資料:" + newId + "/" + resp.getTxStatus());
      } catch (Exception e) {

      }
    }

    return resp;
  }
コード例 #2
0
  /**
   * 更新傭金資料
   *
   * @param ProjectCommissionRequestVo vo
   * @return ProjectCommissionResponseVo
   * @throws Exception
   */
  public ProjectCommissionResponseVo updateCommission(ProjectCommissionRequestVo vo) {

    ProjectCommissionResponseVo resp = new ProjectCommissionResponseVo();

    String txStatus = "";
    boolean chk = false;
    String newPro = "";

    try {

      CommissionVo rvo = new CommissionVo();
      CommissionDao dao = new CommissionDao();

      // 插入新的費率標籤
      chk = dao.update(vo.getData());

      if (!chk) {
        throw new Exception("EC001:修改專案佣金失敗");
      }

      resp.setTxCode(vo.getTxCode());
      //				resp.setData(list);
      resp.setTxStatus(ApplicationConstant.TX_SUCCESS); // 設定交易成功狀態
      //			}

    } catch (Exception e) {
      txStatus = e.getMessage();
      logger.error(e.getMessage());
      resp.setTxStatus(txStatus);
    } finally {
      try {
        String ac = getResource().getRequestTranslet().getAccount();
        long aUid = UsersTK.getIdFromAccount(ac);
        LogTK.info(aUid, LogTK.CATEGORY_PROJECT, "更新傭金資料:" + vo.getId() + "/" + resp.getTxStatus());
      } catch (Exception e) {

      }
    }

    return resp;
  }