コード例 #1
0
ファイル: TeamMainAction.java プロジェクト: tyxing007/wkspc
 @Action("merger2Team") // 请求入径为/absale/team/merger2Team.action
 public void merger2Team() {
   try {
     TeamMixInfoBean teamMixInfoBean = this.entity;
     // TeamMixInfoBean teamMixInfoBean = test1();
     Long baseTid = teamMixInfoBean.getTid();
     Long otherTid = teamMixInfoBean.getMergerTid();
     //			List<ObjRelationBean> rb = new ArrayList<ObjRelationBean>();//代码走查 add by guojian at
     // 2010-11-5 for 去除警告
     /** *************** 从入参获取数据,写入到t1,t2,根据业务,如有需要,则添加rb **************** */
     if (service.merger2Team(baseTid, otherTid)) {
       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.TZeamMainAction.java.merger2Team():"
             + 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.TZeamMainAction.java.merger2Team():"
             + e.getMessage()); // 代码走查 add by guojian at 2010-11-5 for log4j
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #2
0
 public void findByID() throws IOException, Exception {
   Result result = null;
   try {
     T model = (T) getService().queryByID(getEntity());
     result = new Result(true, model);
     if (logger.isDebugEnabled()) {
       logger.debug(ExtjsHelper.toJsonObjectResult(result, this.getExcludes()));
     }
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(result, this.getExcludes()));
   } catch (ServiceException se) {
     se.printStackTrace(); // 参数,验证等其他异常
     if (logger.isDebugEnabled()) {
       logger.debug("数据验证,服务层异常!" + se.getMessage(), se);
     }
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(new Info(false, "数据验证,服务层异常!" + se.getMessage())));
   } catch (DataAccessException de) {
     de.printStackTrace();
     if (logger.isDebugEnabled()) {
       logger.debug("数据查询出错!" + de.getMessage());
     }
     if (logger.isDebugEnabled()) {
       logger.debug(
           ExtjsHelper.toJsonObjectResult(new Result(true, new Object()), this.getExcludes()));
     }
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(new Result(true, new Object()), this.getExcludes()));
   } catch (Exception e) {
     e.printStackTrace();
     if (logger.isDebugEnabled()) {
       logger.debug(e.getMessage());
     }
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #3
0
 @Action("addTeamChgRank") // 请求入径为/absale/team/addTeamChgRank.action
 public void addTeamChgRank() {
   try {
     TeamChgRankBean chgRankBean = this.entity;
     if (service.addTeamChgRank(chgRankBean)) {
       Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(true, "保存成功!")));
     } else {
       Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, "保存失败!")));
     }
   } catch (ServiceException se) {
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(new Info(false, "数据验证,服务层异常!" + se.getMessage())));
   } catch (Exception e) {
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #4
0
ファイル: TeamMainAction.java プロジェクト: tyxing007/wkspc
  @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())));
    }
  }
コード例 #5
0
 /** 按主键修改或删除 */
 public void update() {
   try {
     getService().update(getEntity());
   } catch (ServiceException se) {
     se.printStackTrace();
     if (logger.isDebugEnabled()) {
       logger.debug("数据验证,服务层异常!" + se.getMessage(), se);
     }
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, se.getMessage())));
     // 业务层校验失败
   } catch (Exception e) {
     e.printStackTrace(); // 数据库错误
     if (logger.isDebugEnabled()) {
       logger.debug(e.getMessage());
     }
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #6
0
 public void pagedQuery() { // 分页查询
   try {
     BaseEntity entity = getEntity();
     entity.setAutoCount(true);
     List<BaseEntity> entities = getService().pagedQuery(entity);
     if (logger.isDebugEnabled()) {
       logger.debug(
           ExtjsHelper.toJsonObjectResult(
               new Result(entity.getTotal(), entities), this.getExcludes()));
     }
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(
             new Result(entity.getTotal(), entities), this.getExcludes()));
   } catch (ServiceException se) {
     se.printStackTrace(); // 参数,验证等其他异常
     if (logger.isDebugEnabled()) {
       logger.debug("数据验证,服务层异常!" + se.getMessage(), se);
     }
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(new Info(false, "数据验证,服务层异常!" + se.getMessage())));
   } catch (DataAccessException de) {
     de.printStackTrace();
     if (logger.isDebugEnabled()) {
       logger.debug("数据查询出错!" + de.getMessage());
     }
     if (logger.isDebugEnabled()) {
       logger.debug(
           ExtjsHelper.toJsonObjectResult(
               new Result(0, Collections.emptyList()), this.getExcludes()));
     }
     Struts2Utils.renderJson(
         ExtjsHelper.toJsonObjectResult(
             new Result(0, Collections.emptyList()), this.getExcludes()));
   } catch (Exception e) {
     e.printStackTrace();
     if (logger.isDebugEnabled()) {
       logger.debug(e.getMessage());
     }
     // 数据库异常,提示操作员
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #7
0
ファイル: TeamMainAction.java プロジェクト: tyxing007/wkspc
 @Action("split2Team") // 请求入径为/absale/team/merger2Team.action
 public void split2Team() {
   try {
     TeamMixInfoBean teamMixInfoBean = this.entity;
     if (service.split2Team(teamMixInfoBean)) {
       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.TZeamMainAction.java.merger2Team():"
             + 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.TZeamMainAction.java.merger2Team():"
             + e.getMessage()); // 代码走查 add by guojian at 2010-11-5 for log4j
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }
コード例 #8
0
ファイル: TeamMainAction.java プロジェクト: tyxing007/wkspc
 @Action("modifyTeamMixInfo") // 请求入径为/absale/team/modifyTeamMixInfo.action
 public void modifyTeamMixInfo() {
   try {
     TeamMixInfoBean teamMixInfoBean = this.entity;
     // TeamMixInfoBean teamMixInfoBean = test1();
     TeamBaseBean t1 = new TeamBaseBean();
     t1.setTid(teamMixInfoBean.getTid());
     t1.setTeamName(teamMixInfoBean.getTeamName());
     t1.setCreateDate(teamMixInfoBean.getCreateDate());
     TeamNatureBean t2 = new TeamNatureBean();
     t2.setTid(teamMixInfoBean.getTid());
     t2.setAddr(teamMixInfoBean.getAddr());
     t2.setPostalCode(teamMixInfoBean.getPostalCode());
     t2.setPhone(teamMixInfoBean.getPhone());
     t2.setFax(teamMixInfoBean.getFax());
     List<ObjRelationBean> rb = new ArrayList<ObjRelationBean>();
     /** *************** 从入参获取数据,写入到t1,t2,根据业务,如有需要,则添加rb **************** */
     if (service.updateTeamMixInfo(t1, t2, 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.TZeamMainAction.java.modifyTeamMixInfo():"
             + 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.modifyTeamMixInfo():"
             + e.getMessage()); // 代码走查 add by guojian at 2010-11-5 for log4j
     Struts2Utils.renderJson(ExtjsHelper.toJsonObjectResult(new Info(false, e.getMessage())));
   }
 }