how2j.cn

下载区
文件名 文件大小
请先登录 443k
增值内容 443k
443k
使用站长秘制下载工具
步骤 1 : 先运行,看到效果,再学习   
步骤 2 : 模仿和排错   
步骤 3 : 结算页操作   
步骤 4 : 运行效果   
步骤 5 : OrderService   
步骤 6 : ForeRESTController.createOrder   
步骤 7 : 确认支付页   
步骤 8 : 支付成功页   

步骤 1 :

先运行,看到效果,再学习

edit
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
结算页操作
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
运行效果
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
package com.how2java.tmall.service; import com.how2java.tmall.dao.OrderDAO; import com.how2java.tmall.pojo.Order; import com.how2java.tmall.pojo.OrderItem; import com.how2java.tmall.util.Page4Navigator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Propagation; import org.springframework.transaction.annotation.Transactional; import java.util.List; @Service public class OrderService { public static final String waitPay = "waitPay"; public static final String waitDelivery = "waitDelivery"; public static final String waitConfirm = "waitConfirm"; public static final String waitReview = "waitReview"; public static final String finish = "finish"; public static final String delete = "delete"; @Autowired OrderDAO orderDAO; @Autowired OrderItemService orderItemService; public Page4Navigator<Order> list(int start, int size, int navigatePages) { Sort sort = new Sort(Sort.Direction.DESC, "id"); Pageable pageable = new PageRequest(start, size,sort); Page pageFromJPA =orderDAO.findAll(pageable); return new Page4Navigator<>(pageFromJPA,navigatePages); } public void removeOrderFromOrderItem(List<Order> orders) { for (Order order : orders) { removeOrderFromOrderItem(order); } } private void removeOrderFromOrderItem(Order order) { List<OrderItem> orderItems= order.getOrderItems(); for (OrderItem orderItem : orderItems) { orderItem.setOrder(null); } } public Order get(int oid) { return orderDAO.findOne(oid); } public void update(Order bean) { orderDAO.save(bean); } @Transactional(propagation= Propagation.REQUIRED,rollbackForClassName="Exception") public float add(Order order, List<OrderItem> ois) { float total = 0; add(order); if(false) throw new RuntimeException(); for (OrderItem oi: ois) { oi.setOrder(order); orderItemService.update(oi); total+=oi.getProduct().getPromotePrice()*oi.getNumber(); } return total; } public void add(Order order) { orderDAO.save(order); } }
步骤 6 :

ForeRESTController.createOrder

