package com.xisc.pm.api.controller.v1;

import com.xisc.pm.api.dto.AssemblyStoveActualPerformanceDTO;
import com.xisc.pm.api.dto.FurnaceNumberDeterminationDTO;
import com.xisc.pm.api.dto.PmPdMscLineChangeDTO;
import com.xisc.pm.api.dto.PmPreSubstitutionDTO;
import com.xisc.pm.api.dto.PmProductionPlanReqDTO;
import com.xisc.pm.api.dto.PmProductionPlanResDTO;
import com.xisc.pm.api.dto.PmQueryIsSampleDTO;
import com.xisc.pm.api.dto.PmRemoveBoardsFromOrderDTO;
import com.xisc.pm.api.dto.PmRollingWasteCompositeDTO;
import com.xisc.pm.api.dto.PmTwoRollInterimRequestDTO;
import com.xisc.pm.app.service.ApiService;
import com.xisc.pm.domain.vo.util.JsonData;
import io.choerodon.core.iam.ResourceLevel;
import io.choerodon.swagger.annotation.Permission;
import io.swagger.annotations.ApiOperation;
import org.hzero.core.base.BaseController;
import org.hzero.core.util.Results;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
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 java.util.List;

/**
 * API(内部接口)控制层
 *
 * @author 蒋雨航 yuhang.jiang02@hand-china.com
 * @since 2024-08-16 10:57:16
 */

@RestController("ApiController.v1")
@RequestMapping("/v1/{organizationId}/api")
public class ApiController extends BaseController {

    @Autowired
    private ApiService apiService;

//    @ApiOperation(value = "炉次确定接口")
//    @Permission(permissionLogin = true)
//    @PostMapping("/furnace/number/determination")
//    public ResponseEntity<Void> furnaceNumberDetermination(@RequestBody List<FurnaceNumberDeterminationDTO> dtoList, @PathVariable Long organizationId) {
//        apiService.furnaceNumberDetermination(dtoList, organizationId);
//        return Results.success();
//    }
//
//    @ApiOperation(value = "代预替代成功接口")
//    @Permission(permissionLogin = true)
//    @PostMapping("/successful/pre/substitution")
//    public ResponseEntity<Void> successfulPreSubstitution(@RequestBody List<PmPreSubstitutionDTO> preSubstitutionDTOs ,  @PathVariable Long organizationId) {
//        apiService.successfulPreSubstitution(preSubstitutionDTOs, organizationId);
//        return Results.success();
//    }
//
//    @ApiOperation(value = "组炉实绩数据接口")
//    @Permission(permissionLogin = true)
//    @GetMapping("/assembly/stove/actual/performance")
//    public ResponseEntity<AssemblyStoveActualPerformanceDTO> assemblyStoveActualPerformance(@RequestParam String orderNo, @PathVariable Long organizationId) {
//        AssemblyStoveActualPerformanceDTO dto = apiService.assemblyStoveActualPerformance(orderNo, organizationId);
//        return Results.success(dto);
//    }
//
//    @ApiOperation(value = "钢板转板坯实现二次开坯")
//    @Permission(permissionLogin = true)
//    @PostMapping("/cont/pd/two-roll-interim")
//    public ResponseEntity<Boolean> createTwoRollInterim(@RequestBody List<PmTwoRollInterimRequestDTO> requestList, @PathVariable Long organizationId) {
//        return Results.success(apiService.createTwoRollInterim(requestList , organizationId));
//    }
//
//    @ApiOperation(value = "钢板转板坯实现钢锭二次开坯")
//    @Permission(permissionLogin = true)
//    @PostMapping("/cont/pd/ingot-two-roll-interim")
//    public ResponseEntity<Boolean> createIngotTwoRollInterim(@RequestBody List<PmTwoRollInterimRequestDTO> requestList, @PathVariable Long organizationId) {
//        return Results.success(apiService.createIngotTwoRollInterim(requestList , organizationId));
//    }
//
//    @ApiOperation(value = "合同跟踪材料产线变更")
//    @Permission(level = ResourceLevel.ORGANIZATION)
//    @PostMapping("/cont/pd/line-change")
//    public ResponseEntity<Boolean> mscLineNoChange(@RequestBody List<PmPdMscLineChangeDTO> changeRequestList, @PathVariable Long organizationId) {
//        return Results.success(apiService.mscLineNoChange(changeRequestList , organizationId));
//    }
//
//    @ApiOperation(value = "复合/叠轧坯轧废 && 复合/叠轧坯返修标志 接口")
//    @Permission(permissionLogin = true)
//    @PostMapping("/composite/rolling-waste")
//    public ResponseEntity<Void> compositeChange(@RequestBody List<PmRollingWasteCompositeDTO> pmRollingWasteCompositeDTOList, @PathVariable Long organizationId) {
//        return Results.success(apiService.compositeChange(organizationId, pmRollingWasteCompositeDTOList));
//    }
//
//    @ApiOperation(value = "形成新试批接口")
//    @Permission(permissionLogin = true)
//    @PostMapping("/new-test-batch")
//    public ResponseEntity<Void> newTestBatch(@RequestBody List<String> ponoSlabNoList, @PathVariable Long organizationId) {
//        apiService.newTestBatch(organizationId, ponoSlabNoList);
//        return Results.success();
//    }
//
//    @ApiOperation(value = "脱合同删除组板信息")
//    @Permission(permissionLogin = true)
//    @PostMapping("/remove-board-from-order")
//    public ResponseEntity<Void> removeBoardsFromOrder(@RequestBody List<PmRemoveBoardsFromOrderDTO> dtoList, @PathVariable Long organizationId) {
//        apiService.removeBoardsFromOrder(organizationId, dtoList);
//        return Results.success();
//    }
//
//    @ApiOperation(value = "代表板、奉送样标记查询")
//    @Permission(permissionLogin = true)
//    @PostMapping("/query/is-sample")
//    public ResponseEntity<List<PmQueryIsSampleDTO>> queryIsSample(@RequestBody List<PmQueryIsSampleDTO> dtoList, @PathVariable Long organizationId) {
//        List<PmQueryIsSampleDTO> resList = apiService.queryIsSample(dtoList, organizationId);
//        return Results.success(resList);
//    }
//
//    @ApiOperation(value = "获取产出计划信息接口")
//    @Permission(permissionLogin = true)
//    @PostMapping("/query/product-plan")
//    public ResponseEntity<List<PmProductionPlanResDTO>> queryProductionPlanInfo(@RequestBody List<PmProductionPlanReqDTO> dtoList, @PathVariable Long organizationId) {
//        List<PmProductionPlanResDTO> resList = apiService.queryProductionPlanInfo(dtoList, organizationId);
//        return Results.success(resList);
//    }

    @ApiOperation(value = "测试接口")
    @Permission(permissionLogin = true)
    @PostMapping("/query/tset")
    public ResponseEntity<String> tset(@RequestBody PmProductionPlanReqDTO dtoList, @PathVariable Long organizationId) {
//        List<PmProductionPlanResDTO> resList = apiService.queryProductionPlanInfo(dtoList, organizationId);
        System.out.println("接口测试调用成功");
        JsonData xx = new JsonData();
        xx.setCode(0);
        xx.setData(null);
        xx.setMsg("123");
//        SubController.SubData();
        return Results.success("xx");
    }

}
