| @@ -20,6 +20,7 @@ import com.iformall.domain.po.MallResource; | |||||
| import com.iformall.domain.po.base.TenantEntity; | import com.iformall.domain.po.base.TenantEntity; | ||||
| import com.iformall.domain.po.WxAppinfo; | import com.iformall.domain.po.WxAppinfo; | ||||
| import com.iformall.exception.MallinkException; | import com.iformall.exception.MallinkException; | ||||
| import com.iformall.file.aliyun.AliyunOSS; | |||||
| import com.iformall.service.MallResourceService; | import com.iformall.service.MallResourceService; | ||||
| import com.iformall.service.QrCodeService; | import com.iformall.service.QrCodeService; | ||||
| import com.iformall.service.WxAppinfoService; | import com.iformall.service.WxAppinfoService; | ||||
| @@ -59,6 +60,9 @@ public class QrCodeServiceImpl implements QrCodeService { | |||||
| private AmazonS3 s3 = null; | private AmazonS3 s3 = null; | ||||
| @Autowired | |||||
| private AliyunOSS aliyunOSS; | |||||
| @Override | @Override | ||||
| public ResultData awsUpload(InputStream inputStream, ObjectMetadata metadata, String fileName, TenantEntity tenantEntity) { | public ResultData awsUpload(InputStream inputStream, ObjectMetadata metadata, String fileName, TenantEntity tenantEntity) { | ||||
| ResultData data = new ResultData(); | ResultData data = new ResultData(); | ||||
| @@ -286,14 +290,16 @@ public class QrCodeServiceImpl implements QrCodeService { | |||||
| String fn = UUID.randomUUID().toString(); | String fn = UUID.randomUUID().toString(); | ||||
| int dot = fileName.lastIndexOf('.'); | int dot = fileName.lastIndexOf('.'); | ||||
| String fileFormat = ""; | |||||
| if (dot >= 0) { | 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); | fn = getFileName(tenantEntity, fn + fileFormat); | ||||
| } else { | } else { | ||||
| fn = getFileName(tenantEntity, fn); | 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); | org.apache.commons.io.FileUtils.forceDelete(dest); | ||||
| return data; | return data; | ||||
| } catch (Exception e) { | } catch (Exception e) { | ||||