edit
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
@PostMapping("forecreateOrder") public Object createOrder(@RequestBody Order order,HttpSession session){ User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); Map<String,Object> map = new HashMap<>(); map.put("oid", order.getId()); map.put("total", total); return Result.success(map); }
package com.how2java.tmall.web; import com.how2java.tmall.comparator.*; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import com.how2java.tmall.util.Result; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.*; @RestController public class ForeRESTController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @Autowired OrderService orderService; @GetMapping("/forehome") public Object home() { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); categoryService.removeCategoryFromProduct(cs); return cs; } @PostMapping("/foreregister") public Object register(@RequestBody User user) { String name = user.getName(); String password = user.getPassword(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String message ="用户名已经被使用,不能使用"; return Result.fail(message); } user.setPassword(password); userService.add(user); return Result.success(); } @PostMapping("/forelogin") public Object login(@RequestBody User userParam, HttpSession session) { String name = userParam.getName(); name = HtmlUtils.htmlEscape(name); User user =userService.get(name,userParam.getPassword()); if(null==user){ String message ="账号密码错误"; return Result.fail(message); } else{ session.setAttribute("user", user); return Result.success(); } } @GetMapping("/foreproduct/{pid}") public Object product(@PathVariable("pid") int pid) { Product product = productService.get(pid); List<ProductImage> productSingleImages = productImageService.listSingleProductImages(product); List<ProductImage> productDetailImages = productImageService.listDetailProductImages(product); product.setProductSingleImages(productSingleImages); product.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(product); List<Review> reviews = reviewService.list(product); productService.setSaleAndReviewNumber(product); productImageService.setFirstProdutImage(product); Map<String,Object> map= new HashMap<>(); map.put("product", product); map.put("pvs", pvs); map.put("reviews", reviews); return Result.success(map); } @GetMapping("forecheckLogin") public Object checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return Result.success(); return Result.fail("未登录"); } @GetMapping("forecategory/{cid}") public Object category(@PathVariable int cid,String sort) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); categoryService.removeCategoryFromProduct(c); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } return c; } @PostMapping("foresearch") public Object search( String keyword){ if(null==keyword) keyword = ""; List<Product> ps= productService.search(keyword,0,20); productImageService.setFirstProdutImages(ps); productService.setSaleAndReviewNumber(ps); return ps; } @GetMapping("forebuyone") public Object buyone(int pid, int num, HttpSession session) { return buyoneAndAddCart(pid,num,session); } private int buyoneAndAddCart(int pid, int num, HttpSession session) { Product product = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setProduct(product); oi.setNumber(num); orderItemService.add(oi); oiid = oi.getId(); } return oiid; } @GetMapping("forebuy") public Object buy(String[] oiid,HttpSession session){ List<OrderItem> orderItems = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); orderItems.add(oi); } productImageService.setFirstProdutImagesOnOrderItems(orderItems); session.setAttribute("ois", orderItems); Map<String,Object> map = new HashMap<>(); map.put("orderItems", orderItems); map.put("total", total); return Result.success(map); } @GetMapping("foreaddCart") public Object addCart(int pid, int num, HttpSession session) { buyoneAndAddCart(pid,num,session); return Result.success(); } @GetMapping("forecart") public Object cart(HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user); productImageService.setFirstProdutImagesOnOrderItems(ois); return ois; } @GetMapping("forechangeOrderItem") public Object changeOrderItem( HttpSession session, int pid, int num) { User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); List<OrderItem> ois = orderItemService.listByUser(user); for (OrderItem oi : ois) { if(oi.getProduct().getId()==pid){ oi.setNumber(num); orderItemService.update(oi); break; } } return Result.success(); } @GetMapping("foredeleteOrderItem") public Object deleteOrderItem(HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); orderItemService.delete(oiid); return Result.success(); } @PostMapping("forecreateOrder") public Object createOrder(@RequestBody Order order,HttpSession session){ User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); Map<String,Object> map = new HashMap<>(); map.put("oid", order.getId()); map.put("total", total); return Result.success(map); } }
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
确认支付页
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head th:include="include/fore/header::html" ></head> <body> <div id="workingArea"> <div th:replace="include/fore/top::html" ></div> <div th:replace="include/fore/simpleSearch::html" ></div> <div th:replace="include/fore/cart/alipayPage::html" ></div> <div th:replace="include/fore/footer::html" ></div> </div> </body> </html>
<div th:fragment="html"> <script> $(function(){ var oid = getUrlParms("oid"); var total = getUrlParms("total"); var data4Vue = { oid:'', total:'' }; //ViewModel var vue = new Vue({ el: '#workingArea', data: data4Vue, mounted:function(){ //mounted 表示这个 Vue 对象加载成功了 this.oid = oid; this.total = total; } }); }) </script> <div class="aliPayPageDiv"> <div class="aliPayPageLogo"> <img class="pull-left" src="img/site/simpleLogo.png"> <div style="clear:both"></div> </div> <div> <span class="confirmMoneyText">扫一扫付款(元)</span> <span class="confirmMoney"> ¥ {{total|formatMoneyFilter}} </span> </div> <div> <img class="aliPayImg" src="img/site/alipay2wei.png"> </div> <div> <a :href="'payed?oid='+oid+'&total='+total"><button class="confirmPay">确认支付</button></a> </div> </div> </div>
增值内容,请先登录
完整的 Springboot 模仿天猫项目,使用 Springboot 、Vue.js、shiro、redis、elasticsearch 等一整套技术栈, 从无到有涵盖全部129个知识点,564个开发步骤, 充实 Springboot 项目经验,为简历加上一个有吸引力的砝码.
增值内容,点击购买
使用爬虫已经被系统记录,请勿使用爬虫,增大封号风险。 如果是误封 ,请联系站长,谢谢
支付成功页
<!DOCTYPE html> <html xmlns:th="http://www.thymeleaf.org"> <head th:include="include/fore/header::html" ></head> <body> <div id="workingArea"> <div th:replace="include/fore/top::html" ></div> <div th:replace="include/fore/simpleSearch::html" ></div> <div th:replace="include/fore/cart/payedPage::html" ></div> <div th:replace="include/fore/footer::html" ></div> </div> </body> </html>
<div th:fragment="html"> <script> $(function(){ var oid = getUrlParms("oid"); var total = getUrlParms("total"); var data4Vue = { uri:'forepayed', order:[], total:0 }; //ViewModel var vue = new Vue({ el: '#workingArea', data: data4Vue, mounted:function(){ //mounted 表示这个 Vue 对象加载成功了 this.total = total; this.load(); }, methods: { load:function(){ var url = this.uri+"?oid="+oid; axios.get(url).then(function(response) { vue.order = response.data; }); } } }); }) </script> <div class="payedDiv"> <div class="payedTextDiv"> <img src="img/site/paySuccess.png"> <span>您已成功付款</span> </div> <div class="payedAddressInfo"> <ul> <li>收货地址:{{order.address}} {{order.receiver}} {{order.mobile }}</li> <li>实付款:<span class="payedInfoPrice"> {{total|formatMoney}} </li> <li>预计08月08日送达 </li> </ul> <div class="paedCheckLinkDiv"> 您可以 <a class="payedCheckLink" href="bought">查看已买到的宝贝</a> <a class="payedCheckLink" href="bought">查看交易详情 </a> </div> </div> <div class="payedSeperateLine"> </div> <div class="warningDiv"> <img src="img/site/warning.png"> <b>安全提醒:</b>下单后,<span class="redColor boldWord">用QQ给您发送链接办理退款的都是骗子!</span>天猫不存在系统升级,订单异常等问题,谨防假冒客服电话诈骗! </div> </div> </div>
@GetMapping("forepayed") public Object payed(int oid) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); return order; }
package com.how2java.tmall.web; import com.how2java.tmall.comparator.*; import com.how2java.tmall.pojo.*; import com.how2java.tmall.service.*; import com.how2java.tmall.util.Result; import org.apache.commons.lang.math.RandomUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.*; import org.springframework.web.util.HtmlUtils; import javax.servlet.http.HttpSession; import java.text.SimpleDateFormat; import java.util.*; @RestController public class ForeRESTController { @Autowired CategoryService categoryService; @Autowired ProductService productService; @Autowired UserService userService; @Autowired ProductImageService productImageService; @Autowired PropertyValueService propertyValueService; @Autowired OrderItemService orderItemService; @Autowired ReviewService reviewService; @Autowired OrderService orderService; @GetMapping("/forehome") public Object home() { List<Category> cs= categoryService.list(); productService.fill(cs); productService.fillByRow(cs); categoryService.removeCategoryFromProduct(cs); return cs; } @PostMapping("/foreregister") public Object register(@RequestBody User user) { String name = user.getName(); String password = user.getPassword(); name = HtmlUtils.htmlEscape(name); user.setName(name); boolean exist = userService.isExist(name); if(exist){ String message ="用户名已经被使用,不能使用"; return Result.fail(message); } user.setPassword(password); userService.add(user); return Result.success(); } @PostMapping("/forelogin") public Object login(@RequestBody User userParam, HttpSession session) { String name = userParam.getName(); name = HtmlUtils.htmlEscape(name); User user =userService.get(name,userParam.getPassword()); if(null==user){ String message ="账号密码错误"; return Result.fail(message); } else{ session.setAttribute("user", user); return Result.success(); } } @GetMapping("/foreproduct/{pid}") public Object product(@PathVariable("pid") int pid) { Product product = productService.get(pid); List<ProductImage> productSingleImages = productImageService.listSingleProductImages(product); List<ProductImage> productDetailImages = productImageService.listDetailProductImages(product); product.setProductSingleImages(productSingleImages); product.setProductDetailImages(productDetailImages); List<PropertyValue> pvs = propertyValueService.list(product); List<Review> reviews = reviewService.list(product); productService.setSaleAndReviewNumber(product); productImageService.setFirstProdutImage(product); Map<String,Object> map= new HashMap<>(); map.put("product", product); map.put("pvs", pvs); map.put("reviews", reviews); return Result.success(map); } @GetMapping("forecheckLogin") public Object checkLogin( HttpSession session) { User user =(User) session.getAttribute("user"); if(null!=user) return Result.success(); return Result.fail("未登录"); } @GetMapping("forecategory/{cid}") public Object category(@PathVariable int cid,String sort) { Category c = categoryService.get(cid); productService.fill(c); productService.setSaleAndReviewNumber(c.getProducts()); categoryService.removeCategoryFromProduct(c); if(null!=sort){ switch(sort){ case "review": Collections.sort(c.getProducts(),new ProductReviewComparator()); break; case "date" : Collections.sort(c.getProducts(),new ProductDateComparator()); break; case "saleCount" : Collections.sort(c.getProducts(),new ProductSaleCountComparator()); break; case "price": Collections.sort(c.getProducts(),new ProductPriceComparator()); break; case "all": Collections.sort(c.getProducts(),new ProductAllComparator()); break; } } return c; } @PostMapping("foresearch") public Object search( String keyword){ if(null==keyword) keyword = ""; List<Product> ps= productService.search(keyword,0,20); productImageService.setFirstProdutImages(ps); productService.setSaleAndReviewNumber(ps); return ps; } @GetMapping("forebuyone") public Object buyone(int pid, int num, HttpSession session) { return buyoneAndAddCart(pid,num,session); } private int buyoneAndAddCart(int pid, int num, HttpSession session) { Product product = productService.get(pid); int oiid = 0; User user =(User) session.getAttribute("user"); boolean found = false; List<OrderItem> ois = orderItemService.listByUser(user); for (OrderItem oi : ois) { if(oi.getProduct().getId()==product.getId()){ oi.setNumber(oi.getNumber()+num); orderItemService.update(oi); found = true; oiid = oi.getId(); break; } } if(!found){ OrderItem oi = new OrderItem(); oi.setUser(user); oi.setProduct(product); oi.setNumber(num); orderItemService.add(oi); oiid = oi.getId(); } return oiid; } @GetMapping("forebuy") public Object buy(String[] oiid,HttpSession session){ List<OrderItem> orderItems = new ArrayList<>(); float total = 0; for (String strid : oiid) { int id = Integer.parseInt(strid); OrderItem oi= orderItemService.get(id); total +=oi.getProduct().getPromotePrice()*oi.getNumber(); orderItems.add(oi); } productImageService.setFirstProdutImagesOnOrderItems(orderItems); session.setAttribute("ois", orderItems); Map<String,Object> map = new HashMap<>(); map.put("orderItems", orderItems); map.put("total", total); return Result.success(map); } @GetMapping("foreaddCart") public Object addCart(int pid, int num, HttpSession session) { buyoneAndAddCart(pid,num,session); return Result.success(); } @GetMapping("forecart") public Object cart(HttpSession session) { User user =(User) session.getAttribute("user"); List<OrderItem> ois = orderItemService.listByUser(user); productImageService.setFirstProdutImagesOnOrderItems(ois); return ois; } @GetMapping("forechangeOrderItem") public Object changeOrderItem( HttpSession session, int pid, int num) { User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); List<OrderItem> ois = orderItemService.listByUser(user); for (OrderItem oi : ois) { if(oi.getProduct().getId()==pid){ oi.setNumber(num); orderItemService.update(oi); break; } } return Result.success(); } @GetMapping("foredeleteOrderItem") public Object deleteOrderItem(HttpSession session,int oiid){ User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); orderItemService.delete(oiid); return Result.success(); } @PostMapping("forecreateOrder") public Object createOrder(@RequestBody Order order,HttpSession session){ User user =(User) session.getAttribute("user"); if(null==user) return Result.fail("未登录"); String orderCode = new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + RandomUtils.nextInt(10000); order.setOrderCode(orderCode); order.setCreateDate(new Date()); order.setUser(user); order.setStatus(OrderService.waitPay); List<OrderItem> ois= (List<OrderItem>) session.getAttribute("ois"); float total =orderService.add(order,ois); Map<String,Object> map = new HashMap<>(); map.put("oid", order.getId()); map.put("total", total); return Result.success(map); } @GetMapping("forepayed") public Object payed(int oid) { Order order = orderService.get(oid); order.setStatus(OrderService.waitDelivery); order.setPayDate(new Date()); orderService.update(order); return order; } }


