Browse Source

Merge branch 'MoneyNote3.0' of http://git.quyaqu.com/xieshengqi/MoneyMoreMoreNote into MoneyNote3.0

e 6 years ago
parent
commit
d408befb3e

+ 6 - 6
MoneyNote_Sqlite/src/main/java/com/kuxuan/sqlite/dao/CategoryDBDao.java

30
         public final static Property Name = new Property(3, String.class, "name", false, "NAME");
30
         public final static Property Name = new Property(3, String.class, "name", false, "NAME");
31
         public final static Property Type = new Property(4, int.class, "type", false, "TYPE");
31
         public final static Property Type = new Property(4, int.class, "type", false, "TYPE");
32
         public final static Property Image_path = new Property(5, String.class, "image_path", false, "IMAGE_PATH");
32
         public final static Property Image_path = new Property(5, String.class, "image_path", false, "IMAGE_PATH");
33
-        public final static Property Account = new Property(6, long.class, "account", false, "ACCOUNT");
33
+        public final static Property Account = new Property(6, double.class, "account", false, "ACCOUNT");
34
         public final static Property Category_id = new Property(7, int.class, "category_id", false, "CATEGORY_ID");
34
         public final static Property Category_id = new Property(7, int.class, "category_id", false, "CATEGORY_ID");
35
         public final static Property Year = new Property(8, int.class, "year", false, "YEAR");
35
         public final static Property Year = new Property(8, int.class, "year", false, "YEAR");
36
         public final static Property Month = new Property(9, int.class, "month", false, "MONTH");
36
         public final static Property Month = new Property(9, int.class, "month", false, "MONTH");
59
                 "\"NAME\" TEXT," + // 3: name
59
                 "\"NAME\" TEXT," + // 3: name
60
                 "\"TYPE\" INTEGER NOT NULL ," + // 4: type
60
                 "\"TYPE\" INTEGER NOT NULL ," + // 4: type
61
                 "\"IMAGE_PATH\" TEXT," + // 5: image_path
61
                 "\"IMAGE_PATH\" TEXT," + // 5: image_path
62
-                "\"ACCOUNT\" INTEGER NOT NULL ," + // 6: account
62
+                "\"ACCOUNT\" REAL NOT NULL ," + // 6: account
63
                 "\"CATEGORY_ID\" INTEGER NOT NULL ," + // 7: category_id
63
                 "\"CATEGORY_ID\" INTEGER NOT NULL ," + // 7: category_id
64
                 "\"YEAR\" INTEGER NOT NULL ," + // 8: year
64
                 "\"YEAR\" INTEGER NOT NULL ," + // 8: year
65
                 "\"MONTH\" INTEGER NOT NULL ," + // 9: month
65
                 "\"MONTH\" INTEGER NOT NULL ," + // 9: month
104
         if (image_path != null) {
104
         if (image_path != null) {
105
             stmt.bindString(6, image_path);
105
             stmt.bindString(6, image_path);
106
         }
106
         }
107
-        stmt.bindLong(7, entity.getAccount());
107
+        stmt.bindDouble(7, entity.getAccount());
108
         stmt.bindLong(8, entity.getCategory_id());
108
         stmt.bindLong(8, entity.getCategory_id());
109
         stmt.bindLong(9, entity.getYear());
109
         stmt.bindLong(9, entity.getYear());
110
         stmt.bindLong(10, entity.getMonth());
110
         stmt.bindLong(10, entity.getMonth());
143
         if (image_path != null) {
143
         if (image_path != null) {
144
             stmt.bindString(6, image_path);
144
             stmt.bindString(6, image_path);
145
         }
145
         }
146
-        stmt.bindLong(7, entity.getAccount());
146
+        stmt.bindDouble(7, entity.getAccount());
147
         stmt.bindLong(8, entity.getCategory_id());
147
         stmt.bindLong(8, entity.getCategory_id());
148
         stmt.bindLong(9, entity.getYear());
148
         stmt.bindLong(9, entity.getYear());
149
         stmt.bindLong(10, entity.getMonth());
149
         stmt.bindLong(10, entity.getMonth());
167
             cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // name
167
             cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3), // name
168
             cursor.getInt(offset + 4), // type
168
             cursor.getInt(offset + 4), // type
169
             cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // image_path
169
             cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5), // image_path
170
-            cursor.getLong(offset + 6), // account
170
+            cursor.getDouble(offset + 6), // account
171
             cursor.getInt(offset + 7), // category_id
171
             cursor.getInt(offset + 7), // category_id
172
             cursor.getInt(offset + 8), // year
172
             cursor.getInt(offset + 8), // year
173
             cursor.getInt(offset + 9), // month
