Commit dff89591 by 刘鑫

CI: 容量查询接口限制日期范围在一个月内

1 parent 33803aab
package com.dituhui.pea.order.controller;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.dto.OrganizationTreeDTO;
import com.dituhui.pea.order.dto.param.BaseDistance;
......@@ -13,6 +14,7 @@ import com.dituhui.pea.order.dto.param.OrderConfirmParam;
import com.dituhui.pea.order.dto.param.OrderConfirmResult;
import com.dituhui.pea.order.dto.param.OrderDTO;
import com.dituhui.pea.order.dto.param.ValidGroup;
import com.dituhui.pea.util.DateUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.RequiredArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
......@@ -26,10 +28,11 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.time.Period;
import java.util.Date;
/**
* PEA 调用API
* PEA 对外接口
*/
@RestController
@RequestMapping("/pea-order/pea")
......@@ -108,7 +111,12 @@ public class PeaApiController {
*/
@PostMapping("/capacity/query")
public Result<CapacityQueryDTO.Result> capacityQuery(@Validated @RequestBody CapacityQueryDTO.Request reqDTO) {
//TODO 查询日期起止参数限制为一月
//查询日期起止参数限制为一月
Period between = Period.between(DateUtil.fromDate(reqDTO.getBeginDate()).toLocalDate(), DateUtil.fromDate(reqDTO.getEndDate()).toLocalDate());
if (between.getMonths() > 1) {
throw new BusinessException("查询日期起止参数限制为一月");
}
CapacityQueryDTO.Result result = new CapacityQueryDTO.Result();
return Result.success(result);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!