| | |
| | | package com.sinata.modular.mall.controller; |
| | | |
| | | import cn.hutool.core.util.ObjUtil; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.baomidou.mybatisplus.mapper.Wrapper; |
| | | import com.baomidou.mybatisplus.plugins.Page; |
| | | import com.sinata.common.enums.EnumIsDelete; |
| | | import com.sinata.common.enums.mall.EnumMallGoodsGroupType; |
| | | import com.sinata.common.enums.mall.EnumMallGoodsState; |
| | | import com.sinata.common.model.GroupSpecGoodsSkuJsonVo; |
| | | import com.sinata.core.base.controller.BaseController; |
| | | import com.sinata.core.base.tips.ErrorTip; |
| | | import com.sinata.core.common.annotion.BussinessLog; |
| | |
| | | .orElse(null) |
| | | ); |
| | | |
| | | String[] ids = (o.get("goodsIds") + "").split(","); |
| | | // String[] ids = (o.get("goodsIds") + "").split(","); |
| | | // o.put("goodsNames", goodsList.stream() |
| | | // .filter(ggg -> { |
| | | // for (String gid : ids) { |
| | | // if (gid.equals(ggg.getId() + "")) { |
| | | // return true; |
| | | // } |
| | | // } |
| | | // return false; |
| | | // }) |
| | | // .map(MallGoods::getGoodsName) |
| | | // .collect(Collectors.joining(","))); |
| | | |
| | | // 封装显示套餐规格组商品名称、数量 |
| | | List<GroupSpecGoodsSkuJsonVo> groupSpecGoodsSkuJsonVoList; |
| | | Object goodsSkuJson = o.get("goodsSkuJson"); |
| | | if (ObjUtil.isNotEmpty(goodsSkuJson)) { |
| | | groupSpecGoodsSkuJsonVoList = JSONUtil.parseArray(goodsSkuJson.toString()).toList(GroupSpecGoodsSkuJsonVo.class); |
| | | } else { |
| | | groupSpecGoodsSkuJsonVoList = null; |
| | | } |
| | | o.put("goodsNames", goodsList.stream() |
| | | .filter(ggg -> { |
| | | for (String gid : ids) { |
| | | if (gid.equals(ggg.getId() + "")) { |
| | | return true; |
| | | if (groupSpecGoodsSkuJsonVoList != null) { |
| | | for (GroupSpecGoodsSkuJsonVo groupSpecGoodsSkuJsonVo : groupSpecGoodsSkuJsonVoList) { |
| | | if (groupSpecGoodsSkuJsonVo.getGoodsId().equals(ggg.getId())) { |
| | | ggg.setStock(groupSpecGoodsSkuJsonVo.getGoodsNum()); |
| | | return true; |
| | | } |
| | | } |
| | | } |
| | | return false; |
| | | }) |
| | | .map(MallGoods::getGoodsName) |
| | | .map(ggg -> ggg.getGoodsName() + "x" + ggg.getStock()) |
| | | .collect(Collectors.joining(","))); |
| | | return o; |
| | | }).collect(Collectors.toList()); |