HOW2J公众号,关注后实时获知布最新的教程和优惠活动,谢谢。


问答区域    
2019-01-25 总价(total) 数据是否安全
玩玩乐就荒废



for (OrderItem oi : ois) { oi.setOrder(order); orderItemService.update(oi); total += oi.getProduct().getPromotePrice()*oi.getNumber(); } 老师: ois 是前端传送来的 ,后端直接遍历获取总价,这里的数据是否安全?,orderItem中的产品价格会不会被用户篡改?然后我们算总价就会不正确,这样不就亏了~ 这些产品的价格是不是要去数据库中取出更安全? 请站长大大解答!
@Transactional(propagation= Propagation.REQUIRED,rollbackForClassName="Exception")
    public float add(Order order,List<OrderItem> ois) {
    	float total = 0;
    	add(order);
    	
    	if(false)
    		throw new RuntimeException();
    	for (OrderItem oi : ois) {
    		oi.setOrder(order);
    		orderItemService.update(oi);
    		total += oi.getProduct().getPromotePrice()*oi.getNumber();
			
		}
    	return total;
    }

							


3 个答案

how2j 答案时间:2019-01-27
用户只是提交 orderItem id, 然后在服务器间接得获取到 产品信息。 用户如何能直接控制价格呢? 不能的呢

