|
@@ -1,60 +0,0 @@
|
|
|
-package cn.com.qmth.examcloud.exchange.inner.service.impl;
|
|
|
-
|
|
|
-import java.io.File;
|
|
|
-import java.io.InputStream;
|
|
|
-
|
|
|
-import org.springframework.stereotype.Service;
|
|
|
-
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLog;
|
|
|
-import cn.com.qmth.examcloud.commons.logging.ExamCloudLogFactory;
|
|
|
-import cn.com.qmth.examcloud.commons.util.FreeMarkerUtil;
|
|
|
-import cn.com.qmth.examcloud.exchange.inner.service.UpyunService;
|
|
|
-import cn.com.qmth.examcloud.exchange.inner.service.bean.UpyunPathEnvironmentInfo;
|
|
|
-import cn.com.qmth.examcloud.web.upyun.UpYunClient;
|
|
|
-import cn.com.qmth.examcloud.web.upyun.UpYunPathInfo;
|
|
|
-import cn.com.qmth.examcloud.web.upyun.UpyunSite;
|
|
|
-import cn.com.qmth.examcloud.web.upyun.UpyunSiteManager;
|
|
|
-
|
|
|
-/**
|
|
|
- * 类注释
|
|
|
- *
|
|
|
- * @author WANGWEI
|
|
|
- * @date 2018年9月4日
|
|
|
- * @Copyright (c) 2018-? http://qmth.com.cn All Rights Reserved.
|
|
|
- */
|
|
|
-@Service
|
|
|
-public class UpyunServiceImpl implements UpyunService {
|
|
|
-
|
|
|
- protected ExamCloudLog log = ExamCloudLogFactory.getLog(this.getClass());
|
|
|
-
|
|
|
- @Override
|
|
|
- public UpYunPathInfo writeFile(String siteId, UpyunPathEnvironmentInfo env, InputStream in) {
|
|
|
- env.setCurrentTimeMillis(String.valueOf(System.currentTimeMillis()));
|
|
|
-
|
|
|
- UpyunSite upyunSite = UpyunSiteManager.getUpyunSite(siteId);
|
|
|
- UpYunClient upYunClient = UpyunSiteManager.getUpYunClient(siteId);
|
|
|
-
|
|
|
- String path = FreeMarkerUtil.process(upyunSite.getPath(), env);
|
|
|
- UpYunPathInfo pathInfo = upYunClient.writeFile(path, in);
|
|
|
- return pathInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public UpYunPathInfo writeFile(String siteId, UpyunPathEnvironmentInfo env, File file) {
|
|
|
- env.setCurrentTimeMillis(String.valueOf(System.currentTimeMillis()));
|
|
|
-
|
|
|
- UpyunSite upyunSite = UpyunSiteManager.getUpyunSite(siteId);
|
|
|
- UpYunClient upYunClient = UpyunSiteManager.getUpYunClient(siteId);
|
|
|
-
|
|
|
- String path = FreeMarkerUtil.process(upyunSite.getPath(), env);
|
|
|
- UpYunPathInfo pathInfo = upYunClient.writeFile(path, file);
|
|
|
- return pathInfo;
|
|
|
- }
|
|
|
-
|
|
|
- @Override
|
|
|
- public void delete(String siteId, String filePath) {
|
|
|
- UpYunClient upYunClient = UpyunSiteManager.getUpYunClient(siteId);
|
|
|
- upYunClient.deleteFile(filePath);
|
|
|
- }
|
|
|
-
|
|
|
-}
|