mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、统计枚举、校验统一使用common模块;2、旧超管统计相关代码移除;
This commit is contained in:
-34
@@ -1,34 +0,0 @@
|
||||
package com.cf.imes.framework.common.enums;
|
||||
|
||||
/**
|
||||
* 生产单统计维度单位
|
||||
* @author Gqr
|
||||
* @since 2024/8/6 10:04
|
||||
*/
|
||||
public enum OrderStatisticsUnit {
|
||||
//季度、月、周、日
|
||||
QUARTER(0),
|
||||
MONTH(1),
|
||||
WEEK(2),
|
||||
DAY(3);
|
||||
|
||||
OrderStatisticsUnit(Integer value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private Integer value;
|
||||
|
||||
public Integer getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
// from value
|
||||
public static OrderStatisticsUnit fromValue(Integer value) {
|
||||
for (OrderStatisticsUnit unit : OrderStatisticsUnit.values()) {
|
||||
if (unit.getValue().equals(value)) {
|
||||
return unit;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+6
-7
@@ -2,7 +2,6 @@ package com.cf.imes.framework.common.util.time;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.cf.imes.framework.common.enums.OrderStatisticsUnit;
|
||||
import com.cf.imes.framework.common.enums.StatisticsUnit;
|
||||
import com.cf.imes.framework.common.pojo.CommonStatisticsReqVO;
|
||||
|
||||
@@ -88,9 +87,9 @@ public class StatisticsChangeUtils {
|
||||
startDate = ObjectUtil.clone(reqVO.getCreateTime()[1]);
|
||||
endDate = ObjectUtil.clone(reqVO.getCreateTime()[0]);
|
||||
}
|
||||
LocalDate first = startDate;
|
||||
LocalDate end = endDate;
|
||||
switch (OrderStatisticsUnit.fromValue(unit)) {
|
||||
LocalDate first;
|
||||
LocalDate end;
|
||||
switch (StatisticsUnit.fromValue(unit)) {
|
||||
case QUARTER -> {
|
||||
first = firstDayOfQuarter(startDate);
|
||||
end = lastDayOfQuarter(endDate);
|
||||
@@ -126,7 +125,7 @@ public class StatisticsChangeUtils {
|
||||
List<String> dates = new ArrayList<>();
|
||||
while (!startDate.isAfter(endDate)) {
|
||||
String dateStr;
|
||||
switch (OrderStatisticsUnit.fromValue(unit)) {
|
||||
switch (StatisticsUnit.fromValue(unit)) {
|
||||
case QUARTER:
|
||||
dateStr = startDate.format(DateTimeFormatter.ofPattern("yyyy-Q"));
|
||||
// 加一季度(3个月)
|
||||
@@ -169,10 +168,10 @@ public class StatisticsChangeUtils {
|
||||
* @return
|
||||
*/
|
||||
public static String generateDateRangeAxis(String date, Integer unit) {
|
||||
OrderStatisticsUnit orderStatisticsUnit = OrderStatisticsUnit.fromValue(unit);
|
||||
StatisticsUnit statisticsUnit = StatisticsUnit.fromValue(unit);
|
||||
StringBuilder newDateStrBuffer = new StringBuilder();
|
||||
String[] dateSplit = date.split("-");
|
||||
switch (orderStatisticsUnit) {
|
||||
switch (statisticsUnit) {
|
||||
case QUARTER:
|
||||
newDateStrBuffer.append("第").append(dateSplit[1]).append("季度");
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user