Commit 6231f07a by chamberone

feat: 更新接口参数

1 parent c4a1ce01
package com.dituhui.pea.pojo;
import lombok.Data;
@Data
public class BlockSyncRequest {
String blockId;
Long area;
RegionDTO region;
}
......@@ -3,14 +3,14 @@ package com.dituhui.pea.order.controller;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import com.dituhui.pea.common.BusinessException;
import com.dituhui.pea.common.Result;
import com.dituhui.pea.order.service.IBlockService;
import com.dituhui.pea.pojo.RegionDTO;
import com.dituhui.pea.pojo.BlockSyncRequest;
/**
* 服务范围相关接口
......@@ -32,18 +32,17 @@ public class BlockController {
* @return
*/
@PostMapping("/syncBlock")
public Result<Boolean> synchronizeBlock(@RequestParam String blockId, @RequestParam Long area,
@RequestParam RegionDTO region) {
if (StringUtils.isBlank(blockId)) {
public Result<Boolean> synchronizeBlock(@RequestBody BlockSyncRequest request) {
if (request == null || StringUtils.isBlank(request.getBlockId())) {
return Result.failure("缺少参数blockId");
}
if (null == region) {
if (null == request.getRegion()) {
return Result.failure("缺少参数region");
}
Result<Boolean> res = null;
try {
res = blockService.synchronizeBlock(blockId, area, region);
res = blockService.synchronizeBlock(request.getBlockId(), request.getArea(), request.getRegion());
} catch (BusinessException e) {
return Result.failure(e.getMessage());
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!