|
|
@@ -14,6 +14,7 @@ import me.zhengjie.appapi.util.BeanCopyUtils;
|
|
|
import me.zhengjie.appapi.util.DateUtils;
|
|
|
import me.zhengjie.appapi.util.FileUploadUtil;
|
|
|
import me.zhengjie.appapi.util.StatusEnum;
|
|
|
+import me.zhengjie.appapi.util.StatusEnum.StepStatusEnum;
|
|
|
import me.zhengjie.appapi.vo.FileVo;
|
|
|
import me.zhengjie.base.ResultCode;
|
|
|
import me.zhengjie.modules.security.service.dto.JwtUserDto;
|
|
|
@@ -553,29 +554,35 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public BaseResponse uploadNotarization(FileVo file) {
|
|
|
+
|
|
|
BaseResponse response = new BaseResponse<>();
|
|
|
- String uploadFileName = file.getFile().getOriginalFilename();
|
|
|
- int index = uploadFileName.lastIndexOf(".");
|
|
|
- String suffix = uploadFileName.substring(index);
|
|
|
- String fileName = file.getFileName() + suffix;
|
|
|
- String filePath = AppConfigInfo.APP_UPLOAD_PATH + "notarization/" + fileName;
|
|
|
- String fileUrl = "notarization/" + fileName;
|
|
|
- File fullPath = new File(filePath);
|
|
|
- if (fullPath.exists()) {
|
|
|
- response.fail(ResultCode.FILE_EXISTING);
|
|
|
- }
|
|
|
- try {
|
|
|
- FileUtils.copyInputStreamToFile(file.getFile().getInputStream(), fullPath);
|
|
|
- } catch (Exception e) {
|
|
|
- e.printStackTrace();
|
|
|
- response.fail(ResultCode.INTERFACE_INNER_INVOKE_ERROR);
|
|
|
- }
|
|
|
+// String uploadFileName = file.getFile().getOriginalFilename();
|
|
|
+// int index = uploadFileName.lastIndexOf(".");
|
|
|
+// String suffix = uploadFileName.substring(index);
|
|
|
+// String fileName = file.getFileName() + suffix;
|
|
|
+// String filePath = AppConfigInfo.APP_UPLOAD_PATH + "notarization/" + fileName;
|
|
|
+// String fileUrl = "notarization/" + fileName;
|
|
|
+// File fullPath = new File(filePath);
|
|
|
+// if (fullPath.exists()) {
|
|
|
+// response.fail(ResultCode.FILE_EXISTING);
|
|
|
+// }
|
|
|
+// try {
|
|
|
+// FileUtils.copyInputStreamToFile(file.getFile().getInputStream(), fullPath);
|
|
|
+// } catch (Exception e) {
|
|
|
+// e.printStackTrace();
|
|
|
+// response.fail(ResultCode.INTERFACE_INNER_INVOKE_ERROR);
|
|
|
+// }
|
|
|
+
|
|
|
QueryWrapper<OrderDocEntity> orderDocQw = new QueryWrapper<>();
|
|
|
orderDocQw.eq("contract_id", file.getContractId());
|
|
|
OrderDocEntity orderDoc = orderDocMapper.selectOne(orderDocQw);
|
|
|
+ String path = orderDoc.getBusinessNo()+ "/" + StepStatusEnum.getType(orderDoc.getContractId()) + "/" ;
|
|
|
+ file.setFilePath(path);
|
|
|
+ String filePath = FileUploadUtil.upload(file);
|
|
|
+
|
|
|
OrderDocEntity saveOrderDoc = new OrderDocEntity();
|
|
|
saveOrderDoc.setId(orderDoc.getId());
|
|
|
- saveOrderDoc.setAuthNotarization(fileUrl);
|
|
|
+ saveOrderDoc.setAuthNotarization(filePath);
|
|
|
orderDocMapper.updateById(saveOrderDoc);
|
|
|
updateStatusPass(file.getContractId(), orderDoc.getBusinessNo());
|
|
|
return response;
|
|
|
@@ -705,7 +712,6 @@ public class NotaryOrderServiceImpl extends ServiceImpl<NotaryOrderMapper, Notar
|
|
|
|
|
|
public String getPreviewUrl(String path) {
|
|
|
|
|
|
-
|
|
|
return FileUploadUtil.getPreviewUrl(path);
|
|
|
}
|
|
|
|