|
@@ -830,7 +830,7 @@ public class ApiRepairBillController extends BaseFormController {
|
|
|
*/
|
|
|
@RequestMapping(value = "/completeBill")
|
|
|
@ResponseBody
|
|
|
- public AppResultDto completeBill(@RequestParam("id") Long id,MultipartHttpServletRequest request) {
|
|
|
+ public AppResultDto completeBill(@RequestParam("id") Long id,HttpServletRequest request) {
|
|
|
|
|
|
|
|
|
String userName = baseRedisService.get(request.getHeader("token"));
|
|
@@ -854,31 +854,37 @@ public class ApiRepairBillController extends BaseFormController {
|
|
|
//完成订单增加两个字段
|
|
|
bill.setCompleteDesc(completeDesc);
|
|
|
|
|
|
- String completePhotoUrl = "";
|
|
|
- Iterator<String> fileNames = request.getFileNames();
|
|
|
- while (fileNames.hasNext()) {
|
|
|
- MultipartFile multipartFile = request.getFile(fileNames.next());
|
|
|
-
|
|
|
- //获得文件原始名称
|
|
|
- InputStream stream = null;
|
|
|
- String fileExt = null;
|
|
|
- String fileName = "";
|
|
|
- if (multipartFile != null) {
|
|
|
- stream = multipartFile.getInputStream();
|
|
|
- fileName = multipartFile.getOriginalFilename();
|
|
|
- fileName = new String(fileName.getBytes(), "utf-8");
|
|
|
- fileExt = StringUtils.isNotEmpty(fileName) ? fileName
|
|
|
- .substring(fileName.lastIndexOf("."))
|
|
|
- : StringUtils.EMPTY;
|
|
|
+ if (request instanceof MultipartHttpServletRequest){
|
|
|
+
|
|
|
+ MultipartHttpServletRequest multiRequest = (MultipartHttpServletRequest) request;
|
|
|
+
|
|
|
+ String completePhotoUrl = "";
|
|
|
+ Iterator<String> fileNames = multiRequest.getFileNames();
|
|
|
+ while (fileNames.hasNext()) {
|
|
|
+ MultipartFile multipartFile = multiRequest.getFile(fileNames.next());
|
|
|
+
|
|
|
+ //获得文件原始名称
|
|
|
+ InputStream stream = null;
|
|
|
+ String fileExt = null;
|
|
|
+ String fileName = "";
|
|
|
+ if (multipartFile != null) {
|
|
|
+ stream = multipartFile.getInputStream();
|
|
|
+ fileName = multipartFile.getOriginalFilename();
|
|
|
+ fileName = new String(fileName.getBytes(), "utf-8");
|
|
|
+ fileExt = StringUtils.isNotEmpty(fileName) ? fileName
|
|
|
+ .substring(fileName.lastIndexOf("."))
|
|
|
+ : StringUtils.EMPTY;
|
|
|
+ }
|
|
|
+
|
|
|
+ FileUploadUtils fileUploadUtils = new FileUploadUtils();
|
|
|
+ fileUploadUtils.init();
|
|
|
+ String url = fileUploadUtils.uploadFile(stream, fileExt);
|
|
|
+ completePhotoUrl += ";" + fileUploadUtils.fullVisitPath(url);
|
|
|
+ }
|
|
|
+ if (completePhotoUrl.length() > 1) {
|
|
|
+ bill.setCompletePhotoUrl(completePhotoUrl.substring(1));
|
|
|
}
|
|
|
|
|
|
- FileUploadUtils fileUploadUtils = new FileUploadUtils();
|
|
|
- fileUploadUtils.init();
|
|
|
- String url = fileUploadUtils.uploadFile(stream, fileExt);
|
|
|
- completePhotoUrl += ";" + fileUploadUtils.fullVisitPath(url);
|
|
|
- }
|
|
|
- if (completePhotoUrl.length() > 1) {
|
|
|
- bill.setCompletePhotoUrl(completePhotoUrl.substring(1));
|
|
|
}
|
|
|
|
|
|
|