package com.hotent.project.controller;


import com.hotent.base.annotation.ApiGroup;
import com.hotent.base.constants.ApiGroupConsts;
import com.hotent.common.CrudService;
import com.hotent.project.manager.CostProjectProccessNodeTempleteManager;
import com.hotent.project.model.CostProjectMaterial;
import com.hotent.project.model.CostProjectProccessNodeTemplete;
import com.hotent.project.req.CostProjectBasePageReq;
import com.hotent.project.req.CostProjectProccessBasePageReq;
import com.hotent.project.req.CostProjectProcessReq;
import com.hotent.project.resp.CostProjectProccessResp;
import com.hotent.resp.PageResp;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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 com.hotent.base.model.CommonResult;
import com.hotent.base.util.StringUtil;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RestController;
import com.hotent.base.controller.BaseController;
import com.hotent.project.model.CostProjectProccess;
import com.hotent.project.manager.CostProjectProccessManager;

/**
 * 流程表 前端控制器
 *
 * @company 山西清众科技股份有限公司
 * @author 超级管理员
 * @since 2025-10-01
 */
@RestController
@RequestMapping("/api/costProjectProccess/v1/")
@Api(tags = "监审流程表")
@ApiGroup(group = {ApiGroupConsts.GROUP_COST})
public class CostProjectProccessController {

	// 创建通用服务实例
	private final CrudService crudService = new CrudService();


	@Autowired
	private CostProjectProccessManager costProjectProccessManager;

	@Autowired
	private CostProjectProccessNodeTempleteManager costProjectProccessNodeTempleteManager;


	//根据id获取详情
	@GetMapping(value = "getDetail")
	@ApiOperation(value = "根据项目id获取详情", httpMethod = "GET", notes = "根据项目id获取详情")
	public CommonResult<CostProjectProccessResp> getDetail(@ApiParam(value = "项目id", required = true) @RequestParam String projectId) {
		return CommonResult.<CostProjectProccessResp>ok().value(costProjectProccessManager.getDetail(projectId));
	}


	@PostMapping(value = "nodeTmpletePageList")
	@ApiOperation(value = "根据流程节id获取节点模板数据", httpMethod = "POST", notes = "根据流程节id获取节点模板数据")
	public PageResp<CostProjectProccessNodeTemplete> nodePageList(@RequestBody CostProjectProccessBasePageReq req) {
		return crudService.pageQuery(req, costProjectProccessNodeTempleteManager::nodeTempletePageList);
	}

	//新增
	@PostMapping(value = "createProcess")
	@ApiOperation(value = "新增/修改流程", httpMethod = "POST", notes = "新增/修改流程")
	public CommonResult<String> createProcess(@RequestBody CostProjectProcessReq req) {
		costProjectProccessManager.createProcess(req);
		return new CommonResult<>();
	}











}
