package com.sw.mes.dingTalk.controller;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.sw.mes.core.annotation.Jinko;
import com.sw.mes.core.dto.SeedMassageDto;
import com.sw.mes.dingTalk.service.DingTalkService;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
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.RestController;

/**
 * @author lf
 * @description
 * @date 2024/1/23 20:51
 */
@Jinko(value = "对接钉钉相关接口", author = "liangfeng")
@RestController
@RequestMapping("/dingTalk")
@Slf4j
@Api(description = "对接钉钉接口")
public class DingTalkController {


    @Autowired
    private DingTalkService dingTalkService;

    @PostMapping("/seedMassage")
    public void seedMassage(@RequestBody SeedMassageDto dto) throws JsonProcessingException {
        dingTalkService.seedMassage(dto);
    }

    @PostMapping("/robotSeedMessage")
    public void robotSeedMessage(@RequestBody SeedMassageDto dto){
        dingTalkService.robotSeedMessage(dto.getContent(),dto.getGroupName(),dto.getSource(),dto.getScene(),dto.getStatus());
    }
}