173
             cursor.getInt(offset + 9), // month
187
         entity.setName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
187
         entity.setName(cursor.isNull(offset + 3) ? null : cursor.getString(offset + 3));
188
         entity.setType(cursor.getInt(offset + 4));
188
         entity.setType(cursor.getInt(offset + 4));
189
         entity.setImage_path(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
189
         entity.setImage_path(cursor.isNull(offset + 5) ? null : cursor.getString(offset + 5));
190
-        entity.setAccount(cursor.getLong(offset + 6));
190
+        entity.setAccount(cursor.getDouble(offset + 6));
191
         entity.setCategory_id(cursor.getInt(offset + 7));
191
         entity.setCategory_id(cursor.getInt(offset + 7));
192
         entity.setYear(cursor.getInt(offset + 8));
192
         entity.setYear(cursor.getInt(offset + 8));
193
         entity.setMonth(cursor.getInt(offset + 9));
193
         entity.setMonth(cursor.getInt(offset + 9));

+ 10 - 4
MoneyNote_Sqlite/src/main/java/com/kuxuan/sqlite/db/CategoryDB.java

62
     /**
62
     /**
63
      * 账单金额
63
      * 账单金额
64
      */
64
      */
65
-    private long account;
65
+    private double account;
66
 
66
 
67
     /**
67
     /**
68
      * 类别id
68
      * 类别id
102
 
102
 
103
 
103
 
104
 
104
 
105
-    @Generated(hash = 708261383)
105
+    @Generated(hash = 1427463647)
106
     public CategoryDB(Long id, String bill_id, String demo, String name, int type,
106
     public CategoryDB(Long id, String bill_id, String demo, String name, int type,
107
-            String image_path, long account, int category_id, int year, int month,
107
+            String image_path, double account, int category_id, int year, int month,
108
             int day, long createTime, long updateTime, int user_id) {
108
             int day, long createTime, long updateTime, int user_id) {
109
         this.id = id;
109
         this.id = id;
110
         this.bill_id = bill_id;
110
         this.bill_id = bill_id;
190
 
190
 
191
 
191
 
192
 
192
 
193
-    public long getAccount() {
193
+    public Double getAccount() {
194
         return this.account;
194
         return this.account;
195
     }
195
     }
196
 
196
 
296
         this.image_path = image_path;
296
         this.image_path = image_path;
297
     }
297
     }
298
 
298
 
299
+
300
+
301
+    public void setAccount(double account) {
302
+        this.account = account;
303
+    }
304
+
299
 }
305
 }

+ 3 - 3
app/src/main/java/com/kuxuan/moneynote/db/CategoryDBbean.java

38
     /**
38
     /**
39
      * 账单金额
39
      * 账单金额
40
      */
40
      */
41
-    private long account;
41
+    private double account;
42
 
42
 
43
     /**
43
     /**
44
      * 类别id
44
      * 类别id
124
         this.type = type;
124
         this.type = type;
125
     }
125
     }
126
 
126
 
127
-    public long getAccount() {
127
+    public double getAccount() {
128
         return account;
128
         return account;
129
     }
129
     }
130
 
130
 
131
-    public void setAccount(long account) {
131
+    public void setAccount(double account) {
132
         this.account = account;
132
         this.account = account;
133
     }
133
     }
134
 
134
 

+ 2 - 2
app/src/main/java/com/kuxuan/moneynote/ui/activitys/account/AccountModel.java

107
         categoryDBbean.setDemo(billBody.getDemo());
107
         categoryDBbean.setDemo(billBody.getDemo());
108
         categoryDBbean.setName(name);
108
         categoryDBbean.setName(name);
109
         categoryDBbean.setType_imagepath(BillCategoreDaoOperator.newInstance().getDetaillIconUrlById(Integer.parseInt(billBody.getCategory_id())));
109
         categoryDBbean.setType_imagepath(BillCategoreDaoOperator.newInstance().getDetaillIconUrlById(Integer.parseInt(billBody.getCategory_id())));
110
-        categoryDBbean.setAccount(Long.parseLong(billBody.getAccount()));
110
+        categoryDBbean.setAccount(Double.parseDouble(billBody.getAccount()));
111
         categoryDBbean.setBill_id(bill_id);
111
         categoryDBbean.setBill_id(bill_id);
112
         CategoryDaoOperator.newInstance().updateData(categoryDBbean);
112
         CategoryDaoOperator.newInstance().updateData(categoryDBbean);
113
         listMVPListener.onSuccess(new Object());
113
         listMVPListener.onSuccess(new Object());
137
         categoryDBbean.setDemo(billBody.getDemo());
137
         categoryDBbean.setDemo(billBody.getDemo());
138
         categoryDBbean.setName(name);
138
         categoryDBbean.setName(name);
139
         categoryDBbean.setType_imagepath(BillCategoreDaoOperator.newInstance().getDetaillIconUrlById(Integer.parseInt(billBody.getCategory_id())));
139
         categoryDBbean.setType_imagepath(BillCategoreDaoOperator.newInstance().getDetaillIconUrlById(Integer.parseInt(billBody.getCategory_id())));
140
-        categoryDBbean.setAccount(Long.parseLong(billBody.getAccount()));
140
+        categoryDBbean.setAccount(Double.parseDouble(billBody.getAccount()));
141
         Random random = new Random();
141
         Random random = new Random();
142
         boolean insert = CategoryDaoOperator.newInstance().insert(categoryDBbean, false);
142
         boolean insert = CategoryDaoOperator.newInstance().insert(categoryDBbean, false);
143
         if (insert) {
143
         if (insert) {

+ 1 - 1
app/src/main/java/com/kuxuan/moneynote/ui/activitys/account/AccountPresenter.java

114
 
114
 
115
             @Override
115
             @Override
116
             public void onFail(String msg) {
116
             public void onFail(String msg) {
117
-                view.hideProgress();
117
+                    view.hideProgress();
118
                 view.showMsg(msg);
118
                 view.showMsg(msg);
119
             }
119
             }
120
         }, billBody, name);
120
         }, billBody, name);

+ 4 - 4
app/src/main/java/com/kuxuan/moneynote/ui/fragments/details/DetialDBOpertor.java

86
         } else {
86
         } else {
87
             billData = new BillData();
87
             billData = new BillData();
88
         }
88
         }
89
-        long pay_account = 0;
90
-        long inCome_account = 0;
89
+        double pay_account = 0;
90
+        double inCome_account = 0;
91
         for (TypeDataJson typeDataJson : day_datas) {
91
         for (TypeDataJson typeDataJson : day_datas) {
92
             if (typeDataJson.getType() == 1) {
92
             if (typeDataJson.getType() == 1) {
93
                 //收入
93
                 //收入
94
-                inCome_account += Long.parseLong(typeDataJson.getAccount());
94
+                inCome_account += Double.parseDouble(typeDataJson.getAccount());
95
             } else {
95
             } else {
96
                 //支出
96
                 //支出
97
-                pay_account += Long.parseLong(typeDataJson.getAccount());
97
+                pay_account += Double.parseDouble(typeDataJson.getAccount());
98
             }
98
             }
99
         }
99
         }
100
         billData.setDay_income_account((int) inCome_account);
100
         billData.setDay_income_account((int) inCome_account);

+ 19 - 19
app/src/main/java/com/kuxuan/moneynote/ui/fragments/reportsingle/ReportSingleDBOpertor.java

174
         }
174
         }
175
         if (category_id == -1) {
175
         if (category_id == -1) {
176
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
176
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
177
-            long account = 0;
177
+            double account = 0;
178
             for (TypeDataJson typeDataJson : categLists) {
178
             for (TypeDataJson typeDataJson : categLists) {
179
-                account += Long.parseLong(typeDataJson.getAccount());
179
+                account += Double.parseDouble(typeDataJson.getAccount());
180
             }
180
             }
181
             newCategoryJson.setAccount(account + "");
181
             newCategoryJson.setAccount(account + "");
182
             newCategoryJson.setCategory(typeDataJsonLists);
182
             newCategoryJson.setCategory(typeDataJsonLists);
183
         } else {
183
         } else {
184
-            long account = 0;
184
+            double account = 0;
185
             for (TypeDataJson typeDataJson : detialDataLists) {
185
             for (TypeDataJson typeDataJson : detialDataLists) {
186
-                account += Long.parseLong(typeDataJson.getAccount());
186
+                account += Double.parseDouble(typeDataJson.getAccount());
187
             }
187
             }
188
             newCategoryJson.setAccount(account + "");
188
             newCategoryJson.setAccount(account + "");
189
             newCategoryJson.setDetial_data(detialDataLists);
189
             newCategoryJson.setDetial_data(detialDataLists);
222
         }
222
         }
223
         if (category_id == -1) {
223
         if (category_id == -1) {
224
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
224
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
225
-            long account = 0;
225
+            double account = 0;
226
             for (TypeDataJson typeDataJson : categLists) {
226
             for (TypeDataJson typeDataJson : categLists) {
227
-                account += Long.parseLong(typeDataJson.getAccount());
227
+                account += Double.parseDouble(typeDataJson.getAccount());
228
             }
228
             }
229
             newCategoryJson.setAccount(account + "");
229
             newCategoryJson.setAccount(account + "");
230
             newCategoryJson.setCategory(typeDataJsonLists);
230
             newCategoryJson.setCategory(typeDataJsonLists);
231
         } else {
231
         } else {
232
-            long account = 0;
232
+            double account = 0;
233
             for (TypeDataJson typeDataJson : detialDataLists) {
233
             for (TypeDataJson typeDataJson : detialDataLists) {
234
-                account += Long.parseLong(typeDataJson.getAccount());
234
+                account += Double.parseDouble(typeDataJson.getAccount());
235
             }
235
             }
236
             newCategoryJson.setAccount(account + "");
236
             newCategoryJson.setAccount(account + "");
237
             newCategoryJson.setDetial_data(detialDataLists);
237
             newCategoryJson.setDetial_data(detialDataLists);
267
         }
267
         }
268
         if (category_id == -1) {
268
         if (category_id == -1) {
269
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
269
             ArrayList<TypeDataJson> categLists = getCategLists(typeDataJsonLists);
270
-            long account = 0;
270
+            double account = 0;
271
             for (TypeDataJson typeDataJson : categLists) {
271
             for (TypeDataJson typeDataJson : categLists) {
272
-                account += Long.parseLong(typeDataJson.getAccount());
272
+                account += Double.parseDouble(typeDataJson.getAccount());
273
             }
273
             }
274
             newCategoryJson.setAccount(account + "");
274
             newCategoryJson.setAccount(account + "");
275
             newCategoryJson.setCategory(typeDataJsonLists);
275
             newCategoryJson.setCategory(typeDataJsonLists);
276
         } else {
276
         } else {
277
-            long account = 0;
277
+            double account = 0;
278
             for (TypeDataJson typeDataJson : detialDataLists) {
278
             for (TypeDataJson typeDataJson : detialDataLists) {
279
-                account += Long.parseLong(typeDataJson.getAccount());
279
+                account += Double.parseDouble(typeDataJson.getAccount());
280
             }
280
             }
281
             newCategoryJson.setAccount(account + "");
281
             newCategoryJson.setAccount(account + "");
282
             newCategoryJson.setDetial_data(detialDataLists);
282
             newCategoryJson.setDetial_data(detialDataLists);
309
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", day));
309
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", day));
310
             data.add(typeDataJson);
310
             data.add(typeDataJson);
311
         }
311
         }
312
-        long account = 0;
312
+        double account = 0;
313
         for (PopCharData typeDataJson : data) {
313
         for (PopCharData typeDataJson : data) {
314
-            account += Long.parseLong(typeDataJson.getAccount());
314
+            account += Double.parseDouble(typeDataJson.getAccount());
315
         }
315
         }
316
         timeDataJson.setData(data);
316
         timeDataJson.setData(data);
317
         if (account > 0) {
317
         if (account > 0) {
344
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", day));
344
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", day));
345
             data.add(typeDataJson);
345
             data.add(typeDataJson);
346
         }
346
         }
347
-        long account = 0;
347
+        double account = 0;
348
         for (PopCharData typeDataJson : data) {
348
         for (PopCharData typeDataJson : data) {
349
-            account += Long.parseLong(typeDataJson.getAccount());
349
+            account += Double.parseDouble(typeDataJson.getAccount());
350
         }
350
         }
351
         timeDataJson.setData(data);
351
         timeDataJson.setData(data);
352
         if (account > 0) {
352
         if (account > 0) {
380
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", monthData.get(i).getDay()));
380
             typeDataJson.setTime(year + "/" + String.format("%02d", month) + "/" + String.format("%02d", monthData.get(i).getDay()));
381
             data.add(typeDataJson);
381
             data.add(typeDataJson);
382
         }
382
         }
383
-        long account = 0;
383
+        double account = 0;
384
         for (PopCharData typeDataJson : data) {
384
         for (PopCharData typeDataJson : data) {
385
-            account += Long.parseLong(typeDataJson.getAccount());
385
+            account += Double.parseDouble(typeDataJson.getAccount());
386
         }
386
         }
387
         timeDataJson.setData(data);
387
         timeDataJson.setData(data);
388
         if (account > 0) {
388
         if (account > 0) {
420
                         t.setType(typeDataJson.getType());
420
                         t.setType(typeDataJson.getType());
421
                     } else {
421
                     } else {
422
                         //累加总值
422
                         //累加总值
423
-                        t.setAccount(Long.parseLong(t.getAccount()) + Long.parseLong(typeDataJson.getAccount()) + "");
423
+                        t.setAccount(Double.parseDouble(t.getAccount()) + Double.parseDouble(typeDataJson.getAccount()) + "");
424
                     }
424
                     }
425
                 }
425
                 }
426
             }
426
             }