Esempio n. 1
0
  @Transactional
  public void insertSerial(String id, String wh) {
    String guid;
    LogItem logItem = new LogItem();
    SerialType type = null;
    try {
      type = this.serialDao.getTypeById(id);
      Serial serial = new Serial();

      serial.setSerial(wh);
      serial.setSerialType(type);

      if ("0".equalsIgnoreCase(type.getType())) {
        type.setCurrentSerialNo(type.getCurrentSerialNo() + 1D);
      } else {
        String update_bz = "";
        update_bz =
            (String)
                Db.getJtN()
                    .queryForObject(
                        "select update_bz from t_form_customserial where id=?",
                        new Object[] {id},
                        String.class);

        if ((this.serialDao.getSerialCount(type.getId(), type.getType()) == 0)
            && (update_bz.equals("0"))) type.setCurrentSerialNo(2.0D);
        else type.setCurrentSerialNo(type.getCurrentSerialNo() + 1D);
      }

      type.setCurrentSerialNo(type.getCurrentSerialNo() + 1D);
      this.serialDao.updateSerialType(type);

      this.serialDao.insertSerial(serial);

      logItem.setMethod("insertSerial");
      logItem.setLogid(Guid.get());
      logItem.setLevel("error");
      logItem.setDesc("文号添加成功");
      Log.write(logItem);
    } catch (NumberFormatException e) {
      guid = Guid.get();
      logItem.setMethod("insertSerial");
      logItem.setLogid(guid);
      logItem.setLevel("error");
      logItem.setDesc("文号处理时出现异常");
      logItem.setContent(e.toString());
      Log.write(logItem);
      throw new ServiceException("文号处理时出现异常");
    } catch (Exception e) {
      guid = Guid.get();
      logItem.setMethod("insertSerial");
      logItem.setLogid(guid);
      logItem.setLevel("error");
      logItem.setDesc("文号处理时出现异常");
      logItem.setContent(e.toString());
      Log.write(logItem);
      throw new ServiceException("文号处理时出现异常");
    }
  }
Esempio n. 2
0
  @RequestMapping("/login.doAction")
  public String login(HttpServletRequest request, HttpServletResponse response) {
    String dlmc = request.getParameter("dlmc");
    String password = request.getParameter("mm");
    Login login = new Login();
    /*if(!login.valiNum()){
    	request.setAttribute("ifdl", "true");
    	request.setAttribute("warning", "系统注册未成功");
    	return "/login.jsp";
    }*/
    String login_redirect = "";
    boolean login_cookie = false;
    try {
      login_redirect = SysPara.getValue("login_redirect");
    } catch (Exception e) {
      login_redirect = "/login.jsp";
    }
    request.setAttribute("ifdl", "true");
    if ("".equals(dlmc) || dlmc == null) {
      dlmc = login.getCookieValue(request, "com.ashburz_username");
      password = login.getCookieValue(request, "com.ashburz_password");
      if ("".equals(password) || password == null) {
        request.setAttribute("dlmc", dlmc);
        return login_redirect;
      }
      Des des = new Des();
      password = des.getDesString(password);
      login_cookie = true;
    }
    String mainpage_url = (new StringBuilder("main.jsp?guid=")).append(Guid.get()).toString();
    String yhid = "";
    String isUSBKey = request.getParameter("isUSBKey");
    String plain_pass = password;
    password = Md5.getMd5(password);

    if (login.validate(dlmc, password)) {
      yhid = login.getYhid(dlmc);
      if (!login_cookie) {
        Cookie cookie_username = new Cookie("com.ashburz_username", dlmc);
        cookie_username.setMaxAge(0x1e13380);
        response.addCookie(cookie_username);
        if ("1".equals(request.getParameter("mem_pass"))) {
          Cookie cookie_pass =
              new Cookie("com.ashburz_password", (new Des()).getEncString(plain_pass));
          cookie_pass.setMaxAge(0x1e13380);
          response.addCookie(cookie_pass);
        }
      }
      if (login_cookie) login.resetLoginInfo(response, dlmc, yhid);
      else login.setLoginInfo(request, response, login, yhid, dlmc);
      return mainpage_url;
    } else {
      request.setAttribute("warning", "用户名或密码错误!!");
      return login_redirect;
    }
  }