ProjectController.java 3.52 KB
package com.order.erp.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.order.erp.common.constant.ServerResult;
import com.order.erp.domain.vo.OrderProfitAnalysisVo;
import com.order.erp.domain.vo.order.*;
import com.order.erp.service.order.IOrderCostInfoService;
import com.order.erp.service.order.IProjectBaseInfoService;
import com.order.erp.service.order.OrderProfitAnalysisService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.Collections;

/**
 * @author zhongnanhuang
 * @version 1.0
 * @project order-erp
 * @description 订单利润表控制层
 * @date 2023/10/23 11:48:36
 */
@RestController
@RequestMapping("/project")
@Api(tags = "项目信息")
public class ProjectController {
    @Autowired
    IOrderCostInfoService orderCostInfoService;
    @Autowired
    IProjectBaseInfoService projectBaseInfoService;

    @PostMapping("/edit")
    @ApiOperation("编辑")
    public ServerResult<OrderProfitAnalysisVO> edit(@RequestBody @Validated ProjectBaseInfoVO vo) {
        return projectBaseInfoService.edit(vo);
    }

    @PostMapping("/applyEditFileds")
    @ApiOperation("申请修改")
    public ServerResult<OrderProfitAnalysisVO> applyEditFileds(@RequestBody @Validated ProjectBaseInfoLockFieldVO vo) {
        return projectBaseInfoService.applyEditFileds(vo);
    }

    @PostMapping("/pageProjectLockFieldApply")
    @ApiOperation("分页查询项目字段申请记录")
    public ServerResult<OrderProfitAnalysisVO> pageProjectLockFieldApply(@RequestBody @Validated QueryProjectLockFieldVO vo) {
        return projectBaseInfoService.pageProjectLockFieldApply(vo);
    }

    @PostMapping("/audit")
    @ApiOperation("审核")
    public ServerResult<OrderProfitAnalysisVO> audit(@RequestBody @Validated AuditVO vo) {
        return projectBaseInfoService.audit(vo);
    }
    @PostMapping("/InnerProfitInfo/listByPage")
    @ApiOperation("内部生产利润分析表")
    public ServerResult<Page<InnerProfitInfoVO>> listInnerProfitInfoByPage(@RequestBody @Validated OrderBaseInfoQueryVO queryVO) {
        queryVO.setProductionDepartment(Collections.singletonList("内部"));
        return projectBaseInfoService.listInnerProfitInfoByPage(queryVO);
    }

    @PostMapping("/BusinessProfitInfo/listByPage")
    @ApiOperation("业务研发净利润分析表")
    public ServerResult<Page<BusinessProfitInfoVO>> listBusinessProfitInfosByPage(@RequestBody @Validated OrderBaseInfoQueryVO queryVO) {
        queryVO.setProductionDepartment(Collections.singletonList("内部"));
        return projectBaseInfoService.listBusinessProfitInfoByPage(queryVO);
    }

    @PostMapping("/businessProfit/export")
    @ApiOperation("业务研发净利润分析表导出")
    public void exportBusinessProfitInfo(HttpServletResponse response, @RequestParam("projectNoPrefix") String projectNoPrefix) throws Exception {
        projectBaseInfoService.exportBusinessProfitInfo(response, projectNoPrefix);
    }

    @PostMapping("/innerProfit/export")
    @ApiOperation("内部研发净利润分析表导出")
    public void exportInnerProfitInfo(HttpServletResponse response, @RequestParam("projectNoPrefix") String projectNoPrefix) throws Exception {
        projectBaseInfoService.exportInnerProfitInfo(response, projectNoPrefix);
    }

}