Browse Source

Merge remote-tracking branch 'origin/dev'

dev_shibei_match
yinzuomei 5 years ago
parent
commit
4fff997a0a
  1. 7
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java
  2. 16
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java

7
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/service/evaluationindex/screen/impl/IndexServiceImpl.java

@ -149,7 +149,12 @@ public class IndexServiceImpl implements IndexService {
});
List<MonthBarchartResult> collect = monthBarchartResults.stream().sorted(Comparator.comparing(MonthBarchartResult::getMonthId)).collect(Collectors.toList());
//升序 当前月份在队尾
List<String> _ymList = dateUtils.getXpro().keySet().stream().collect(Collectors.toList());
List<String> _ymList = new ArrayList<>();
if(StringUtils.isNotBlank(monthBarchartFormDTO.getMonthId())){
_ymList=dateUtils.getXproEndMonth(monthBarchartFormDTO.getMonthId()).keySet().stream().collect(Collectors.toList());
}else{
_ymList=dateUtils.getXpro().keySet().stream().collect(Collectors.toList());
}
//针对集合collect的游标
int cursor = NumConstant.ZERO;
//针对X轴,数据集合不全则进行数据填充

16
epmet-module/data-report/data-report-server/src/main/java/com/epmet/datareport/utils/DateUtils.java

@ -75,6 +75,22 @@ public class DateUtils {
return result;
}
public Map<String,String> getXproEndMonth(String monthId){
Map<String,String> xAxis = new HashMap<>();
for(int i=NumConstant.ZERO;i <= NumConstant.ELEVEN; i++){
Calendar c = Calendar.getInstance();
c.setTime(com.epmet.commons.tools.utils.DateUtils.stringToDate(monthId.concat("01"), com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMMDD));
c.add(Calendar.MONTH, - i);
Date date = c.getTime();
String month= com.epmet.commons.tools.utils.DateUtils.format(date, com.epmet.commons.tools.utils.DateUtils.DATE_PATTERN_YYYYMM);
xAxis.put(month,month.substring(4,6).concat("月"));
}
Map<String, String> result = Maps.newLinkedHashMap();
xAxis.entrySet().stream().sorted(Map.Entry.comparingByKey())
.forEachOrdered((e -> result.put(e.getKey(),e.getValue())));
return result;
}
/**
* @Description 得到上个月的monthId
* @param

Loading…
Cancel
Save