Explorar el Código

complete version

Mexi hace 6 años
padre
commit
63ee7e6019

+ 51
- 51
.idea/workspace.xml Ver fichero

@@ -2,20 +2,8 @@
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4 4
     <list default="true" id="86492085-3833-4394-8353-122bd8bc6cb0" name="Default" comment="">
5
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_springframework_spring_context_5_0_7_RELEASE2.xml" afterDir="false" />
6
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_springframework_spring_core_5_0_7_RELEASE2.xml" afterDir="false" />
7
-      <change afterPath="$PROJECT_DIR$/.idea/libraries/Maven__org_springframework_spring_jdbc_5_0_7_RELEASE2.xml" afterDir="false" />
8
-      <change beforePath="$PROJECT_DIR$/.idea/misc.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/misc.xml" afterDir="false" />
9
-      <change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
10 5
       <change beforePath="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/ConductTransactions.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/ConductTransactions.java" afterDir="false" />
11
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/TransactionController.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/TransactionController.java" afterDir="false" />
12
-      <change beforePath="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Transactions.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Transactions.java" afterDir="false" />
13
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/controller/ConductTransactions.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/controller/ConductTransactions.class" afterDir="false" />
14
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/controller/TransactionController.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/controller/TransactionController.class" afterDir="false" />
15
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/model/Block.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/model/Block.class" afterDir="false" />
16
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/model/BlockchainVerification.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/model/BlockchainVerification.class" afterDir="false" />
17
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/utility/Encryption.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/utility/Encryption.class" afterDir="false" />
18
-      <change beforePath="$PROJECT_DIR$/target/classes/com/buecoin01/utility/Mining.class" beforeDir="false" afterPath="$PROJECT_DIR$/target/classes/com/buecoin01/utility/Mining.class" afterDir="false" />
6
+      <change beforePath="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java" beforeDir="false" afterPath="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java" afterDir="false" />
19 7
     </list>
20 8
     <ignored path="$PROJECT_DIR$/target/" />
21 9
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
@@ -86,8 +74,17 @@
86 74
       <file leaf-file-name="ConductTransactions.java" pinned="false" current-in-tab="true">
87 75
         <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/controller/ConductTransactions.java">
88 76
           <provider selected="true" editor-type-id="text-editor">
89
-            <state relative-caret-position="339">
90
-              <caret line="50" column="23" selection-start-line="50" selection-start-column="23" selection-end-line="50" selection-end-column="23" />
77
+            <state relative-caret-position="260">
78
+              <caret line="41" column="39" selection-start-line="41" selection-start-column="39" selection-end-line="41" selection-end-column="39" />
79
+            </state>
80
+          </provider>
81
+        </entry>
82
+      </file>
83
+      <file leaf-file-name="CrudRepository.class" pinned="false" current-in-tab="false">
84
+        <entry file="jar://$MAVEN_REPOSITORY$/org/springframework/data/spring-data-commons/2.0.8.RELEASE/spring-data-commons-2.0.8.RELEASE.jar!/org/springframework/data/repository/CrudRepository.class">
85
+          <provider selected="true" editor-type-id="text-editor">
86
+            <state relative-caret-position="120">
87
+              <caret line="11" column="20" selection-start-line="11" selection-start-column="20" selection-end-line="11" selection-end-column="20" />
91 88
             </state>
92 89
           </provider>
93 90
         </entry>
@@ -104,8 +101,8 @@
104 101
       <file leaf-file-name="Wallet.java" pinned="false" current-in-tab="false">
105 102
         <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java">
106 103
           <provider selected="true" editor-type-id="text-editor">
107
-            <state relative-caret-position="270">
108
-              <caret line="20" column="26" lean-forward="true" selection-start-line="20" selection-start-column="26" selection-end-line="20" selection-end-column="26" />
104
+            <state relative-caret-position="255">
105
+              <caret line="19" column="4" selection-start-line="19" selection-start-column="4" selection-end-line="19" selection-end-column="4" />
109 106
             </state>
110 107
           </provider>
111 108
         </entry>
@@ -113,11 +110,8 @@
113 110
       <file leaf-file-name="WalletRepository.java" pinned="false" current-in-tab="false">
114 111
         <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/Repositories/WalletRepository.java">
115 112
           <provider selected="true" editor-type-id="text-editor">
116
-            <state relative-caret-position="120">
117
-              <caret line="20" selection-start-line="20" selection-end-line="20" />
118
-              <folding>
119
-                <element signature="imports" expanded="true" />
120
-              </folding>
113
+            <state relative-caret-position="90">
114
+              <caret line="13" column="17" selection-start-line="13" selection-start-column="17" selection-end-line="13" selection-end-column="17" />
121 115
             </state>
