| | |
| | | @Autowired |
| | | private CategoryMapper categoryMapper; |
| | | @Autowired |
| | | private BaseCategoryMapper baseCategoryMapper; |
| | | @Autowired |
| | | private CateAttrMapper cateAttrMapper; |
| | | @Autowired |
| | | private CateParamMapper cateParamMapper; |
| | |
| | | if(category.getPlatCateId() == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请前往【类别管理】先关联平台类别!"); |
| | | } |
| | | BaseCategory baseCategory = baseCategoryMapper.selectById(category.getPlatCateId()); |
| | | if(baseCategory == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请前往【类别管理】先关联平台类别!"); |
| | | } |
| | | |
| | | BaseGoods bp = new BaseGoods(); |
| | | bp.setCategoryId(category.getPlatCateId()); |
| | | bp.setIsdeleted(Constants.ZERO); |
| | |
| | | try{ |
| | | for(BaseGoods model : goodsList){ |
| | | //遍历平台商品信息,进行商品信息同步 |
| | | //分类加价系数 |
| | | |
| | | model.setCateRatePrice(baseCategory.getPriceRate()); |
| | | Goods goods = initGoodsPlatParam(user,model,param); |
| | | if(goods == null){ |
| | | continue; |
| | |
| | | throw new BusinessException(ResponseStatus.DATA_ERRO.getCode(),"数据异常请刷新重试"); |
| | | } |
| | | //如果没有配置入手价,安装加价系数来计算 |
| | | // if(model.getCateRatePrice()==null){ |
| | | // model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate()); |
| | | // } |
| | | if(model.getCateRatePrice()==null){ |
| | | model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate()); |
| | | } |
| | | //返回 .multiply(model.getCateRatePrice()) |
| | | return (Constants.formatBigdecimal(model.getPrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING); |
| | | return (Constants.formatBigdecimal(model.getPrice()).multiply(model.getCateRatePrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING); |
| | | |
| | | } |
| | | |
| | |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.OSS, Constants.RESOURCE_PATH).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.OSS, Constants.GOODS_IMG).getCode(); |
| | | goodsList.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( |