Browse Source

#发电量关联查询

zhongwei
yang_shj 9 months ago
parent
commit
8248a9ecee
  1. 24
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

24
hzims-service/operational/src/main/java/com/hnac/hzims/operational/fill/service/impl/GenerateServiceImpl.java

@ -284,20 +284,16 @@ public class GenerateServiceImpl extends BaseServiceImpl<GenerateMapper, Generat
*/ */
private List<String> days(Date date) { private List<String> days(Date date) {
List<String> list = new ArrayList<>(); List<String> list = new ArrayList<>();
// 结束日期 Calendar calendar = Calendar.getInstance();
Calendar endCal = Calendar.getInstance(); calendar.add(Calendar.MONTH, 1);
endCal.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DAY_OF_MONTH) + 1);
endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + 1); Date end = calendar.getTime();
endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1); calendar.add(Calendar.MONTH, -1);
Date start = calendar.getTime();
// 开始日期 while (start.compareTo(end) < 0){
Calendar startCal = Calendar.getInstance(); list.add(DateUtil.format(start,DateUtil.PATTERN_DATE));
startCal.setTime(new Date()); calendar.add(Calendar.DAY_OF_MONTH, 1);
startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1); start = calendar.getTime();
// 获取日期之间的月份
while (endCal.after(startCal)) {
list.add(DateUtil.format(startCal.getTime(),DateUtil.PATTERN_DATE));
startCal.add(Calendar.DAY_OF_MONTH, 1);
} }
return list; return list;
} }

Loading…
Cancel
Save