|
@@ -44,6 +44,7 @@ import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Lists;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
|
|
|
|
|
+import cn.com.qmth.examcloud.api.commons.exchange.FormFilePart;
|
|
import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
|
|
import cn.com.qmth.examcloud.api.commons.exchange.PageInfo;
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
import cn.com.qmth.examcloud.commons.exception.ExamCloudRuntimeException;
|
|
@@ -61,6 +62,9 @@ import cn.com.qmth.examcloud.core.basic.dao.entity.OrgPropertyEntity;
|
|
import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
|
|
import cn.com.qmth.examcloud.core.basic.dao.enums.OrgProperty;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
|
|
import cn.com.qmth.examcloud.core.basic.service.bean.OrgInfo;
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
|
|
import cn.com.qmth.examcloud.core.basic.service.impl.OrgServiceImpl;
|
|
|
|
+import cn.com.qmth.examcloud.exchange.inner.api.UpyunCloudService;
|
|
|
|
+import cn.com.qmth.examcloud.exchange.inner.api.request.PutFileReq;
|
|
|
|
+import cn.com.qmth.examcloud.exchange.inner.api.response.PutFileResp;
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
import cn.com.qmth.examcloud.task.api.DataSyncCloudService;
|
|
import cn.com.qmth.examcloud.task.api.request.SyncOrgReq;
|
|
import cn.com.qmth.examcloud.task.api.request.SyncOrgReq;
|
|
import cn.com.qmth.examcloud.web.config.SystemConfig;
|
|
import cn.com.qmth.examcloud.web.config.SystemConfig;
|
|
@@ -99,6 +103,9 @@ public class OrgController extends ControllerSupport {
|
|
@Autowired
|
|
@Autowired
|
|
DataSyncCloudService dataSyncCloudService;
|
|
DataSyncCloudService dataSyncCloudService;
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ UpyunCloudService upyunCloudService;
|
|
|
|
+
|
|
@ApiOperation(value = "分页查询所有机构")
|
|
@ApiOperation(value = "分页查询所有机构")
|
|
@GetMapping("fullOrgPage/{curPage}/{pageSize}")
|
|
@GetMapping("fullOrgPage/{curPage}/{pageSize}")
|
|
public PageInfo<OrgDomain> getFullOrgPage(@PathVariable Integer curPage,
|
|
public PageInfo<OrgDomain> getFullOrgPage(@PathVariable Integer curPage,
|
|
@@ -993,7 +1000,7 @@ public class OrgController extends ControllerSupport {
|
|
*/
|
|
*/
|
|
@ApiOperation(value = "导入logo", notes = "导入logo")
|
|
@ApiOperation(value = "导入logo", notes = "导入logo")
|
|
@PostMapping("importLogo/{orgId}")
|
|
@PostMapping("importLogo/{orgId}")
|
|
- public void importLogo(@PathVariable Long orgId, HttpServletRequest request,
|
|
|
|
|
|
+ public String importLogo(@PathVariable Long orgId, HttpServletRequest request,
|
|
@RequestParam CommonsMultipartFile file) throws IOException {
|
|
@RequestParam CommonsMultipartFile file) throws IOException {
|
|
|
|
|
|
OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
OrgEntity orgEntity = GlobalHelper.getEntity(orgRepo, orgId, OrgEntity.class);
|
|
@@ -1037,6 +1044,7 @@ public class OrgController extends ControllerSupport {
|
|
DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
|
|
DynamicEnumManager manager = OrgProperty.getDynamicEnumManager();
|
|
DynamicEnum logoFile = manager.getByName("LOGO_FILE");
|
|
DynamicEnum logoFile = manager.getByName("LOGO_FILE");
|
|
DynamicEnum logoFileSuffix = manager.getByName("LOGO_FILE_SUFFIX");
|
|
DynamicEnum logoFileSuffix = manager.getByName("LOGO_FILE_SUFFIX");
|
|
|
|
+ DynamicEnum logoFileUrl = manager.getByName("LOGO_FILE_URL");
|
|
|
|
|
|
OrgPropertyEntity fileEntity = orgPropertyRepo.findByOrgIdAndKeyId(orgId, logoFile.getId());
|
|
OrgPropertyEntity fileEntity = orgPropertyRepo.findByOrgIdAndKeyId(orgId, logoFile.getId());
|
|
if (null == fileEntity) {
|
|
if (null == fileEntity) {
|
|
@@ -1055,13 +1063,35 @@ public class OrgController extends ControllerSupport {
|
|
fileSuffixEntity.setOrgId(orgId);
|
|
fileSuffixEntity.setOrgId(orgId);
|
|
}
|
|
}
|
|
fileSuffixEntity.setValue(fileSuffix);
|
|
fileSuffixEntity.setValue(fileSuffix);
|
|
-
|
|
|
|
orgPropertyRepo.save(fileSuffixEntity);
|
|
orgPropertyRepo.save(fileSuffixEntity);
|
|
|
|
|
|
String path = systemConfig.getTempDataDir() + "/logo/" + orgId
|
|
String path = systemConfig.getTempDataDir() + "/logo/" + orgId
|
|
+ fileSuffixEntity.getValue();
|
|
+ fileSuffixEntity.getValue();
|
|
|
|
|
|
FileUtils.copyFile(storeLocation, new File(path));
|
|
FileUtils.copyFile(storeLocation, new File(path));
|
|
|
|
+
|
|
|
|
+ PutFileReq req = new PutFileReq();
|
|
|
|
+ List<FormFilePart> formFilePartList = new ArrayList<FormFilePart>();
|
|
|
|
+ FormFilePart part = new FormFilePart("file", orgId + fileSuffix, storeLocation);
|
|
|
|
+ formFilePartList.add(part);
|
|
|
|
+
|
|
|
|
+ req.setFormFilePartList(formFilePartList);
|
|
|
|
+ req.setSiteId("orgLogo");
|
|
|
|
+ req.setRootOrgId(orgEntity.getRootId());
|
|
|
|
+ PutFileResp putFileResp = upyunCloudService.putFile(req);
|
|
|
|
+ String url = putFileResp.getUrl();
|
|
|
|
+
|
|
|
|
+ OrgPropertyEntity logoFileUrlEntity = orgPropertyRepo.findByOrgIdAndKeyId(orgId,
|
|
|
|
+ logoFileUrl.getId());
|
|
|
|
+ if (null == logoFileUrlEntity) {
|
|
|
|
+ fileSuffixEntity = new OrgPropertyEntity();
|
|
|
|
+ fileSuffixEntity.setKeyId(logoFileUrl.getId());
|
|
|
|
+ fileSuffixEntity.setOrgId(orgId);
|
|
|
|
+ }
|
|
|
|
+ fileSuffixEntity.setValue(url);
|
|
|
|
+ orgPropertyRepo.save(logoFileUrlEntity);
|
|
|
|
+
|
|
|
|
+ return url;
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "删除子机构", notes = "")
|
|
@ApiOperation(value = "删除子机构", notes = "")
|