Commit 59ca3e50b5d445a25a1487684b854d3ba2d2a20b
1 parent
82b7b5ac
利润分析接口更新
Showing
2 changed files
with
30 additions
and
5 deletions
src/main/java/com/order/erp/controller/OrderProfitController.java
... | ... | @@ -2,13 +2,16 @@ package com.order.erp.controller; |
2 | 2 | |
3 | 3 | import com.order.erp.common.constant.ServerResult; |
4 | 4 | import com.order.erp.domain.dto.order.OrderProfitAnalysisDO; |
5 | +import com.order.erp.domain.vo.OrderProfitAnalysisVo; | |
5 | 6 | import com.order.erp.service.order.OrderProfitAnalysisService; |
7 | +import org.springframework.validation.annotation.Validated; | |
6 | 8 | import org.springframework.web.bind.annotation.PostMapping; |
7 | 9 | import org.springframework.web.bind.annotation.RequestBody; |
8 | 10 | import org.springframework.web.bind.annotation.RequestMapping; |
9 | 11 | import org.springframework.web.bind.annotation.RestController; |
10 | 12 | |
11 | 13 | import javax.annotation.Resource; |
14 | +import javax.validation.Valid; | |
12 | 15 | import java.util.List; |
13 | 16 | import java.util.Map; |
14 | 17 | |
... | ... | @@ -27,11 +30,8 @@ public class OrderProfitController { |
27 | 30 | OrderProfitAnalysisService orderProfitAnalysisService; |
28 | 31 | |
29 | 32 | @PostMapping("/analysis") |
30 | - public ServerResult analysis(@RequestBody Map<String,List<Long>> body){ | |
31 | - List<Long> orderIds = body.get("orderIds"); | |
32 | - if (orderIds==null||orderIds.size()<=0){ | |
33 | - return ServerResult.fail("订单不能为空"); | |
34 | - } | |
33 | + public ServerResult analysis(@RequestBody @Validated OrderProfitAnalysisVo orderProfitAnalysisVo){ | |
34 | + List<Long> orderIds = orderProfitAnalysisVo.getOrderIds(); | |
35 | 35 | |
36 | 36 | OrderProfitAnalysisDO orderProfitAnalysisDO = orderProfitAnalysisService.analysisByOrderIds(orderIds); |
37 | 37 | ... | ... |
src/main/java/com/order/erp/domain/vo/OrderProfitAnalysisVo.java
0 → 100644
1 | +package com.order.erp.domain.vo; | |
2 | + | |
3 | +import lombok.AllArgsConstructor; | |
4 | +import lombok.Data; | |
5 | +import lombok.NoArgsConstructor; | |
6 | +import lombok.ToString; | |
7 | + | |
8 | +import javax.validation.constraints.Size; | |
9 | +import java.util.List; | |
10 | + | |
11 | +/** | |
12 | + * @author zhongnanhuang | |
13 | + * @version 1.0 | |
14 | + * @project order-erp | |
15 | + * @description 利润分析传参 | |
16 | + * @date 2023/10/30 10:19:26 | |
17 | + */ | |
18 | +@Data | |
19 | +@AllArgsConstructor | |
20 | +@NoArgsConstructor | |
21 | +@ToString | |
22 | +public class OrderProfitAnalysisVo { | |
23 | + @Size(min = 1,message = "订单不能为空") | |
24 | + private List<Long> orderIds; | |
25 | +} | ... | ... |