122 116
           </provider>
123 117
         </entry>
@@ -160,11 +154,11 @@
160 154
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/Repositories/TransactionRepository.java" />
161 155
         <option value="$PROJECT_DIR$/src/main/resources/application.properties" />
162 156
         <option value="$APPLICATION_CONFIG_DIR$/consoles/db/9e5d39f9-b664-4d5a-a0eb-fa8b2386a1ce/console.sql" />
163
-        <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java" />
164 157
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/utility/Encryption.java" />
165 158
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/Repositories/WalletRepository.java" />
166 159
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/TransactionController.java" />
167 160
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Transactions.java" />
161
+        <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java" />
168 162
         <option value="$PROJECT_DIR$/src/main/java/com/buecoin01/controller/ConductTransactions.java" />
169 163
       </list>
170 164
     </option>
@@ -253,6 +247,15 @@
253 247
               <item name="CryptoCoin" type="462c0819:PsiDirectoryNode" />
254 248
               <item name="src" type="462c0819:PsiDirectoryNode" />
255 249
               <item name="main" type="462c0819:PsiDirectoryNode" />
250
+              <item name="java" type="462c0819:PsiDirectoryNode" />
251
+              <item name="buecoin01" type="462c0819:PsiDirectoryNode" />
252
+              <item name="Repositories" type="462c0819:PsiDirectoryNode" />
253
+            </path>
254
+            <path>
255
+              <item name="0.1" type="b2602c69:ProjectViewProjectNode" />
256
+              <item name="CryptoCoin" type="462c0819:PsiDirectoryNode" />
257
+              <item name="src" type="462c0819:PsiDirectoryNode" />
258
+              <item name="main" type="462c0819:PsiDirectoryNode" />
256 259
               <item name="resources" type="462c0819:PsiDirectoryNode" />
257 260
             </path>
258 261
           </expand>
@@ -371,12 +374,12 @@
371 374
       <workItem from="1532357795573" duration="4040000" />
372 375
       <workItem from="1532473422589" duration="716000" />
373 376
       <workItem from="1533219920414" duration="26349000" />
374
-      <workItem from="1533328457998" duration="1829000" />
377
+      <workItem from="1533328457998" duration="3480000" />
375 378
     </task>
376 379
     <servers />
377 380
   </component>
378 381
   <component name="TimeTrackingManager">
379
-    <option name="totallyTimeSpent" value="46671000" />
382
+    <option name="totallyTimeSpent" value="48322000" />
380 383
   </component>
381 384
   <component name="TodoView">
382 385
     <todo-panel id="selected-file">
@@ -473,13 +476,6 @@
473 476
     </breakpoint-manager>
474 477
   </component>
475 478
   <component name="editorHistoryManager">
476
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/model/Block.java">
477
-      <provider selected="true" editor-type-id="text-editor">
478
-        <state relative-caret-position="945">
479
-          <caret line="78" selection-start-line="78" selection-end-line="78" />
480
-        </state>
481
-      </provider>
482
-    </entry>
483 479
     <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/ProcessLoader.java">
484 480
       <provider selected="true" editor-type-id="text-editor">
485 481
         <state relative-caret-position="255">
@@ -705,16 +701,6 @@
705 701
         </state>
706 702
       </provider>
707 703
     </entry>
708
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/Repositories/WalletRepository.java">
709
-      <provider selected="true" editor-type-id="text-editor">
710
-        <state relative-caret-position="120">
711
-          <caret line="20" selection-start-line="20" selection-end-line="20" />
712
-          <folding>
713
-            <element signature="imports" expanded="true" />
714
-          </folding>
715
-        </state>
716
-      </provider>
717
-    </entry>
718 704
     <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/model/Block.java">
719 705
       <provider selected="true" editor-type-id="text-editor">
720 706
         <state relative-caret-position="195">
@@ -739,13 +725,6 @@
739 725
         </state>
740 726
       </provider>
741 727
     </entry>
742
-    <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java">
743
-      <provider selected="true" editor-type-id="text-editor">
744
-        <state relative-caret-position="270">
745
-          <caret line="20" column="26" lean-forward="true" selection-start-line="20" selection-start-column="26" selection-end-line="20" selection-end-column="26" />
746
-        </state>
747
-      </provider>
748
-    </entry>
749 728
     <entry file="jar://$MAVEN_REPOSITORY$/org/springframework/spring-web/5.0.7.RELEASE/spring-web-5.0.7.RELEASE.jar!/org/springframework/http/ResponseEntity.class">
