package com.zt.plat.module.base.api.plan;

import com.zt.plat.framework.common.pojo.CommonResult;
import com.zt.plat.framework.common.util.object.BeanUtils;
import com.zt.plat.module.base.controller.admin.erpmonthproductiveplancheck.vo.ErpMonthProductivePlanCheckSaveReqVO;
import com.zt.plat.module.base.controller.admin.plandate.vo.PlanDateSaveReqVO;
import com.zt.plat.module.base.service.erpmonthproductiveplancheck.ErpMonthProductivePlanCheckService;
import com.zt.plat.module.base.service.plandate.PlanDateService;
import com.zt.plat.module.plandate.PlanApi;
import com.zt.plat.module.plandate.dto.ErpMonthProductivePlanCheckSaveReqDTO;
import com.zt.plat.module.plandate.dto.PlanDateSaveReqDTO;
import jakarta.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RestController;

@RestController
@Validated
public class PlanApiImpl implements PlanApi {
    @Resource
    private PlanDateService planDateService;
    @Resource
    private ErpMonthProductivePlanCheckService erpMonthProductivePlanCheckService;
    @Override
    public CommonResult<Boolean> planCreate(PlanDateSaveReqDTO reqDTO) {
        PlanDateSaveReqVO planDateSaveReqVO = BeanUtils.toBean(reqDTO, PlanDateSaveReqVO.class);
        planDateService.createPlanDate(planDateSaveReqVO);
        return CommonResult.success(true);
    }

    @Override
    public CommonResult<Boolean> monthProductivePlanCheckCreate(ErpMonthProductivePlanCheckSaveReqDTO reqDTO) {
        ErpMonthProductivePlanCheckSaveReqVO erpMonthProductivePlanCheckSaveReqVO = BeanUtils.toBean(reqDTO, ErpMonthProductivePlanCheckSaveReqVO.class);
        erpMonthProductivePlanCheckService.createErpMonthProductivePlanCheck(erpMonthProductivePlanCheckSaveReqVO);
        return CommonResult.success(true);
    }
}
