package com.rongwei.bsserver.sys.controller;

import com.rongwei.bscommon.sys.service.EquMaintenanceOrderService;
import com.rongwei.bscommon.sys.service.EquMaintenanceReportService;
import com.rongwei.bscommon.sys.service.EquipmentArchivesService;
import com.rongwei.rwcommon.base.R;
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;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("sendEmail")
@Slf4j
public class SendEmailController {


    @Autowired
    private EquipmentArchivesService equipmentArchivesService;

    @Autowired
    private EquMaintenanceOrderService equMaintenanceOrderService;

    @Autowired
    private EquMaintenanceReportService equMaintenanceReportService;


    /**
     * 设备处置流程邮件提醒
     * @return
     */
    @PostMapping("/EquipmentDisposalEmail")
    public R deleteValidate(@RequestBody Map<String,Object> myObject){
            R r = equipmentArchivesService.sendEmail(myObject);
            return r.ok();
    }


    /**
     * 维修申请流程邮件提醒
     * @return
     */
    @PostMapping("/EquMaintenanceOrderEmail")
    public R equMaintenanceOrderEmail(@RequestBody Map<String,Object> myObject){
        R r = equMaintenanceOrderService.sendEmail(myObject);
        return r.ok();
    }

    /**
     * 维修上报设备故障流程邮件提醒
     * @return
     */
    @PostMapping("/EquMaintenanceReportEmail")
    public R equMaintenanceReportEmail(@RequestBody Map<String,Object> myObject){
        R r = equMaintenanceReportService.sendEmail(myObject);
        return r.ok();
    }
}
