Beispiel #1
0
 public static int Crateuser(HashMap<String, String> hm) throws ACDException {
   DBUtil db = null;
   try {
     db = DBUtil.getInstance();
     String ID = db.insert(hm, "SeastarUsers");
     String sql = "INSERT INTO UserRemainLeave(UserID) values(" + ID + ")";
     db.execute(sql);
     String strEmail = "*****@*****.**";
     String strSubject = "有outlook邮箱账号需要你开通";
     // 问题紧急程度
     String Sb =
         "陆斌你好!<br/>有outlook邮箱账号需要你开通"
             + "姓名为:"
             + hm.get("UserName")
             + "<br/>"
             + "邮箱为:"
             + hm.get("Email")
             + "<br/>";
     GlobalFunc.sendEmail(strEmail, strSubject, Sb, 0);
     db.commitConn();
   } catch (Exception e) {
     e.printStackTrace();
     return -1;
   } finally {
     // db.close();
   }
   return 1;
 }
Beispiel #2
0
 public static int disable(int strid) throws ACDException {
   DBUtil db = null;
   try {
     db = DBUtil.getInstance();
     SimpleDateFormat drf = new SimpleDateFormat("yyyy-MM-dd");
     String sql =
         "UPDATE "
             + tableName
             + " SET STATUS=-1,IsDeleted=1,QuitTime='"
             + drf.format(new Date())
             + "'WHERE ID='"
             + strid
             + "'";
     db.execute(sql);
     sql = "DELETE FROM UserWorkExperience WHERE UserID=" + strid;
     db.execute(sql);
     sql = "DELETE FROM UserTrainExperience WHERE UserID=" + strid;
     db.execute(sql);
     sql = "DELETE FROM UserFamily WHERE UserID=" + strid;
     db.execute(sql);
     db.commitConn();
   } catch (Exception e) {
     e.printStackTrace();
     return -1;
   } finally {
     // db.close();
   }
   return 1;
 }
Beispiel #3
0
  /*
    change a user's password
  */
  public static int changePassword(String id, String pwd) throws Exception {
    DBUtil db = null;
    try {
      db = DBUtil.getInstance();
      db.setConnectionAttr(false);

      String sql = "update SeastarUsers set PASSWORD = ? where ID = ? ";
      db.execute(sql, new String[] {pwd, id});

      sql = "insert into SeastarUsersPW (Password, UserID) values (?,?)";
      db.execute(sql, new String[] {pwd, id});

      db.commitConn();

    } catch (Exception e) {
      System.out.print(e.getMessage());
      db.rollBackConn();
      return 0;
    } finally {
      // db.close();
    }
    return 1;
  }
  /** 保存记录 */
  @SuppressWarnings("unchecked")
  public Integer saveDetails(
      String overFlowReason,
      String userId,
      String deptId,
      String applyDate,
      Double fee,
      String presentType,
      String json,
      String isDevide)
      throws Exception {
    ObjectMapper objectMapper = new ObjectMapper();
    JsonParser parser = objectMapper.getJsonFactory().createJsonParser(json);
    JsonNode nodes = parser.readValueAsTree();
    List<HashMap<String, String>> list = new ArrayList<HashMap<String, String>>(nodes.size());

    for (JsonNode node : nodes) {
      list.add(objectMapper.readValue(node, HashMap.class));
    }

    Integer result = 0;
    DBUtil db = DBUtil.getInstance();
    db.setConnectionAttr(false);

    try {
      // 创建工作流及主记录 DPA(department present apply)部门礼品申请
      HashMap<String, String> map = new HashMap<String, String>();
      Calendar calendar = Calendar.getInstance();
      SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
      map.put("DeptId", deptId);
      map.put("CreateTime", format.format(calendar.getTime()));
      map.put("Status", "0");
      map.put("OverFlowReason", overFlowReason);
      map.put("TotalPrice", String.valueOf(fee));
      map.put("ApplyUserID", userId);
      map.put("PresentType", presentType);
      // map.put("IsDevide", isDevide);
      String orderCode = WorkFlowManager.saveNewWorkFlow(db, map, "PresentWorkFlow", "DPA", "32");
      // 创建明细记录
      for (HashMap<String, String> tempMap : list) {
        String sql =
            " insert into PresentDetail(OrderCode,PresentName,PresentPrice,Count,ApplyReason) values('"
                + orderCode
                + "','"
                + tempMap.get("presentName")
                + "',"
                + tempMap.get("presentPrice")
                + ","
                + tempMap.get("quantity")
                + ",'"
                + tempMap.get("reason")
                + "')";
        db.execute(sql);
      }
      result = 1;
      db.commitConn();
    } catch (Throwable e) {
      e.printStackTrace();
      db.rollBackConn();
    }

    return result;
  }