package com.malk.huagao.controller;

import com.alibaba.fastjson.JSON;
import com.malk.delegate.McDelegate;
import com.malk.huagao.service.HuaGaoService;
import com.malk.server.aliwork.YDConf;
import com.malk.server.aliwork.YDParam;
import com.malk.server.common.McException;
import com.malk.server.common.McR;
import com.malk.service.aliwork.YDClient;
import com.malk.service.dingtalk.DDClient;
import com.malk.utils.UtilMap;
import com.malk.utils.UtilServlet;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

@Slf4j
@RestController
@RequestMapping("/hg")
public class HuaGaoController {
    @Autowired
    private HuaGaoService huaGaoService;

    @GetMapping("/test")
    public McR test() {
        return McR.success();
    }

    /**
     * 宜搭非生产单价同步至数据库
     * @param map
     * @return
     */
    @PostMapping("/upsertNonProdPrice")
    McR upsertNonProdPrice(@RequestBody Map map) {
        huaGaoService.upsertNonProdPrice(map);
        return McR.success();
    }

    /**
     * 宜搭生产工时单价同步至数据库
     * @param map
     * @return
     */
    @PostMapping("/upsertWorkHoursPrice")
    McR upsertWorkHoursPrice(@RequestBody Map map) {
        huaGaoService.upsertWorkHoursPrice(map);
        return McR.success();
    }

    /**
     * 补卡、加班审批通过后更新员工工时投入
     * @param map
     * @return
     */
    @PostMapping("/updateWorkHours")
    McR updateWorkHours(@RequestBody Map map) {
        huaGaoService.updateWorkHours(map);
        return McR.success();
    }

}