750 729
       <provider selected="true" editor-type-id="text-editor">
751 730
         <state relative-caret-position="154">
@@ -764,6 +743,27 @@
764 743
         </state>
765 744
       </provider>
766 745
     </entry>
746
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/model/Wallet.java">
747
+      <provider selected="true" editor-type-id="text-editor">
748
+        <state relative-caret-position="255">
749
+          <caret line="19" column="4" selection-start-line="19" selection-start-column="4" selection-end-line="19" selection-end-column="4" />
750
+        </state>
751
+      </provider>
752
+    </entry>
753
+    <entry file="jar://$MAVEN_REPOSITORY$/org/springframework/data/spring-data-commons/2.0.8.RELEASE/spring-data-commons-2.0.8.RELEASE.jar!/org/springframework/data/repository/CrudRepository.class">
754
+      <provider selected="true" editor-type-id="text-editor">
755
+        <state relative-caret-position="120">
756
+          <caret line="11" column="20" selection-start-line="11" selection-start-column="20" selection-end-line="11" selection-end-column="20" />
757
+        </state>
758
+      </provider>
759
+    </entry>
760
+    <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/Repositories/WalletRepository.java">
761
+      <provider selected="true" editor-type-id="text-editor">
762
+        <state relative-caret-position="90">
763
+          <caret line="13" column="17" selection-start-line="13" selection-start-column="17" selection-end-line="13" selection-end-column="17" />
764
+        </state>
765
+      </provider>
766
+    </entry>
767 767
     <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/controller/TransactionController.java">
768 768
       <provider selected="true" editor-type-id="text-editor">
769 769
         <state relative-caret-position="283">
@@ -776,8 +776,8 @@
776 776
     </entry>
777 777
     <entry file="file://$PROJECT_DIR$/src/main/java/com/buecoin01/controller/ConductTransactions.java">
778 778
       <provider selected="true" editor-type-id="text-editor">
779
-        <state relative-caret-position="339">
780
-          <caret line="50" column="23" selection-start-line="50" selection-start-column="23" selection-end-line="50" selection-end-column="23" />
779
+        <state relative-caret-position="260">
780
+          <caret line="41" column="39" selection-start-line="41" selection-start-column="39" selection-end-line="41" selection-end-column="39" />
781 781
         </state>
782 782
       </provider>
783 783
     </entry>

+ 6
- 5
src/main/java/com/buecoin01/controller/ConductTransactions.java Ver fichero

@@ -27,18 +27,19 @@ public class ConductTransactions {
27 27
     private static final Logger logger = LoggerFactory.getLogger(ConductTransactions.class);
28 28
 
29 29
 
30
+
30 31
     public ResponseEntity transferMoney( Transactions transaction) {
31
-       Wallet receiver = new Wallet();
32
+       Wallet receiver = walletRepository.findWalletByPublicId(transaction.getToId()).get(0);
32 33
 
33
-        Wallet sender = new Wallet();
34
+        Wallet sender = walletRepository.findWalletByPublicId(transaction.getFromId()).get(0);
34 35
 
35
-           if (walletRepository.findWalletByPublicId(transaction.getFromId()).get(0).getAmount() >= transaction.getAmount()) {
36
+           if (sender.getAmount() >= transaction.getAmount()) {
36 37
 
37 38
         logger.info("controller is hitting this method");
38
-               sender.setAmount(walletRepository.findWalletByPublicId(transaction.getFromId()).get(0).getAmount() - transaction.getAmount());
39
+               sender.setAmount(sender.getAmount() - transaction.getAmount());
39 40
                walletRepository.save(sender);
40 41
 
41
-               Double amount = walletRepository.findWalletByPublicId(transaction.getToId()).get(0).getAmount();
42
+               Double amount = receiver.getAmount();
42 43
 
43 44
                receiver.setAmount(amount + transaction.getAmount());
44 45
                walletRepository.save(receiver);

+ 0
- 2
src/main/java/com/buecoin01/model/Wallet.java Ver fichero

@@ -16,9 +16,7 @@ public class Wallet {
16 16
     private long id;
17 17
     @Column(name = "pubicId", unique = true)
18 18
     private String publicId;
19
-    @Column(name = "amount")
20 19
     private double amount;
21
-    @Column(name = "name")
22 20
     private String name;
23 21
 
24 22
 

BIN
target/classes/com/buecoin01/controller/ConductTransactions.class Ver fichero


BIN
target/classes/com/buecoin01/model/Wallet.class Ver fichero