|
@@ -2,6 +2,9 @@ package org.jeecg.modules.hlwpayment.controller;
|
|
|
|
|
|
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
|
|
+import java.time.ZoneId;
|
|
|
|
|
+import java.time.ZonedDateTime;
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
import java.util.stream.Collectors;
|
|
|
import java.io.IOException;
|
|
import java.io.IOException;
|
|
@@ -33,6 +36,7 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.modules.hlwuser.entity.HlwUser;
|
|
import org.jeecg.modules.hlwuser.entity.HlwUser;
|
|
|
import org.jeecg.modules.hlwuser.mapper.HlwUserMapper;
|
|
import org.jeecg.modules.hlwuser.mapper.HlwUserMapper;
|
|
|
import org.jeecg.modules.hlwuser.service.IHlwUserService;
|
|
import org.jeecg.modules.hlwuser.service.IHlwUserService;
|
|
|
|
|
+import org.jeecg.modules.utils.DateUtils;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -323,25 +327,17 @@ public class HlwPaymentDetailController extends JeecgController<HlwPaymentDetail
|
|
|
list.add(weekPayment);
|
|
list.add(weekPayment);
|
|
|
list.add(monthPayment);
|
|
list.add(monthPayment);
|
|
|
list.add(yearPayment);
|
|
list.add(yearPayment);
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
|
|
- int day = cal.get(Calendar.DATE);
|
|
|
|
|
- int month = cal.get(Calendar.MONTH) + 1;
|
|
|
|
|
- int year = cal.get(Calendar.YEAR);
|
|
|
|
|
//存放图表所需年月+付款数据
|
|
//存放图表所需年月+付款数据
|
|
|
List<Map> list1 = new ArrayList<>();
|
|
List<Map> list1 = new ArrayList<>();
|
|
|
|
|
+ //当天时间
|
|
|
|
|
+ LocalDate localDate = LocalDate.now();
|
|
|
|
|
+ //前一个月开始倒推6个月
|
|
|
for (int i = 0; i < 6; i++) {
|
|
for (int i = 0; i < 6; i++) {
|
|
|
Map map = new HashMap();
|
|
Map map = new HashMap();
|
|
|
- if (month == 1) {
|
|
|
|
|
- month = 12;
|
|
|
|
|
- year = year - 1;
|
|
|
|
|
- } else {
|
|
|
|
|
- month = month - 1;
|
|
|
|
|
- }
|
|
|
|
|
- String date = year + "-" + (month < 10 ? "0" + month : month) + "-" + day;
|
|
|
|
|
- SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
- Double monthPayment1 = hlwPaymentDetailService.monthPayment(sdf.parse(date));
|
|
|
|
|
|
|
+ LocalDate lastDate = localDate.minusMonths(i + 1);
|
|
|
|
|
+ Double monthPayment1 = hlwPaymentDetailService.monthPayment(DateUtils.asDate(lastDate));
|
|
|
map.put("value", monthPayment1);
|
|
map.put("value", monthPayment1);
|
|
|
- map.put("x", year + "-" + (month < 10 ? "0" + month : month));
|
|
|
|
|
|
|
+ map.put("x", lastDate.toString().substring(0, 7));
|
|
|
list1.add(0, map);
|
|
list1.add(0, map);
|
|
|
}
|
|
}
|
|
|
list.add(list1);
|
|
list.add(list1);
|
|
@@ -458,5 +454,8 @@ public class HlwPaymentDetailController extends JeecgController<HlwPaymentDetail
|
|
|
return Result.ok(list);
|
|
return Result.ok(list);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+ private static Date localDate2Date(LocalDate localDate) {
|
|
|
|
|
+ ZonedDateTime zonedDateTime = localDate.atStartOfDay(ZoneId.systemDefault());
|
|
|
|
|
+ return Date.from(zonedDateTime.toInstant());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|