|
@@ -1,13 +1,19 @@
|
|
package cn.com.qmth.examcloud.service.core.api;
|
|
package cn.com.qmth.examcloud.service.core.api;
|
|
|
|
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+import cn.com.qmth.examcloud.common.util.excel.ExcelError;
|
|
import cn.com.qmth.examcloud.service.core.repo.OrgRepo;
|
|
import cn.com.qmth.examcloud.service.core.repo.OrgRepo;
|
|
import cn.com.qmth.examcloud.service.core.entity.Org;
|
|
import cn.com.qmth.examcloud.service.core.entity.Org;
|
|
import cn.com.qmth.examcloud.service.core.service.OrgService;
|
|
import cn.com.qmth.examcloud.service.core.service.OrgService;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
+
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.HttpStatus;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.http.ResponseEntity;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
+import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
/**
|
|
/**
|
|
* 机构服务API
|
|
* 机构服务API
|
|
@@ -65,4 +71,16 @@ public class OrgApi {
|
|
orgRepo.delete(id);
|
|
orgRepo.delete(id);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
return new ResponseEntity(HttpStatus.OK);
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ @ApiOperation(value="按父ID导入子机构",notes="导入子机构")
|
|
|
|
+ @PostMapping("/{id}/import")
|
|
|
|
+ public ResponseEntity importLearnCenter(@PathVariable Long id,@RequestParam MultipartFile file){
|
|
|
|
+ try {
|
|
|
|
+ List<ExcelError> excelErrors = orgService.importLearnCenter(id,file.getInputStream());
|
|
|
|
+ return new ResponseEntity(excelErrors,HttpStatus.OK);
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ return new ResponseEntity(HttpStatus.INTERNAL_SERVER_ERROR);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|