| | |
| | | import com.chinaztt.ztt.admin.api.feign.RemoteDictService; |
| | | import com.chinaztt.ztt.common.core.util.R; |
| | | import com.chinaztt.ztt.common.log.annotation.SysLog; |
| | | import com.chinaztt.ztt.common.security.util.SecurityUtils; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.data.redis.core.RedisTemplate; |
| | | import org.springframework.security.access.prepost.PreAuthorize; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | |
| | | private final StructureService structureService; |
| | | private final DictUtils dictUtils; |
| | | |
| | | private RedisTemplate redisTemplate; |
| | | |
| | | /** |
| | | * 横着导入的导入方式 |
| | | * |
| | |
| | | */ |
| | | @PostMapping("/uploadExt") |
| | | public R uploadExt(@RequestParam("file") MultipartFile file) { |
| | | String key = "syncStructure_lock" + SecurityUtils.getUser().getId(); |
| | | if (redisTemplate.hasKey(key)) { |
| | | throw new RuntimeException("有导入任务正在处理"); |
| | | } |
| | | ExcelReader excelReader = null; |
| | | try { |
| | | excelReader = EasyExcel.read(file.getInputStream(), StructureData.class, new StructureUploadListener(structureService)).build(); |