|
@@ -41,35 +41,27 @@ public class SecSupplyService {
|
|
List<MonthReportEntity> monthReportEntities = monthReportService.findAmountBySceneIds(monthReportEntity);
|
|
List<MonthReportEntity> monthReportEntities = monthReportService.findAmountBySceneIds(monthReportEntity);
|
|
Map<String, Double> maps = new LinkedHashMap<>();
|
|
Map<String, Double> maps = new LinkedHashMap<>();
|
|
for (MonthReportEntity item : monthReportEntities) {
|
|
for (MonthReportEntity item : monthReportEntities) {
|
|
- maps.put(item.getYear() + "-" + String.format("%02d", item.getMonth()) + "-" + String.format("%02d", item.getDay()), item.getLatestValue());
|
|
|
|
|
|
+ maps.put(item.getYear() + "-" + String.format("%02d", item.getMonth()) + "-" + String.format("%02d", item.getDay()), item.getSumValue());
|
|
}
|
|
}
|
|
Calendar begin = Calendar.getInstance();// 得到一个Calendar的实例
|
|
Calendar begin = Calendar.getInstance();// 得到一个Calendar的实例
|
|
begin.setTime(new Date()); // 设置时间为当前时间
|
|
begin.setTime(new Date()); // 设置时间为当前时间
|
|
List<AmountDayThirtyDto> listC = new ArrayList<>();
|
|
List<AmountDayThirtyDto> listC = new ArrayList<>();
|
|
- for (int i = 1; i <= 31; i++) {
|
|
|
|
|
|
+ for (int i = 1; i <= 30; i++) {
|
|
begin.add(Calendar.DATE, -1);// 日期加1
|
|
begin.add(Calendar.DATE, -1);// 日期加1
|
|
Date d = new Date(begin.getTimeInMillis());
|
|
Date d = new Date(begin.getTimeInMillis());
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
|
|
AmountDayThirtyDto amountDayThirtyDto = new AmountDayThirtyDto();
|
|
AmountDayThirtyDto amountDayThirtyDto = new AmountDayThirtyDto();
|
|
if (maps.containsKey(df.format(d).toString())) {
|
|
if (maps.containsKey(df.format(d).toString())) {
|
|
amountDayThirtyDto.setAmountTime(d);
|
|
amountDayThirtyDto.setAmountTime(d);
|
|
- amountDayThirtyDto.setAmount(maps.get(df.format(d)));
|
|
|
|
|
|
+ amountDayThirtyDto.setAmount((double)Math.round(maps.get(df.format(d))*1000)/1000);
|
|
} else {
|
|
} else {
|
|
amountDayThirtyDto.setAmountTime(d);
|
|
amountDayThirtyDto.setAmountTime(d);
|
|
|
|
+ amountDayThirtyDto.setAmount(0d);
|
|
}
|
|
}
|
|
listC.add(amountDayThirtyDto);
|
|
listC.add(amountDayThirtyDto);
|
|
}
|
|
}
|
|
- List<AmountDayThirtyDto> listD = new ArrayList<>();
|
|
|
|
- for (int m = 0; m < 30; m++) {
|
|
|
|
- AmountDayThirtyDto amountDayThirtyDto = new AmountDayThirtyDto();
|
|
|
|
- amountDayThirtyDto.setAmountTime(listC.get(m).getAmountTime());
|
|
|
|
- if (listC.get(m + 1).getAmount() != null && listC.get(m).getAmount() != null)
|
|
|
|
- amountDayThirtyDto.setAmount((double) Math.round((listC.get(m).getAmount() - listC.get(m + 1).getAmount()) * 1000) / 1000);
|
|
|
|
- else
|
|
|
|
- amountDayThirtyDto.setAmount(0d);
|
|
|
|
- listD.add(amountDayThirtyDto);
|
|
|
|
- }
|
|
|
|
- return listD;
|
|
|
|
|
|
+
|
|
|
|
+ return listC;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|