Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
141
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. BufferedWriter writer = new BufferedWriter(new FileWriter("reklama", true));
  2. writer.append("id_reklamy,id_produktu,data_rozpoczecia,data_zakonczenia,rodzaj,rabat_lub_ekspozycja\n");
  3. for(int i = 5000; i < 5000 + 5000; i++){
  4.  
  5. writer.append(String.valueOf(i));
  6. writer.append(",");
  7.  
  8. writer.append(String.valueOf(i));
  9. writer.append(",");
  10.  
  11. writer.append("9");
  12. writer.append(String.valueOf(i % 10));
  13. writer.append("/0");
  14. writer.append(String.valueOf(i % 9 + 1));
  15. writer.append("/");
  16. writer.append(zeroJedenDwa(i));
  17. writer.append(String.valueOf(i % 9 + 1));
  18. writer.append(" ");
  19. writer.append(String.valueOf(i % 12 + 10));
  20. writer.append(":");
  21. writer.append(String.valueOf(i % 49 + 10));
  22. writer.append(":");
  23. writer.append(String.valueOf(i % 49 + 10));
  24. writer.append(",");
  25.  
  26. writer.append("9");
  27. writer.append(String.valueOf(i % 9 + 1));
  28. writer.append("/0");
  29. writer.append(String.valueOf(i % 9 + 1));
  30. writer.append("/");
  31. writer.append(zeroJedenDwa(i));
  32. writer.append(String.valueOf(i % 9 + 1));
  33. writer.append(" ");
  34. writer.append(String.valueOf(i % 12 + 10));
  35. writer.append(":");
  36. writer.append(String.valueOf(i % 49 + 10));
  37. writer.append(":");
  38. writer.append(String.valueOf(i % 49 + 10));
  39. writer.append(",");
  40.  
  41. writer.append(rodzajReklamy(i));
  42. writer.append(",");
  43.  
  44. writer.append(String.valueOf(i%10));
  45. writer.append("\n");
  46. }
  47.  
  48. writer = new BufferedWriter(new FileWriter("produkt", true));
  49. writer.append("id_produktu,cena,marka,model,producent,kategoria,rodzaj_produktu,opis,marza\n");
  50. for(int i = 5000; i < 15000; i++){
  51. writer.append(String.valueOf(i));
  52. writer.append(",");
  53.  
  54. writer.append(String.valueOf(i % 100 + 400));
  55. writer.append(",");
  56.  
  57. writer.append("marka" + i % 100 + ",");
  58. writer.append("model" + i % 100 + ",");
  59. writer.append("producent" + i % 100 + ",");
  60. writer.append("kategoria" + i % 100 + ",");
  61. writer.append("rodzaj" + i % 100 + ",");
  62. writer.append("opis" + i % 100 + ",");
  63.  
  64. writer.append(String.valueOf((round(i % 100 +400) * 0.3 * 100)/100));
  65. writer.append("\n");
  66. }
  67. //za tydzień posumowanie i wystawienie ocen
  68. // 9 stycznia ostatnie spotkania
  69. writer = new BufferedWriter(new FileWriter("magazyn", true));
  70. writer.append("id_produktu,id_sklepu,ilosc_sztuk,czas\n");
  71. for(int i = 5000; i < 15000; i++){
  72. writer.append(String.valueOf(i));
  73. writer.append(",");
  74. writer.append(String.valueOf(i % 100 + 200));
  75. writer.append(",");
  76. writer.append(String.valueOf((i % 10) * 1000));
  77. writer.append(",");
  78.  
  79. writer.append("9");
  80. writer.append(String.valueOf(i % 10));
  81. writer.append("/0");
  82. writer.append(String.valueOf(i % 9 + 1));
  83. writer.append("/");
  84. writer.append(zeroJedenDwa(i));
  85. writer.append(String.valueOf(i % 9 + 1));
  86. writer.append(" ");
  87. writer.append(String.valueOf(i % 12 + 10));
  88. writer.append(":");
  89. writer.append(String.valueOf(i % 49 + 10));
  90. writer.append(":");
  91. writer.append(String.valueOf(i % 49 + 10));
  92.  
  93. writer.append("\n");
  94. }
  95.  
  96. writer = new BufferedWriter(new FileWriter("sprzedaz", true));
  97. writer.append("id_sprzedazy,id_sklepu,data,rodzaj\n");
  98. for(int i = 20000000; i < 20000000 + 25000000; i++){
  99. writer.append(String.valueOf(i));
  100. writer.append(",");
  101.  
  102. writer.append(String.valueOf(i % 100 + 200));
  103. writer.append(",");
  104.  
  105. writer.append("9");
  106. writer.append(String.valueOf(i % 10));
  107. writer.append("/0");
  108. writer.append(String.valueOf(i % 9 + 1));
  109. writer.append("/");
  110. writer.append(zeroJedenDwa(i));
  111. writer.append(String.valueOf(i % 9 + 1));
  112. writer.append(" ");
  113. writer.append(String.valueOf(i % 12 + 10));
  114. writer.append(":");
  115. writer.append(String.valueOf(i % 49 + 10));
  116. writer.append(":");
  117. writer.append(String.valueOf(i % 49 + 10));
  118. writer.append(",");
  119. writer.append(rodzaj(i));
  120. writer.append("\n");
  121. }
  122.  
  123.  
  124. writer = new BufferedWriter(new FileWriter("zakup_produkt", true));
  125. writer.append("id_produktu,id_sprzedazy,ilosc\n");
  126. for(int i = 5000, j = 20000000; j < 20000000 + 25000000; i++, j++){
  127. if(i == 15000){
  128. i = 5000;
  129. }
  130. writer.append(String.valueOf(i));
  131. writer.append(",");
  132. writer.append(String.valueOf(j));
  133. writer.append(",");
  134. writer.append("10");
  135. writer.append("\n");
  136. }
  137. writer.close();
  138.  
  139.  
  140. writer = new BufferedWriter(new FileWriter("reklamacja", true));
  141. writer.append("id_produktu,id_sprzedazy,data,ilosc\n");
  142. for(int i = 5000, j = 20000000; j < 20000000 + 25000000; i++, j++){
  143. if(i == 15000){
  144. i = 5000;
  145. }
  146. if(i%3 == 0) {
  147. writer.append(String.valueOf(i));
  148. writer.append(",");
  149. writer.append(String.valueOf(j));
  150. writer.append(",");
  151.  
  152. writer.append("9");
  153. writer.append(String.valueOf(i % 10));
  154. writer.append("/0");
  155. writer.append(String.valueOf(i % 9 + 1));
  156. writer.append("/");
  157. writer.append(zeroJedenDwa(i));
  158. writer.append(String.valueOf(i % 9 + 1));
  159. writer.append(" ");
  160. writer.append(String.valueOf(i % 12 + 10));
  161. writer.append(":");
  162. writer.append(String.valueOf(i % 49 + 10));
  163. writer.append(":");
  164. writer.append(String.valueOf(i % 49 + 10));
  165.  
  166. writer.append(",");
  167. writer.append("1");
  168. writer.append("\n");
  169. }
  170. }
  171. writer.close();
  172. //
  173. //zaimplementować staging area w oraclu, zaimplementować pierwszy etap etl'a w ramach procedur lub funckji zaimplementować ładowanie z baz wejściowych
  174. // eliminować niespójności, przeliczanie walut, zaimplementować w sql hurtownie danych, gdzie będą tabele z faktami i wymiary, dociągnąć dokumentację.
  175. }
  176.  
  177. static int j = 0;
  178. private static String rodzajReklamy(int i) {
  179. j++;
  180. if(j % 2 == 1){
  181. return "promocja";
  182. // }else if(j % 5 == 2){
  183. // return "kampania internetowa";
  184. // }else if(j % 5 == 3){
  185. // return "miejsce na wystawie";
  186. // }else if(j % 5 == 4){
  187. // return "drugi produkt -50%";
  188. }else{
  189. return "ekspozycja";
  190. }
  191. }
  192.  
  193. private static String zeroJedenDwa(int i) {
  194. if(i % 3 == 1){
  195. return "1";
  196. }else if(i % 3 == 2){
  197. return "2";
  198. }else{
  199. return "0";
  200. }
  201. }
  202.  
  203. private static String wolnyDzien(int i) {
  204. if(i % 400 == 0){
  205. return "tak";
  206. }else{
  207. return "nie";
  208. }
  209. }
  210.  
  211. private static String rodzaj(int i) {
  212. if(i % 3 == 1){
  213. return "karta";
  214. }else if( i % 3 == 2){
  215. return "gotowka";
  216. }else{
  217. return "kredyt";
  218. }
  219. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement