|
@ -42,6 +42,9 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
|
import java.text.ParseException; |
|
|
|
|
|
import java.text.SimpleDateFormat; |
|
|
|
|
|
import java.util.Date; |
|
|
import java.util.List; |
|
|
import java.util.List; |
|
|
import java.util.Map; |
|
|
import java.util.Map; |
|
|
import java.util.regex.Pattern; |
|
|
import java.util.regex.Pattern; |
|
@ -145,9 +148,18 @@ public class UserAdviceController { |
|
|
@PostMapping("advicelist") |
|
|
@PostMapping("advicelist") |
|
|
public Result<PageData<AdviceListResultDTO>> adviceList(@RequestBody AdviceListFormDTO dto) { |
|
|
public Result<PageData<AdviceListResultDTO>> adviceList(@RequestBody AdviceListFormDTO dto) { |
|
|
ValidatorUtils.validateEntity(dto); |
|
|
ValidatorUtils.validateEntity(dto); |
|
|
if (dto.getStartTime() != null && dto.getEndTime() != null) { |
|
|
//校验时间
|
|
|
if (dto.getStartTime().after(dto.getEndTime())) { |
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); |
|
|
throw new RenException("开始时间不能大于结束时间"); |
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(dto.getStartTime()) && StringUtils.isNotBlank(dto.getEndTime())){ |
|
|
|
|
|
try { |
|
|
|
|
|
Date start = sdf.parse(dto.getStartTime()); |
|
|
|
|
|
Date end = sdf.parse(dto.getEndTime()); |
|
|
|
|
|
if (start.after(end)){ |
|
|
|
|
|
throw new RenException("开始时间不能大于结束时间"); |
|
|
|
|
|
} |
|
|
|
|
|
}catch (ParseException e){ |
|
|
|
|
|
throw new RenException("日期转换失败"); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
PageData<AdviceListResultDTO> page = userAdviceService.adviceList(dto); |
|
|
PageData<AdviceListResultDTO> page = userAdviceService.adviceList(dto); |
|
|