package com.ym.mec.web.controller;

import com.ym.mec.biz.service.UploadFileService;
import com.ym.mec.common.controller.BaseController;
import com.ym.mec.common.entity.UploadReturnBean;
import com.yonge.log.service.HistoryMessageService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.File;

@RequestMapping("imHistoryMessage")
@Api(tags = "系统操作日志")
@RestController
public class ImHistoryMessageController extends BaseController {

	@Autowired
	private HistoryMessageService historyMessageService;
	@Autowired
	private UploadFileService uploadFileService;


	@GetMapping("/save")
	public Object saveImHistoryMessage(String fileDir) throws Exception {
		File file = new File(fileDir);
		UploadReturnBean uploadReturnBean = uploadFileService.uploadImHistoryMsgFile(file);
		historyMessageService.saveImHistoryMessage(file);
		return succeed();
	}

}
