package org.security.basicDataSync.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.security.basicDataSync.entity.DeptLevlSyncHistory;
import org.security.basicDataSync.service.IDeptLevlSyncHistoryService;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.text.ParseException;

/**
 * @author ：wzf
 * @apiNote ：机构层级信息同步流水记录
 * @since ：Created in 2022/8/26 9:15
 */
@RestController
@AllArgsConstructor
@RequestMapping("/deptLevel")
public class DeptLevlSyncHistoryController {

	private final IDeptLevlSyncHistoryService deptLevlSyncHistoryService;
	/**
	 * 导入机构层级数据
	 */
	@PostMapping("/import")
	@ApiOperationSupport(order = 9)
	@ApiOperation(value = "导入检查明细", notes = "传入file")
	public R importData(MultipartFile file){
		return R.status(deptLevlSyncHistoryService.importData(file));
	}


	/**
	 * 手动触发基础信息同步
	 */
	@PostMapping("/syn-data")
	@ApiOperationSupport(order = 9)
	@ApiOperation(value = "手动触发基础信息同步", notes = "")
	public R synData(){
		return R.status(deptLevlSyncHistoryService.synData());
	}

}