玩玩乐就荒废 答案时间:2019-01-26
@RK双枪 您好谢谢您的解答, 您的意思 就是把东西存在session中是(绝对的)安全的是吧

RK双枪 答案时间:2019-01-25
ois不是从前端传过来的,是从session中取的,session是存在你的tomcat中的,前端是改不了的,小兄嘚 取ois的位置是com.how2java.tmall.web.ForeRESTController.createOrder(Order, HttpSession) 存ois的位置是com.how2java.tmall.web.ForeRESTController.buy(String[], HttpSession) (这里是从数据库取出来的) 解答来自.............RK双枪 0.o



回答已经提交成功,正在审核。 请于 我的回答 处查看回答记录,谢谢
答案 或者 代码至少填写一项, 如果是自己有问题,请重新提问,否则站长有可能看不到









提问之前请登陆
提问已经提交成功,正在审核。 请于 我的提问 处查看提问记录,谢谢
关于 实践项目-天猫整站Springboot-生成订单 的提问

尽量提供截图代码异常信息,有助于分析和解决问题。 也可进本站QQ群交流: 984886441
提问尽量提供完整的代码,环境描述,越是有利于问题的重现,您的问题越能更快得到解答。
对教程中代码有疑问,请提供是哪个步骤,哪一行有疑问,这样便于快速定位问题,提高问题得到解答的速度
在已经存在的几千个提问里,有相当大的比例,是因为使用了和站长不同版本的开发环境导致的,比如 jdk, eclpise, idea, mysql,tomcat 等等软件的版本不一致。
请使用和站长一样的版本,可以节约自己大量的学习时间。 站长把教学中用的软件版本整理了,都统一放在了这里, 方便大家下载: http://how2j.cn/k/helloworld/helloworld-version/1718.html

上传截图