| | |
| | | // 如果选择平台商品和查询结果对不上,提示错误 |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请正确选择平台商品!"); |
| | | } |
| | | List<Multifile> multifileList = new ArrayList<>(); |
| | | List<GoodsParam> goodsParamList = new ArrayList<>(); |
| | | for(BaseGoods model : goodsList){ |
| | | //遍历平台商品信息,进行商品信息同步 |
| | | Goods goods = initGoodsPlatParam(user,model,param); |
| | |
| | | } |
| | | goodsMapper.insert(goods); |
| | | //开始处理附件 |
| | | dealPlatMultifule(goods.getId(),user,model); |
| | | dealPlatMultifule(goods.getId(),user,model,multifileList); |
| | | //开始处理参数配置 |
| | | dealPlatGoodsParam(model,goods,user); |
| | | dealPlatGoodsParam(model,goods,user,goodsParamList); |
| | | } |
| | | |
| | | if(multifileList.size()>0){ |
| | | multifileMapper.insertBatch(multifileList); |
| | | } |
| | | if(goodsParamList.size()>0){ |
| | | goodsParamMapper.insertBatch(goodsParamList); |
| | | } |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | private void dealPlatGoodsParam(BaseGoods model, Goods goods, LoginUserInfo user) { |
| | | private void dealPlatGoodsParam(BaseGoods model, Goods goods, LoginUserInfo user,List<GoodsParam> paramList) { |
| | | BaseGoodsParam baseGoodsParam = new BaseGoodsParam(); |
| | | baseGoodsParam.setGoodsId(model.getId()); |
| | | baseGoodsParam.setIsdeleted(Constants.ZERO); |
| | |
| | | goodsParam.setVal(bgParam.getVal()); |
| | | goodsParam.setName(bgParam.getName()); |
| | | goodsParam.setPramaId(Objects.isNull(cateParam)?null:cateParam.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | paramList.add(goodsParam); |
| | | // goodsParamMapper.insert(goodsParam); |
| | | } |
| | | } |
| | | } |
| | |
| | | /** |
| | | * 开始处理平台商品关联附件,复制一套到企业商品上 |
| | | */ |
| | | private void dealPlatMultifule(Integer id, LoginUserInfo user, BaseGoods model) { |
| | | private void dealPlatMultifule(Integer id, LoginUserInfo user, BaseGoods model,List<Multifile> fileList ) { |
| | | Multifile f = new Multifile(); |
| | | f.setObjId(model.getId()); |
| | | f.setIsdeleted(Constants.ZERO); |
| | |
| | | multifile.setName(multifile.getName()); |
| | | multifile.setSortnum(multifile.getSortnum()); |
| | | multifile.setCompanyId(user.getCompanyId()); |
| | | multifileMapper.insert(multifile); |
| | | fileList.add(multifile); |
| | | // multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | } |
| | |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | goodsIPage.getRecords().forEach(i->{ |
| | | i.setCategoryImgurl(systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.CATEGORY_IMG).getCode() + i.getCategoryImgurl()); |
| | | i.setPrefixUrl(prefixUrl); |
| | | i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM "))); |
| | | i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>() |