| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import com.alibaba.excel.EasyExcel; |
| | | import com.alibaba.excel.EasyExcelFactory; |
| | | import com.alibaba.excel.context.AnalysisContext; |
| | | import com.alibaba.excel.event.AnalysisEventListener; |
| | | import com.alibaba.excel.exception.ExcelDataConvertException; |
| | |
| | | @PostMapping("import") |
| | | public ResponseValue upload(@RequestParam Long pid, MultipartFile file) throws IOException { |
| | | String originalFilename = file.getOriginalFilename(); |
| | | if (!originalFilename.endsWith("xls")) { |
| | | if (!"xls".endsWith(originalFilename)) { |
| | | return ResponseValue.error("文件格式有误!"); |
| | | } |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | |
| | | return ResponseValue.error("不能创建县(区)级以下机构"); |
| | | } |
| | | |
| | | EasyExcel |
| | | EasyExcelFactory |
| | | .read(file.getInputStream(), ImportTenantTemplate.class, new AnalysisEventListener<ImportTenantTemplate>() { |
| | | LinkedList<FinSysTenantParam> finSysTenantParams = new LinkedList<>(); |
| | | |
| | |
| | | if (sysInfo == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | // FinSysTenant finSysTenant1 = this.finSysTenantService.selectByTenantId(sysInfo.getTenantCode()); |
| | | // if (finSysTenant1.getLv() != 1) { |
| | | // return ResponseValue.error("暂无修改权限"); |
| | | // } |
| | | |
| | | int num = this.finSysTenantService.updateFinSysTenant(param, this.getSysInfo()); |
| | | return num > 0 ? ResponseValue.success(1) : ResponseValue.error("编辑失败!"); |
| | | } |