|
@@ -41,7 +41,7 @@ public class ReportSingleDBOpertor {
|
41
|
41
|
* @return
|
42
|
42
|
*/
|
43
|
43
|
public ArrayList<NewChartData> getWeekTabData(HashMap<String, Integer> maps, int type) {
|
44
|
|
- if(maps==null){
|
|
44
|
+ if (maps == null) {
|
45
|
45
|
return null;
|
46
|
46
|
}
|
47
|
47
|
int startYear = maps.get("startYear");
|
|
@@ -150,7 +150,7 @@ public class ReportSingleDBOpertor {
|
150
|
150
|
* @param categoryDaoOperator
|
151
|
151
|
* @return
|
152
|
152
|
*/
|
153
|
|
- public NewCategoryJson getWeekNewCategoryJson(ArrayList<String> datasLists, CategoryDaoOperator categoryDaoOperator, int category_id,int type) {
|
|
153
|
+ public NewCategoryJson getWeekNewCategoryJson(ArrayList<String> datasLists, CategoryDaoOperator categoryDaoOperator, int category_id, int type) {
|
154
|
154
|
NewCategoryJson newCategoryJson = new NewCategoryJson();
|
155
|
155
|
ArrayList<TypeDataJson> typeDataJsonLists = new ArrayList<>();
|
156
|
156
|
ArrayList<TimeDataJson> timeDataJsonsLists = new ArrayList<>();
|
|
@@ -161,7 +161,7 @@ public class ReportSingleDBOpertor {
|
161
|
161
|
int year = Integer.parseInt(split[0]);
|
162
|
162
|
int month = Integer.parseInt(split[1]);
|
163
|
163
|
int day = Integer.parseInt(split[2]);
|
164
|
|
- ArrayList<CategoryDB> weekData = categoryDaoOperator.getWeekData(year, month, day, type,category_id);
|
|
164
|
+ ArrayList<CategoryDB> weekData = categoryDaoOperator.getWeekData(year, month, day, type, category_id);
|
165
|
165
|
if (category_id != -1) {
|
166
|
166
|
detialDataLists.addAll(changJson(weekData, category_id));
|
167
|
167
|
} else {
|
|
@@ -179,7 +179,7 @@ public class ReportSingleDBOpertor {
|
179
|
179
|
account += Double.parseDouble(typeDataJson.getAccount());
|
180
|
180
|
}
|
181
|
181
|
newCategoryJson.setAccount(account + "");
|
182
|
|
- newCategoryJson.setCategory(typeDataJsonLists);
|
|
182
|
+ newCategoryJson.setCategory(categLists);
|
183
|
183
|
} else {
|
184
|
184
|
double account = 0;
|
185
|
185
|
for (TypeDataJson typeDataJson : detialDataLists) {
|
|
@@ -202,20 +202,20 @@ public class ReportSingleDBOpertor {
|
202
|
202
|
* @param categoryDaoOperator
|
203
|
203
|
* @return
|
204
|
204
|
*/
|
205
|
|
- public NewCategoryJson getMonthNewCategoryJson(int year, int month, CategoryDaoOperator categoryDaoOperator,int type, int category_id) {
|
|
205
|
+ public NewCategoryJson getMonthNewCategoryJson(int year, int month, CategoryDaoOperator categoryDaoOperator, int type, int category_id) {
|
206
|
206
|
|
207
|
207
|
NewCategoryJson newCategoryJson = new NewCategoryJson();
|
208
|
208
|
ArrayList<TypeDataJson> typeDataJsonLists = new ArrayList<>();
|
209
|
209
|
ArrayList<TimeDataJson> timeDataJsonsLists = new ArrayList<>();
|
210
|
210
|
ArrayList<TypeDataJson> detialDataLists = new ArrayList<>();
|
211
|
|
- ArrayList<CategoryDB> weekData = categoryDaoOperator.getMonthData(year, month, type,category_id);
|
|
211
|
+ ArrayList<CategoryDB> weekData = categoryDaoOperator.getMonthData(year, month, type, category_id);
|
212
|
212
|
if (category_id == -1)
|
213
|
213
|
typeDataJsonLists.addAll(changJson(weekData));
|
214
|
214
|
else
|
215
|
215
|
detialDataLists.addAll(changJson(weekData, category_id));
|
216
|
216
|
int monthDay = CalanderUtil.getMonthDay(year, month);
|
217
|
217
|
for (int i = 1; i <= monthDay; i++) {
|
218
|
|
- TimeDataJson timeDataJson = getMonthTimeDataJson(year, month, i, categoryDaoOperator, category_id,type);
|
|
218
|
+ TimeDataJson timeDataJson = getMonthTimeDataJson(year, month, i, categoryDaoOperator, category_id, type);
|
219
|
219
|
if (timeDataJson != null) {
|
220
|
220
|
timeDataJsonsLists.add(timeDataJson);
|
221
|
221
|
}
|
|
@@ -227,7 +227,7 @@ public class ReportSingleDBOpertor {
|
227
|
227
|
account += Double.parseDouble(typeDataJson.getAccount());
|
228
|
228
|
}
|
229
|
229
|
newCategoryJson.setAccount(account + "");
|
230
|
|
- newCategoryJson.setCategory(typeDataJsonLists);
|
|
230
|
+ newCategoryJson.setCategory(categLists);
|
231
|
231
|
} else {
|
232
|
232
|
double account = 0;
|
233
|
233
|
for (TypeDataJson typeDataJson : detialDataLists) {
|
|
@@ -249,18 +249,18 @@ public class ReportSingleDBOpertor {
|
249
|
249
|
* @param categoryDaoOperator
|
250
|
250
|
* @return
|
251
|
251
|
*/
|
252
|
|
- public NewCategoryJson getYearNewCategoryJson(int year, CategoryDaoOperator categoryDaoOperator,int type, int category_id) {
|
|
252
|
+ public NewCategoryJson getYearNewCategoryJson(int year, CategoryDaoOperator categoryDaoOperator, int type, int category_id) {
|
253
|
253
|
NewCategoryJson newCategoryJson = new NewCategoryJson();
|
254
|
254
|
ArrayList<TypeDataJson> typeDataJsonLists = new ArrayList<>();
|
255
|
255
|
ArrayList<TypeDataJson> detialDataLists = new ArrayList<>();
|
256
|
256
|
ArrayList<TimeDataJson> timeDataJsonsLists = new ArrayList<>();
|
257
|
|
- ArrayList<CategoryDB> weekData = categoryDaoOperator.getYearData(year,type, category_id);
|
|
257
|
+ ArrayList<CategoryDB> weekData = categoryDaoOperator.getYearData(year, type, category_id);
|
258
|
258
|
if (category_id == -1)
|
259
|
259
|
typeDataJsonLists.addAll(changJson(weekData));
|
260
|
260
|
else
|
261
|
261
|
detialDataLists.addAll(changJson(weekData, category_id));
|
262
|
262
|
for (int i = 1; i <= 12; i++) {
|
263
|
|
- TimeDataJson timeDataJson = getYearTimeDataJson(year, i, categoryDaoOperator, type,category_id);
|
|
263
|
+ TimeDataJson timeDataJson = getYearTimeDataJson(year, i, categoryDaoOperator, type, category_id);
|
264
|
264
|
if (timeDataJson != null) {
|
265
|
265
|
timeDataJsonsLists.add(timeDataJson);
|
266
|
266
|
}
|
|
@@ -272,7 +272,7 @@ public class ReportSingleDBOpertor {
|
272
|
272
|
account += Double.parseDouble(typeDataJson.getAccount());
|
273
|
273
|
}
|
274
|
274
|
newCategoryJson.setAccount(account + "");
|
275
|
|
- newCategoryJson.setCategory(typeDataJsonLists);
|
|
275
|
+ newCategoryJson.setCategory(categLists);
|
276
|
276
|
} else {
|
277
|
277
|
double account = 0;
|
278
|
278
|
for (TypeDataJson typeDataJson : detialDataLists) {
|
|
@@ -330,11 +330,11 @@ public class ReportSingleDBOpertor {
|
330
|
330
|
* @param day
|
331
|
331
|
* @return
|
332
|
332
|
*/
|
333
|
|
- private TimeDataJson getMonthTimeDataJson(int year, int month, int day, CategoryDaoOperator categoryDaoOperator, int category_id,int type) {
|
|
333
|
+ private TimeDataJson getMonthTimeDataJson(int year, int month, int day, CategoryDaoOperator categoryDaoOperator, int category_id, int type) {
|
334
|
334
|
TimeDataJson timeDataJson = new TimeDataJson();
|
335
|
335
|
timeDataJson.setDay(String.format("%02d", day) + "");
|
336
|
336
|
ArrayList<PopCharData> data = new ArrayList<>();
|
337
|
|
- ArrayList<CategoryDB> weekData = categoryDaoOperator.getWeekData(year, month, day, type,category_id);
|
|
337
|
+ ArrayList<CategoryDB> weekData = categoryDaoOperator.getWeekData(year, month, day, type, category_id);
|
338
|
338
|
for (int i = 0; i < weekData.size(); i++) {
|
339
|
339
|
PopCharData typeDataJson = new PopCharData();
|
340
|
340
|
typeDataJson.setCategory_id(weekData.get(i).getCategory_id());
|
|
@@ -366,11 +366,11 @@ public class ReportSingleDBOpertor {
|
366
|
366
|
* @param categoryDaoOperator
|
367
|
367
|
* @return
|
368
|
368
|
*/
|
369
|
|
- private TimeDataJson getYearTimeDataJson(int year, int month, CategoryDaoOperator categoryDaoOperator, int type,int category_id) {
|
|
369
|
+ private TimeDataJson getYearTimeDataJson(int year, int month, CategoryDaoOperator categoryDaoOperator, int type, int category_id) {
|
370
|
370
|
TimeDataJson timeDataJson = new TimeDataJson();
|
371
|
371
|
timeDataJson.setDay(String.format("%02d", month) + "");
|
372
|
372
|
ArrayList<PopCharData> data = new ArrayList<>();
|
373
|
|
- ArrayList<CategoryDB> monthData = categoryDaoOperator.getMonthData(year, month,type, category_id);
|
|
373
|
+ ArrayList<CategoryDB> monthData = categoryDaoOperator.getMonthData(year, month, type, category_id);
|
374
|
374
|
for (int i = 0; i < monthData.size(); i++) {
|
375
|
375
|
PopCharData typeDataJson = new PopCharData();
|
376
|
376
|
typeDataJson.setCategory_id(monthData.get(i).getCategory_id());
|
|
@@ -416,6 +416,8 @@ public class ReportSingleDBOpertor {
|
416
|
416
|
t = new TypeDataJson();
|
417
|
417
|
t.setName(typeDataJson.getName());
|
418
|
418
|
t.setCategory_id(typeDataJson.getCategory_id());
|
|
419
|
+ t.setDetail_icon(typeDataJson.getDetail_icon());
|
|
420
|
+ t.setSmall_icon(typeDataJson.getSmall_icon());
|
419
|
421
|
t.setAccount(typeDataJson.getAccount());
|
420
|
422
|
t.setType(typeDataJson.getType());
|
421
|
423
|
} else {
|
|
@@ -453,6 +455,65 @@ public class ReportSingleDBOpertor {
|
453
|
455
|
}
|
454
|
456
|
|
455
|
457
|
/**
|
|
458
|
+ * 数据归类(最外层的数据)
|
|
459
|
+ *
|
|
460
|
+ * @param list
|
|
461
|
+ * @return
|
|
462
|
+ */
|
|
463
|
+ private ArrayList<TypeDataJson> changJsonNoDetial(ArrayList<CategoryDB> list) {
|
|
464
|
+ ArrayList<TypeDataJson> datas = new ArrayList<>();
|
|
465
|
+ ArrayList<String> idLists = new ArrayList<>();
|
|
466
|
+
|
|
467
|
+ for (int i = 0; i < list.size(); i++) {
|
|
468
|
+ if (!isInLists(list.get(i).getCategory_id() + "", idLists)) {
|
|
469
|
+ idLists.add(list.get(i).getCategory_id() + "");
|
|
470
|
+ }
|
|
471
|
+ }
|
|
472
|
+// for (int i = 0; i < list.size(); i++) {
|
|
473
|
+// TypeDataJson typeDataJson = new TypeDataJson();
|
|
474
|
+// typeDataJson.setBill_id(list.get(i).getBill_id());
|
|
475
|
+// typeDataJson.setCategory_id(list.get(i).getCategory_id());
|
|
476
|
+// typeDataJson.setType(list.get(i).getType());
|
|
477
|
+// typeDataJson.setDetail_icon(list.get(i).getImage_path());
|
|
478
|
+// typeDataJson.setSmall_icon(list.get(i).getImage_path());
|
|
479
|
+// typeDataJson.setName(list.get(i).getName());
|
|
480
|
+// typeDataJson.setAccount(list.get(i).getAccount() + "");
|
|
481
|
+// datas.add(typeDataJson);
|
|
482
|
+// }
|
|
483
|
+
|
|
484
|
+ for (int i = 0; i < idLists.size(); i++) {
|
|
485
|
+ TypeDataJson typeDataJson = new TypeDataJson();
|
|
486
|
+ typeDataJson.setBill_id(list.get(i).getBill_id());
|
|
487
|
+ typeDataJson.setCategory_id(list.get(i).getCategory_id());
|
|
488
|
+ typeDataJson.setType(list.get(i).getType());
|
|
489
|
+ typeDataJson.setDetail_icon(list.get(i).getImage_path());
|
|
490
|
+ typeDataJson.setSmall_icon(list.get(i).getImage_path());
|
|
491
|
+ typeDataJson.setName(list.get(i).getName());
|
|
492
|
+ double account = 0;
|
|
493
|
+ for (CategoryDB categoryDB : list) {
|
|
494
|
+ if (String.valueOf(categoryDB.getCategory_id()).equals(idLists.get(i))) {
|
|
495
|
+ account += categoryDB.getAccount();
|
|
496
|
+ }
|
|
497
|
+ }
|
|
498
|
+ typeDataJson.setAccount(account + "");
|
|
499
|
+ }
|
|
500
|
+ return datas;
|
|
501
|
+ }
|
|
502
|
+
|
|
503
|
+
|
|
504
|
+ private boolean isInLists(String id, ArrayList<String> lists) {
|
|
505
|
+ boolean isIn = false;
|
|
506
|
+ for (String i : lists) {
|
|
507
|
+ if (i.equals(id)) {
|
|
508
|
+ isIn = true;
|
|
509
|
+ break;
|
|
510
|
+ }
|
|
511
|
+ }
|
|
512
|
+ return isIn;
|
|
513
|
+ }
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+ /**
|
456
|
517
|
* 详情页本地数据转化
|
457
|
518
|
*
|
458
|
519
|
* @param list
|
|
@@ -463,7 +524,7 @@ public class ReportSingleDBOpertor {
|
463
|
524
|
ArrayList<TypeDataJson> datas = new ArrayList<>();
|
464
|
525
|
for (int i = 0; i < list.size(); i++) {
|
465
|
526
|
TypeDataJson typeDataJson = new TypeDataJson();
|
466
|
|
- typeDataJson.setBill_id( list.get(i).getBill_id());
|
|
527
|
+ typeDataJson.setBill_id(list.get(i).getBill_id());
|
467
|
528
|
typeDataJson.setDetail_icon(list.get(i).getImage_path());
|
468
|
529
|
typeDataJson.setSmall_icon(list.get(i).getImage_path());
|
469
|
530
|
typeDataJson.setDay(list.get(i).getYear() + "-" + String.format("%02d", list.get(i).getMonth()) + "-" + String.format("%02d", list.get(i).getDay()));
|