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) {
List<String> list = new ArrayList<>();
// 结束日期
Calendar endCal = Calendar.getInstance();
endCal.setTime(new Date());
endCal.add(Calendar.MONTH, -endCal.get(Calendar.MONTH) + 1);
endCal.add(Calendar.DATE, -endCal.get(Calendar.DATE) + 1);
// 开始日期
Calendar startCal = Calendar.getInstance();
startCal.setTime(new Date());
startCal.add(Calendar.DATE, -startCal.get(Calendar.DATE) + 1);
// 获取日期之间的月份
while (endCal.after(startCal)) {
list.add(DateUtil.format(startCal.getTime(),DateUtil.PATTERN_DATE));
startCal.add(Calendar.DAY_OF_MONTH, 1);
Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, 1);
calendar.add(Calendar.DAY_OF_MONTH, -calendar.get(Calendar.DAY_OF_MONTH) + 1);
Date end = calendar.getTime();
calendar.add(Calendar.MONTH, -1);
Date start = calendar.getTime();
while (start.compareTo(end) < 0){
list.add(DateUtil.format(start,DateUtil.PATTERN_DATE));
calendar.add(Calendar.DAY_OF_MONTH, 1);
start = calendar.getTime();
}
return list;
}

Loading…
Cancel
Save