mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-13 05:12:07 +08:00
禅道#631、#700修复
This commit is contained in:
+46
@@ -0,0 +1,46 @@
|
||||
package com.cf.imes.framework.aop;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
import org.springframework.web.bind.WebDataBinder;
|
||||
import org.springframework.web.bind.annotation.ControllerAdvice;
|
||||
import org.springframework.web.bind.annotation.InitBinder;
|
||||
|
||||
import java.beans.PropertyEditorSupport;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
||||
/**
|
||||
* controller解析器
|
||||
*
|
||||
* @author Gqr
|
||||
* @since 2024/12/2 10:05
|
||||
*/
|
||||
@ControllerAdvice
|
||||
public class ControllerResolver {
|
||||
private static final DateTimeFormatter FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@InitBinder
|
||||
public void initBinder(WebDataBinder webDataBinder) {
|
||||
/**
|
||||
* 时间数组解析器:只适用get请求
|
||||
* 当出现以下情况产生改变:
|
||||
* 1、传入年月日时分秒完全相同,第一个时间改为当天的0点0分0秒
|
||||
* 2、当第二个时间小于第一个时间,第一个时间改为当天的0点0分0秒
|
||||
*/
|
||||
webDataBinder.registerCustomEditor(LocalDateTime[].class, new PropertyEditorSupport() {
|
||||
@Override
|
||||
public void setAsText(String text) throws IllegalArgumentException {
|
||||
String[] split = text.split(",");
|
||||
if (ArrayUtil.isNotEmpty(split) && split.length == 2) {
|
||||
LocalDateTime startTime = LocalDateTime.parse(split[0], FORMATTER);
|
||||
LocalDateTime endTime = LocalDateTime.parse(split[1], FORMATTER);
|
||||
// 比较时间
|
||||
if (startTime.isEqual(endTime) || startTime.isAfter(endTime)) {
|
||||
startTime = startTime.withHour(0).withMinute(0).withSecond(0);
|
||||
}
|
||||
setValue(new LocalDateTime[]{startTime, endTime});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
+6
-1
@@ -1,10 +1,10 @@
|
||||
package com.cf.imes.framework.web.config;
|
||||
|
||||
import com.cf.imes.framework.aop.ControllerResolver;
|
||||
import com.cf.imes.framework.apilog.core.service.ApiErrorLogFrameworkService;
|
||||
import com.cf.imes.framework.common.enums.WebFilterOrderEnum;
|
||||
import com.cf.imes.framework.web.core.filter.CacheRequestBodyFilter;
|
||||
import com.cf.imes.framework.web.core.filter.DataSourceFilter;
|
||||
import com.cf.imes.framework.web.core.filter.DemoFilter;
|
||||
import com.cf.imes.framework.web.core.handler.GlobalExceptionHandler;
|
||||
import com.cf.imes.framework.web.core.handler.GlobalResponseBodyHandler;
|
||||
import com.cf.imes.framework.web.core.util.WebFrameworkUtils;
|
||||
@@ -132,4 +132,9 @@ public class ChenfengWebAutoConfiguration implements WebMvcConfigurer {
|
||||
public RestTemplate restTemplate(RestTemplateBuilder restTemplateBuilder) {
|
||||
return restTemplateBuilder.build();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ControllerResolver controllerResolver(){
|
||||
return new ControllerResolver();
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -704,7 +704,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
startDate = ObjectUtil.clone(reqVO.getCreateTime()[1]);
|
||||
endDate = ObjectUtil.clone(reqVO.getCreateTime()[0]);
|
||||
}
|
||||
LocalDate first = startDate;
|
||||
LocalDate first = startDate;
|
||||
LocalDate end = endDate;
|
||||
switch (OrderStatisticsUnit.fromValue(unit)) {
|
||||
case QUARTER -> {
|
||||
@@ -719,6 +719,9 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
first = startDate.with(TemporalAdjusters.previousOrSame(java.time.DayOfWeek.MONDAY));
|
||||
end = endDate.with(TemporalAdjusters.nextOrSame(java.time.DayOfWeek.SUNDAY));
|
||||
}
|
||||
default -> {
|
||||
return;
|
||||
}
|
||||
}
|
||||
reqVO.setCreateTime(new LocalDate[]{first, end});
|
||||
}
|
||||
@@ -806,7 +809,7 @@ public class OrderStatisticsServiceImpl implements OrderStatisticsService {
|
||||
newDateStrBuffer.append("第").append(dateSplit[2]).append("周");
|
||||
break;
|
||||
case DAY:
|
||||
newDateStrBuffer.append(dateSplit[2]);
|
||||
newDateStrBuffer.append(dateSplit[2]).append("日");
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user