Commit 23a78aa8 authored by fangxinjiang's avatar fangxinjiang

项目订单 附件上传

parent 44aba1d6
......@@ -553,30 +553,12 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
tOrderHandlerService.saveBatch(list);
}
if (save && ArrayUtils.isNotEmpty(vo.getFile())){
String fileName;
for (MultipartFile multipartFile : vo.getFile()) {
String fileName = System.currentTimeMillis() + "_" + multipartFile.getOriginalFilename();
fileName = System.currentTimeMillis() + "_" + multipartFile.getOriginalFilename();
//filePath不传默认存储空间的根目录
//支持的附件格式
String key = fileName;
boolean flag = ossUtil.uploadFileByStream(multipartFile.getInputStream(), key, null);
if (flag) {
log.info("文件:" + fileName + "上传至存储空间" + ossUtil.getBucketName() + "成功!");
TOrderEnclosure orderEnclosure = new TOrderEnclosure();
orderEnclosure.setOrderNo(order.getOrderNo());
orderEnclosure.setEnclosureName(multipartFile.getOriginalFilename());
orderEnclosure.setEnclosureFlag(CommonConstants.ZERO_INT);
orderEnclosure.setEnclosureAddress(key);
orderEnclosure.setDeleteFlag(CommonConstants.ZERO_INT);
try {
tOrderEnclosureService.save(orderEnclosure);
} catch (Exception e) {
log.error("订单接收OSS文件上传接口异常:" + e.getMessage());
ossUtil.deleteObject(null, key);
return R.failed("failed:" + e.getMessage());
}
} else {
return R.failed(OrderConstants.OPERATE_FAILED);
}
getObjectR(multipartFile.getInputStream(),vo.getOrderNo(),fileName,multipartFile.getOriginalFilename(),CommonConstants.ZERO_INT);
}
}
......@@ -682,7 +664,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
* @throws IOException
*/
@Override
public void receiveOrderNew(InputStream inputStream, String file1, String orderNo,String fileName,String originalFileName){
public void receiveOrderNew(InputStream inputStream, String file1, String orderNo, String fileName, String originalFileName){
R<Object> e;
if (file1.equals("fileOne")) {
getObjectR(inputStream, orderNo, fileName, originalFileName,CommonConstants.TWO_INTEGER);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment