大型商城:商品详细
环境搭建
1.修改host文件 :item.mall.com
2.静态文件放到Nginx中
3.item.html文件放入gulimall-product的template下
4.修改 list.html和item.html中的href和src
模型抽取
将商品详细页面需要的属性值封装在:com.tinstu.gulimall.product.vo.SkuItemVo
规格参数的查询
销售属性的组合
com.tinstu.gulimall.product.service.impl.SkuInfoServiceImpl
详细页的渲染
在属性选择的时候,比如我选择 黑色 128g
两个属性包含的skuid都有9号(交集),那么黑色128g对应的skuid就是9
sku组合切换
这块的js代码 item.html
异步编排优化
线程池相关
1.新建一个 业务线程池 MyThreadConfig
@Controller
public class MyThreadConfig {
@Bean
public ThreadPoolExecutor threadPoolExecutor(){
return new ThreadPoolExecutor(
20,
200,
10,
TimeUnit.SECONDS,new LinkedBlockingDeque<>(100000),
Executors.defaultThreadFactory(),
new ThreadPoolExecutor.AbortPolicy()
);
}
}
如何上线程池中的值在配置文件中获取呢?
1.新建一个 ThreadPoolConfigProperties
@ConfigurationProperties(prefix = "gulimall.thread")
@Component
@Data
public class ThreadPoolConfigProperties {
private Integer coreSize;
private Integer maxSize;
private Integer keepAliveTime;
}
2.配置文件中写入
gulimall.thread.core-size=20
gulimall.thread.max-size=200
gulimall.thread.keep-alive-time=10
3.获取
业务代码的改造
改造之前的代码:
改造之后的代码:
阅读剩余
版权声明:
作者:Tin
链接:http://www.tinstu.com/2688.html
文章版权归作者所有,未经允许请勿转载。
THE END