package jnpf.personnels.controller.web.audit;

import jnpf.base.ActionResult;
import jnpf.model.personnels.dto.config.FtbPersonnelsAuditConfigDTO;
import jnpf.model.personnels.dto.config.TestOrgDto;
import jnpf.model.personnels.vo.config.FtbPersonnelsAuditConfigVO;
import jnpf.personnels.service.FtbPersonnelsAuditMasterConfigService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * web人事流程审核配置模块
 *
 * @author peng.hao
 */
@RestController
@RequestMapping("/web/personnels-config")
@Deprecated(since = "人事接入oa废弃原审批代码")
public class FtbPersonnelsAuditMasterConfigController {

    @Resource
    FtbPersonnelsAuditMasterConfigService service;

    /**
     * 创建或者修改人员审批流程配置
     *
     * @param dto 人员审批配置参数
     * @return 操作结果的ActionResult对象
     */
    @PostMapping("/saveOrUpdate-process-config")
    public ActionResult<String> createPersonnelApprovalProcessConfiguration(@RequestBody FtbPersonnelsAuditConfigDTO dto) {
        service.createApprovalConfiguration(dto);
        return ActionResult.success();
    }

    /**
     * 获取流程审核配置列表
     *
     * @param orgId 组织ID
     * @return 审计列表的结果Action
     */
    @GetMapping("/get-audit-list")
    public ActionResult<FtbPersonnelsAuditConfigVO> getAuditList(@RequestParam("orgId") String orgId,
                                                                 @RequestParam("configType") Integer configType){
        FtbPersonnelsAuditConfigVO auditConfigVO = service.getAuditList(orgId,configType);
        return ActionResult.success(auditConfigVO);
    }
    /**
     * 获取最新的修改
     *
     */
    @GetMapping("/test")
    public ActionResult<Object> getAuditList(@RequestBody TestOrgDto testDto){
        service.approverDataVerification(testDto.getUserId(),testDto.getOldDtos(),testDto.getNewDtos());
        return ActionResult.success();
    }

}
