| | |
| | | goods.setCategoryId(param.getCategoryId()); |
| | | //获取入手价格 |
| | | goods.setPrice(getPriceFromParam(model,param)); |
| | | goods.setZdPrice(model.getZdPrice());g |
| | | goods.setZdPrice(model.getZdPrice()); |
| | | goods.setRemark(model.getRemark()); |
| | | goods.setImgurl(model.getImgurl()); |
| | | goods.setBrandId(model.getBrandId()); |
| | |
| | | if (pageWrap.getModel().getBrandId() != null) { |
| | | queryWrapper.eq(Goods::getBrandId, pageWrap.getModel().getBrandId()); |
| | | } |
| | | |
| | | if (pageWrap.getModel().getCompanyId() != null) { |
| | | queryWrapper.eq(Goods::getCompanyId, pageWrap.getModel().getCompanyId()); |
| | | } |
| | | queryWrapper.orderByDesc(Goods::getId); |
| | | |
| | | IPage<Goods> goodsIPage = goodsJoinMapper.selectJoinPage(page, Goods.class, queryWrapper); |
| | | String prefixUrl = systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.FILE_DIR).getCode() |
| | | + systemDictDataBiz.queryByCode(Constants.SYSTEM, Constants.PROJECTS).getCode(); |
| | |
| | | //查询全部属性1和属性2规格值 |
| | | List<CateAttr> allAttr = cateAttrMapper.selectList(new QueryWrapper<>(ca)); |
| | | //属性1集合 |
| | | String[] attrs = StringUtils.defaultString(m.getAttrFirstNames(),"").split("\n"); |
| | | // String[] attrs = StringUtils.defaultString(m.getAttrFirstNames(),"").split("\n"); |
| | | //属性2集合 |
| | | String[] attrs2 = StringUtils.defaultString(m.getAttrSecodNames(),"").split("\n"); |
| | | // String[] attrs2 = StringUtils.defaultString(m.getAttrSecodNames(),"").split("\n"); |
| | | //产品参数集合 |
| | | String[] params = StringUtils.defaultString(m.getParamStr(),"").split("\n"); |
| | | if(attrs.length > 0){ |
| | | String attrids="" ,attrNames=""; |
| | | for(String s : attrs){ |
| | | if(StringUtils.isBlank(s)){ |
| | | continue; |
| | | } |
| | | //查询属性规格对象 |
| | | CateAttr ta = getCateAttrByName(s,Constants.ZERO,allAttr); |
| | | if(ta == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | } |
| | | if(StringUtils.isNotBlank(attrids)){ |
| | | attrids += ","; |
| | | attrNames += ","; |
| | | } |
| | | attrids+= ta.getId(); |
| | | attrNames+= ta.getName(); |
| | | } |
| | | newModel.setAttrFirstIds(attrids); |
| | | newModel.setAttrFirstNames(attrNames); |
| | | } |
| | | if(attrs2.length > 0){ |
| | | String attrids="" ,attrNames=""; |
| | | for(String s : attrs2){ |
| | | if(StringUtils.isBlank(s)){ |
| | | continue; |
| | | } |
| | | //查询属性规格对象 |
| | | CateAttr ta = getCateAttrByName(s,Constants.ONE,allAttr); |
| | | if(ta == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | } |
| | | if(StringUtils.isNotBlank(attrids)){ |
| | | attrids += ","; |
| | | attrNames += ","; |
| | | } |
| | | attrids+= ta.getId(); |
| | | attrNames+= ta.getName(); |
| | | } |
| | | newModel.setAttrSecodIds(attrids); |
| | | newModel.setAttrSecodNames(attrNames); |
| | | |
| | | } |
| | | // if(attrs.length > 0){ |
| | | // String attrids="" ,attrNames=""; |
| | | // for(String s : attrs){ |
| | | // if(StringUtils.isBlank(s)){ |
| | | // continue; |
| | | // } |
| | | // //查询属性规格对象 |
| | | // CateAttr ta = getCateAttrByName(s,Constants.ZERO,allAttr); |
| | | // if(ta == null){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | // } |
| | | // if(StringUtils.isNotBlank(attrids)){ |
| | | // attrids += ","; |
| | | // attrNames += ","; |
| | | // } |
| | | // attrids+= ta.getId(); |
| | | // attrNames+= ta.getName(); |
| | | // } |
| | | // newModel.setAttrFirstIds(attrids); |
| | | // newModel.setAttrFirstNames(attrNames); |
| | | // } |
| | | // if(attrs2.length > 0){ |
| | | // String attrids="" ,attrNames=""; |
| | | // for(String s : attrs2){ |
| | | // if(StringUtils.isBlank(s)){ |
| | | // continue; |
| | | // } |
| | | // //查询属性规格对象 |
| | | // CateAttr ta = getCateAttrByName(s,Constants.ONE,allAttr); |
| | | // if(ta == null){ |
| | | // throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,第【"+(num)+"】行属性1中【"+s+"】无效,请检查输入!"); |
| | | // } |
| | | // if(StringUtils.isNotBlank(attrids)){ |
| | | // attrids += ","; |
| | | // attrNames += ","; |
| | | // } |
| | | // attrids+= ta.getId(); |
| | | // attrNames+= ta.getName(); |
| | | // } |
| | | // newModel.setAttrSecodIds(attrids); |
| | | // newModel.setAttrSecodNames(attrNames); |
| | | // |
| | | // } |
| | | List<String> mulFiles = null; |
| | | String proDir =systemDictDataBiz.queryByCode(Constants.SYSTEM,Constants.PROJECTS).getCode(); |
| | | |
| | |
| | | gp.setSortnum(ta.getSortnum()); |
| | | //插入产品参数关联表 |
| | | goodsParamMapper.insert(gp); |
| | | //存储 cate_param_select 查询是否已存在 |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",gp.getPramaId()).eq("NAME",gp.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(gp.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(gp.getPramaId()); |
| | | cateParamSelect.setCategoryId(newModel.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | } |
| | | } |
| | | if(mulFiles !=null && mulFiles.size()>0){ |