本周要干的事情
- 商户可以给打印机取名
- 批量导入excel
- 移动端全部、部分退款
- pc批量下载桌码
- 必点和起点量
- 商家小程序导入商品的校验
- 恢复商品详情
7月31日
1. 解决支付成功后,运营端订单详情状态仍为支付中的bug
merOrderNo
List<TblProOrderDetail> getProOrderDetail(String merCd, String merOrderNo) {
TblProOrderDetailExample example = new TblProOrderDetailExample();
TblProOrderDetailExample.Criteria criteria = example.createCriteria();
criteria.andMerCdEqualTo(merCd);
criteria.andMerOrderNoEqualTo(**merOrderNo**);
List<TblProOrderDetail> orderDetails = proOrderDetailMapper.selectByExample(example);
return orderDetails;
}
2. 优化获取商品列表接口
由900ms 降低至 200ms
if (goodsList.size() > 0) {
for (TblGoodsSpu tblGoodsSpu : goodsList) {
String goodsId = tblGoodsSpu.getGoodsId();
TblGoodsSkuExample ex = new TblGoodsSkuExample();
TblGoodsSkuExample.Criteria cri = ex.createCriteria();
cri.andGoodsIdEqualTo(goodsId);
List<TblGoodsSku> skuList = tblGoodsSkuMapper.selectByExample(ex);
tblGoodsSpu.setSkuList(skuList);
//查询全部库存
BigDecimal stockNum = tblGoodsSkuMapper.selectAllStockByGoodsId(goodsId);
tblGoodsSpu.setStockNum(stockNum);
}
return CallbackBody.ok(goodsList);
}
// 构建goodsIDList
List<String> goodsIDList = new ArrayList<>();
for (TblGoodsSpu goodsSpu : goodsList) {
goodsIDList.add(goodsSpu.getGoodsId());
}
if (goodsList.size() > 0) {
// 将goodsIDList全部查出来
TblGoodsSkuExample ex = new TblGoodsSkuExample();
TblGoodsSkuExample.Criteria cri = ex.createCriteria();
cri.andGoodsIdIn(goodsIDList);
List<TblGoodsSku> skuList = tblGoodsSkuMapper.selectByExample(ex);
// 一次性查出sku,组装
// 将list转成以goodsID为key,list为value的map
Map<String, List<TblGoodsSku>> skuMap = skuList.stream().collect(Collectors.groupingBy(TblGoodsSku::getGoodsId, Collectors.mapping(item -> item, Collectors.toList())));
// 一次性查出库存,组装
List<GoodsStockNum> stockNumList = tblGoodsSkuMapper.selectAllStockByGoodsIdList(goodsIDList);
// 转成map,sql保证不会有重复key
Map<String, BigDecimal> stockNumMap = stockNumList.stream().collect(Collectors.toMap(GoodsStockNum::getGoodsId, GoodsStockNum::getStockNum));
for (TblGoodsSpu spu : goodsList) {
String goodsId = spu.getGoodsId();
spu.setSkuList(skuMap.getOrDefault(goodsId, Collections.emptyList()));
//查询全部库存
spu.setStockNum(stockNumMap.getOrDefault(goodsId, BigDecimal.ZERO));
}
return CallbackBody.ok(goodsList);
}
8月1日
- C端首页性能优化,以火锅店为例,当商品数到150时,会出现卡顿
- 打印机备注功能
- 批量导入 excel读取内容
8月2日
- 尝试使用小程序原生,来搭建商品详情页,测试卡不卡
- 比较两种方案的优缺点
- 继续做excel批量导入,【图片读取与校验】
- 学习MySQL实现自增的序列(Sequence)
8月3日
- Excel导入接口搞定
- 在商服小程序和PC上,接入接口