|
@@ -71,13 +71,21 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
|
* @return String
|
|
|
*/
|
|
|
public String getLastMonthString(String dateString) throws ParseException {
|
|
|
- SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM");
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-M"); // 数据库中ym字段的值如果是 2024-05的格式就是 yyyy-MM; 如果是2024-5的格式就是yyyy-M
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
calendar.setTime(simpleDateFormat.parse(dateString));
|
|
|
calendar.add(Calendar.MONTH,-1);
|
|
|
return simpleDateFormat.format(calendar.getTime());
|
|
|
}
|
|
|
|
|
|
+ public String getCurronMonthString(String dateString) throws ParseException {
|
|
|
+ SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-M"); // 数据库中ym字段的值如果是 2024-05的格式就是 yyyy-MM; 如果是2024-5的格式就是yyyy-M
|
|
|
+ Calendar calendar = Calendar.getInstance();
|
|
|
+ calendar.setTime(simpleDateFormat.parse(dateString));
|
|
|
+ calendar.add(Calendar.MONTH,0);
|
|
|
+ return simpleDateFormat.format(calendar.getTime());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 接口调用的类 用来获取所有部门的指标、合同额、已收款、完成度,并按完成度排行
|
|
|
*
|
|
@@ -146,7 +154,7 @@ public class IndexKpiServiceImpl implements IndexKpiService {
|
|
|
dateLastYm = String.format("%d-%d", Integer.parseInt(dateString)-1, 12);
|
|
|
}else if(timeType.equals("month")){
|
|
|
isCurrentDate = dateString.equals(currentYm);
|
|
|
- dateYm = dateString;
|
|
|
+ dateYm = getCurronMonthString(dateString);
|
|
|
dateLastYm = getLastMonthString(dateString);
|
|
|
}
|
|
|
}catch (ParseException e){
|