/* 提交評價 */ @RequestMapping("/comment.do") public String comment(GOODS_COMMENT goods_comment, @RequestParam("files") MultipartFile[] files, ModelMap model) throws IOException { List<String> imgUrls = new ArrayList<String>(); String[] arrPath = commentPhoto.split("[.]"); String path = ""; int i, length = arrPath.length; for (i = 0; i < length; i++) { path += arrPath[i] + File.separator; } String filePhyPath = ServerUtil.getWebRoot() + File.separator + path + goods_comment.getOrderNo() + File.separator + goods_comment.getGoodsId(); if (!new File(filePhyPath).isDirectory()) { new File(filePhyPath).mkdirs(); } for (i = 0; i < files.length; i++) { FileUtils.writeByteArrayToFile(new File(filePhyPath + File.separator + i + ".png"), files[i].getBytes()); String imgUrl = "/trademall" + File.separator + path + goods_comment.getOrderNo() + File.separator + goods_comment.getGoodsId() + File.separator + i + ".png"; imgUrl = imgUrl.replaceAll("\\\\", "/"); imgUrls.add(imgUrl); } goodsService.comment(goods_comment, imgUrls); String message = new JsonResult(null, "提交評價成功", 200).toJson(); model.put("message", message); return "message"; }