OrderProfitController.java 1.3 KB
package com.order.erp.controller;

import com.order.erp.common.constant.ServerResult;
import com.order.erp.domain.dto.order.OrderProfitAnalysisDO;
import com.order.erp.service.order.OrderProfitAnalysisService;
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;

/**
 * @author zhongnanhuang
 * @version 1.0
 * @project order-erp
 * @description 订单利润表控制层
 * @date 2023/10/23 11:48:36
 */
@RestController
@RequestMapping("/order/erp/profit")
public class OrderProfitController {

    @Resource
    OrderProfitAnalysisService orderProfitAnalysisService;

    @PostMapping("/analysis")
    public ServerResult analysis(@RequestBody List<Long> 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);
    }
}