OrderProfitController.java
1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.order.erp.controller;
import com.order.erp.common.annotation.AnonymousAccess;
import com.order.erp.common.constant.ServerResult;
import com.order.erp.domain.dto.order.OrderProfitAnalysisDO;
import com.order.erp.service.order.OrderProfitAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
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.RestController;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @author zhongnanhuang
* @version 1.0
* @project order-erp
* @description 订单利润表控制层
* @date 2023/10/23 11:48:36
*/
@Api(tags = "订单利润计算")
@RestController
@RequestMapping("/order/erp/profit")
public class OrderProfitController {
@Resource
OrderProfitAnalysisService orderProfitAnalysisService;
@PostMapping("/analysis")
@AnonymousAccess
@ApiOperation("计算利润率")
public ServerResult analysis(@RequestBody Map<String,List<Long>> body){
List<Long> orderIds = body.get("orderIds");
if (orderIds==null||orderIds.size()<=0){
return ServerResult.fail("订单不能为空");
}
OrderProfitAnalysisDO orderProfitAnalysisDO = orderProfitAnalysisService.analysisByOrderIds(orderIds);
if (orderProfitAnalysisDO==null){
return ServerResult.fail("找不到订单信息");
}
return ServerResult.success(orderProfitAnalysisDO);
}
}