Просмотр исходного кода

Merge branch 'release_toaliyun_real' of https://git.malls.iformall.com/server/formallProject into release_toaliyun_real

release_toaliyun_real
xiaohanzi 5 лет назад
Родитель
Сommit
484d6b5482
1 измененных файлов: 8 добавлений и 2 удалений
  1. +8
    -2
      mallinkService/src/main/java/com/iformall/service/impl/QrCodeServiceImpl.java

+ 8
- 2
mallinkService/src/main/java/com/iformall/service/impl/QrCodeServiceImpl.java Просмотреть файл

@@ -20,6 +20,7 @@ import com.iformall.domain.po.MallResource;
import com.iformall.domain.po.base.TenantEntity;
import com.iformall.domain.po.WxAppinfo;
import com.iformall.exception.MallinkException;
import com.iformall.file.aliyun.AliyunOSS;
import com.iformall.service.MallResourceService;
import com.iformall.service.QrCodeService;
import com.iformall.service.WxAppinfoService;
@@ -59,6 +60,9 @@ public class QrCodeServiceImpl implements QrCodeService {

private AmazonS3 s3 = null;

@Autowired
private AliyunOSS aliyunOSS;

@Override
public ResultData awsUpload(InputStream inputStream, ObjectMetadata metadata, String fileName, TenantEntity tenantEntity) {
ResultData data = new ResultData();
@@ -286,14 +290,16 @@ public class QrCodeServiceImpl implements QrCodeService {

String fn = UUID.randomUUID().toString();
int dot = fileName.lastIndexOf('.');
String fileFormat = "";
if (dot >= 0) {
String fileFormat = dest.getName().substring(dot, dest.getName().length());
fileFormat = dest.getName().substring(dot, dest.getName().length());
fn = getFileName(tenantEntity, fn + fileFormat);
} else {
fn = getFileName(tenantEntity, fn);
}

ResultData data = awsUpload(new FileInputStream(dest), metadata, fn, tenantEntity);
// ResultData data = awsUpload(new FileInputStream(dest), metadata, fn, tenantEntity);
ResultData data = aliyunOSS.uploadFile(tenantEntity.getTenantId(), fileFormat, new FileInputStream(dest));
org.apache.commons.io.FileUtils.forceDelete(dest);
return data;
} catch (Exception e) {


Загрузка…
Отмена
Сохранить