Example #1
0
  @Action("addTeamMixInfo") // 请求入径为/absale/team/addTeamMixInfo.action
  public void addTeamMixInfo() {
    try {
      TeamMixInfoBean teamMixInfoBean = this.entity;
      // TeamMixInfoBean teamMixInfoBean = test();
      TeamBaseBean t1 = new TeamBaseBean();
      long serNo = UUIDProxy.integerKey();
      t1.setTid(new Long(serNo));
      t1.setTeamCode(teamMixInfoBean.getTeamCode());
      t1.setTeamName(teamMixInfoBean.getTeamName());
      t1.setStatus("1");
      t1.setRid(teamMixInfoBean.getRid());
      t1.setDid(teamMixInfoBean.getDid());
      t1.setTypeNo1(teamMixInfoBean.getTypeNo1());
      t1.setCreateDate(teamMixInfoBean.getCreateDate());
      t1.setInvalidDate("2099-12-31");
      TeamNatureBean t2 = new TeamNatureBean();
      t2.setTid(new Long(serNo));
      t2.setAddr(teamMixInfoBean.getAddr());
      t2.setPostalCode(teamMixInfoBean.getPostalCode());
      t2.setPhone(teamMixInfoBean.getPhone());
      t2.setFax(teamMixInfoBean.getFax());
      TeamLeaderBean t3 = new TeamLeaderBean();
      t3.setLeaderId(teamMixInfoBean.getLeaderId());
      t3.setLeaderRankId(teamMixInfoBean.getLeaderRankId());
      List<ObjRelationBean> rb = new ArrayList<ObjRelationBean>();

      /** *************** 从入参获取数据,写入到t1,t2,t3,根据业务,如有需要,则添加rb **************** */
      if (service.insertTeamMixInfo(t1, t2, t3, rb.toArray(new ObjRelationBean[0]))) {
        Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(true, "保存成功!")));
      } else {
        Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, "保存失败!")));
      }
    } catch (ServiceException se) {
      logger.error(
          "com.isoftstone.framework.modules.web.team.TeamMainAction.java.addTeamMixInfo():"
              + se.getMessage(),
          se); // 代码走查 add by guojian at 2010-11-5 for log4j
      Struts2Utils.renderJson(
          ExtjsHelper.toJsonObjectResult(new Info(false, "数据验证,服务层异常!" + se.getMessage())));
    } catch (Exception e) {
      logger.error(
          "com.isoftstone.framework.modules.web.team.TeamMainAction.java.addTeamMixInfo():"
              + e.getMessage()); // 代码走查 add by guojian at 2010-11-5 for log4j
      Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
    }
  }
Example #2
0
 public boolean insertPersonBank(PersonBankBean t) throws Exception {
   Long serNo = new Long(UUIDProxy.integerKey());
   t.setSerNo(serNo);
   SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
   if (t.getAcctNo() == null || t.getAcctNo().equals("")) {
     throw new RuntimeException("卡号不能为空!");
   }
   if (t.getStartDate() == null || t.getStartDate().equals("")) {
     throw new RuntimeException("起始日期不能为空!");
   } else {
     try {
       sf.parse(t.getStartDate());
     } catch (ParseException e) {
       throw new RuntimeException("起始日期格式不正确!");
     }
   }
   if (dao.isUnique(t)) {
     throw new RuntimeException("该银行账户已存在!");
   }
   return dao.insertPersonBank(t);
 }