1. Список говнокодов пользователя qw0

    Всего: 1

  2. Java / Говнокод #16736

    +73

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    String getFindList(StringBuffer sb, String[] src) {
    // int tid = Helper.parseType(src[2]);
    // if(tid < 1 || tid > 99) return "Error parse good type";
    int stk = Helper.parseType(src[3]);
    if(stk < 412 || stk > 416)	return "Error parse stock code";
    // --------------------------------------------------------
    IntHashtable work = new IntHashtable();
    double[] vals = null;
    Entry ent = null;
    Enumeration e=cache.getEntryElements();
    while(e.hasMoreElements()) {
    ent = (Entry)e.nextElement();
    if(ent.Credit != stk)	continue;
    if(ent.Status == 0)	continue;
    vals = (double[])work.get(ent.SubCred);
    if(vals == null) {
    vals = new double[2];
    vals[0] = ent.Value;
    work.put(ent.SubCred, vals);
    } else
    vals[0]+=ent.Value;
    }
    // ---------------------------------------------------------
    String s="SELECT  ... ";
    int id;
    String cod, gnm, uni;
    double amt,val,pack,vlr;
    double[] prcs = new double[4];
    Connection con = cache.getConnection();
    if(con == null)	return "No free conection";
    try {
    Statement stmt = con.createStatement();
    ResultSet rset = stmt.executeQuery(s);
    while(rset.next()) {
    id = rset.getInt("id");
    cod = rset.getString("code");
    gnm = rset.getString("name");
    uni = rset.getString("unit");
    pack = rset.getDouble("pack");
    amt = rset.getDouble("amount");
    val = rset.getDouble("value");
    prcs[0] = rset.getDouble("price");
    prcs[1] = rset.getDouble("price1");
    prcs[1]=(prcs[1] < 0.01) ? prcs[0] : prcs[1];
    prcs[2] = rset.getDouble("price2");
    prcs[2]=(prcs[2] < 0.01) ? prcs[1] : prcs[2];
    prcs[3] = rset.getDouble("sprice");
    prcs[3]=(prcs[3] < 0.01) ? prcs[2] : prcs[3];
    vals = (double[])work.get(id);
    vlr =(vals == null) ? 0 : vals[0];
    sb.append(id+",'"+gnm+"','"+cod+"','"+uni+"',"+pack+","+val+","+vlr+",");
    for(int i=0; i<prcs.length; i++)	sb.append(prcs[i]+",");
    sb.append((amt/val)+",\n");
    }
    rset.close();
    stmt.close();
    s = null;
    } catch (SQLException ex) {
    s=ex.getMessage();
    }
    cache.freeConnection(con);
    return s;
    }

    qw0, 21 Сентября 2014

    Комментарии (0)