|
@@ -148,24 +148,27 @@ public class YeepayController extends BaseController {
|
|
|
|
|
|
|
|
|
|
File file = new File("/var/tmp/" + multipartFile.getOriginalFilename());
|
|
File file = new File("/var/tmp/" + multipartFile.getOriginalFilename());
|
|
|
|
+ if (!file.getParentFile().exists()) {
|
|
|
|
+ file.getParentFile().mkdirs();
|
|
|
|
+ }
|
|
|
|
+ FileOutputStream fos = new FileOutputStream(file);
|
|
InputStream inputStream = multipartFile.getInputStream();
|
|
InputStream inputStream = multipartFile.getInputStream();
|
|
|
|
|
|
try {
|
|
try {
|
|
- if (!file.getParentFile().exists()) {
|
|
|
|
- file.getParentFile().mkdirs();
|
|
|
|
- }
|
|
|
|
- FileOutputStream fos = new FileOutputStream(file);
|
|
|
|
IOUtils.copy(inputStream, fos);
|
|
IOUtils.copy(inputStream, fos);
|
|
|
|
+ inputStream.close();
|
|
|
|
+ fos.close();
|
|
|
|
|
|
HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
|
|
HfMerchantConfig hfMerchantConfig = hfMerchantConfigService.queryByTenantId(TenantContextHolder.getTenantId(), PaymentChannelEnum.YEEPAY.getCode());
|
|
if(hfMerchantConfig == null){
|
|
if(hfMerchantConfig == null){
|
|
- throw new BizException("请配置机构的汇付商户信息");
|
|
|
|
|
|
+ throw new BizException("请配置机构的易宝商户信息");
|
|
}
|
|
}
|
|
|
|
|
|
return succeed(yeepayUploadService.upload(hfMerchantConfig, file));
|
|
return succeed(yeepayUploadService.upload(hfMerchantConfig, file));
|
|
} catch (Exception e) {
|
|
} catch (Exception e) {
|
|
return failed(e.getMessage());
|
|
return failed(e.getMessage());
|
|
} finally {
|
|
} finally {
|
|
|
|
+ IOUtils.closeQuietly(fos);
|
|
IOUtils.closeQuietly(inputStream);
|
|
IOUtils.closeQuietly(inputStream);
|
|
FileUtils.deleteQuietly(file);
|
|
FileUtils.deleteQuietly(file);
|
|
}
|
|
}
|