package com.gk.hotwork.doublePrevention.controller;
|
|
import com.gk.hotwork.Controller.Base.BaseController;
|
import com.gk.hotwork.Domain.Vo.ResultVO;
|
import com.gk.hotwork.Domain.co.ContextCacheUser;
|
import com.gk.hotwork.doublePrevention.entity.PreventProduceDevice;
|
import com.gk.hotwork.doublePrevention.entity.PreventRiskAnaUnit;
|
import com.gk.hotwork.doublePrevention.entity.PreventRiskEvent;
|
import com.gk.hotwork.doublePrevention.service.FileHandlerService;
|
import com.gk.hotwork.doublePrevention.utils.CacheUserTransfer;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.security.core.Authentication;
|
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
@RestController
|
@RequestMapping("prevent/fileHandler")
|
public class PreventFileHandlerController extends BaseController {
|
|
@Autowired
|
private FileHandlerService handlerService;
|
|
|
/**
|
* 生产装置-导入
|
*/
|
@PostMapping("/insert/deviceImport")
|
public ResultVO<PreventProduceDevice> deviceImport(Authentication authentication, @RequestParam MultipartFile file) throws Exception {
|
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return handlerService.deviceImport(currentUser, file );
|
}
|
|
/**
|
* 风险分析单元-导入
|
*/
|
@PostMapping("/insert/riskUnitImport")
|
public ResultVO<PreventRiskAnaUnit> riskUnitImport(Authentication authentication, @RequestParam MultipartFile file) throws Exception {
|
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return handlerService.riskUnitImport(currentUser, file );
|
}
|
|
/**
|
* 安全风险事件-导入
|
*/
|
@PostMapping("/insert/eventImport")
|
public ResultVO<PreventRiskEvent> eventImport(Authentication authentication, @RequestParam MultipartFile file) throws Exception {
|
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return handlerService.eventImport(currentUser, file );
|
}
|
|
/**
|
* 管控措施-导入
|
*/
|
@PostMapping("/insert/measureImport")
|
public ResultVO<PreventRiskEvent> measureImport(Authentication authentication, @RequestParam MultipartFile file) throws Exception {
|
|
//获取用户信息
|
ContextCacheUser currentUser = CacheUserTransfer.transfer(getUser());
|
return handlerService.measureImport(currentUser, file );
|
}
|
|
}
|