|
@@ -757,7 +757,6 @@ public class OrgController extends ControllerSupport {
|
|
|
|
|
|
List<String> keys = RegExpUtil.findAll(String.valueOf(value), "[^\\,]+");
|
|
|
Map<String, String> properties = getProperties(orgEntity.getId(), keys);
|
|
|
-
|
|
|
return properties;
|
|
|
}
|
|
|
|
|
@@ -1363,6 +1362,60 @@ public class OrgController extends ControllerSupport {
|
|
|
return url;
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation(value = "导入离线考试答题纸", notes = "导入离线考试答题纸")
|
|
|
+ @PostMapping("importAnswers/{orgId}")
|
|
|
+ @Transactional
|
|
|
+ public String importAnswers(@PathVariable Long orgId, @RequestParam CommonsMultipartFile file) throws IOException {
|
|
|
+
|
|
|
+ OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
+ if (null == orgEntity) {
|
|
|
+ throw new StatusException("140002", "orgEntity is null");
|
|
|
+ }
|
|
|
+
|
|
|
+ validateRootOrgIsolation(orgEntity.getRootId());
|
|
|
+
|
|
|
+ DiskFileItem fileItem = (DiskFileItem) file.getFileItem();
|
|
|
+ File storeLocation = fileItem.getStoreLocation();
|
|
|
+ String name = file.getOriginalFilename();
|
|
|
+
|
|
|
+ if ( 2048*1024 < storeLocation.length()) {
|
|
|
+ throw new StatusException("140082", "文件过大");
|
|
|
+ }
|
|
|
+
|
|
|
+ String fileSuffix = null;
|
|
|
+ if (name.endsWith(".zip")) {
|
|
|
+ fileSuffix = ".zip";
|
|
|
+ } else {
|
|
|
+ throw new StatusException("101001", "文件格式错误");
|
|
|
+ }
|
|
|
+
|
|
|
+ //通用存储
|
|
|
+ FileStoragePathEnvInfo env = new FileStoragePathEnvInfo();
|
|
|
+ env.setFileSuffix(fileSuffix);
|
|
|
+ env.setRootOrgId(orgEntity.getRootId().toString());
|
|
|
+ YunPathInfo pi = FileStorageUtil.saveFile("orgAnswers", env, storeLocation, null);
|
|
|
+ String url = pi.getUrl();
|
|
|
+
|
|
|
+ User accessUser = getAccessUser();
|
|
|
+ ReportsUtil.report(new AdminOperateReport(accessUser.getRootOrgId(), accessUser.getUserId(), "考生端配置-上传学校答题纸模板", null));
|
|
|
+ return url;
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "下载离线考试答题纸", notes = "下载离线考试答题纸")
|
|
|
+ @GetMapping("getAnswersUrl/{orgId}")
|
|
|
+ @Transactional
|
|
|
+ public String getAnswersUrl(@PathVariable Long orgId) {
|
|
|
+ OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
|
+ if (null == orgEntity) {
|
|
|
+ throw new StatusException("140002", "orgEntity is null");
|
|
|
+ }
|
|
|
+ OrgPropertyEntity fileEntity = orgPropertyRepo.findByOrgIdAndKeyId(orgId, 26L);
|
|
|
+ if (null == fileEntity || StringUtils.isBlank(fileEntity.getValue())) {
|
|
|
+ return "";
|
|
|
+ }
|
|
|
+ return fileEntity.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
@ApiOperation(value = "下载导入模板", notes = "下载导入模板")
|
|
|
@GetMapping("importTemplate")
|
|
|
public void getDownloadTemplate(HttpServletResponse response) {
|