| | |
| | | import com.doumee.dao.business.*; |
| | | import com.doumee.dao.business.join.GoodsJoinMapper; |
| | | import com.doumee.dao.business.model.*; |
| | | import com.doumee.dao.business.model.dto.BatchDisableDTO; |
| | | import com.doumee.dao.business.model.dto.GoodCreatePlatRequest; |
| | | import com.doumee.dao.business.model.dto.GoodsRequest; |
| | | import com.doumee.dao.business.model.dto.PlatGoodsParam; |
| | | import com.doumee.service.business.GoodsService; |
| | | import com.github.yulichang.wrapper.MPJLambdaWrapper; |
| | | import org.apache.commons.lang3.StringUtils; |
| | |
| | | import java.io.File; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.io.UnsupportedEncodingException; |
| | | import java.math.BigDecimal; |
| | | import java.net.URLEncoder; |
| | | import java.nio.charset.Charset; |
| | | import java.util.ArrayList; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * 商品信息表Service实现 |
| | |
| | | |
| | | @Autowired |
| | | private GoodsMapper goodsMapper; |
| | | @Autowired |
| | | private BaseGoodsMapper baseGoodsMapper; |
| | | @Autowired |
| | | private BaseGoodsParamMapper baseGoodsParamMapper; |
| | | @Autowired |
| | | private CategoryMapper categoryMapper; |
| | | @Autowired |
| | |
| | | |
| | | @Autowired |
| | | private GoodsJoinMapper goodsJoinMapper; |
| | | @Autowired |
| | | private CateParamSelectMapper cateParamSelectMapper; |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | |
| | | @Override |
| | | public Integer createPlat(GoodCreatePlatRequest param){ |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(Constants.equalsInteger(user.getType(), Constants.UserType.COMPANY.getKey())){ |
| | | if(!Constants.equalsInteger(user.getType(), Constants.UserType.COMPANY.getKey())){ |
| | | //非企业用户不能操作 |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED); |
| | | } |
| | |
| | | || param.getGoodsParamList().size()==0))){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST); |
| | | } |
| | | Goods goods = new Goods(); |
| | | Category category = categoryMapper.selectById(param.getCategoryId()); |
| | | if(category ==null ||Constants.equalsInteger(category.getIsdeleted(), Constants.ONE) ||!Constants.equalsInteger(category.getCompanyId(), user.getCompanyId())){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,类别信息不正确,请刷新重试!"); |
| | | } |
| | | if(category.getPlatCateId() == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请前往【类别管理】先关联平台类别!"); |
| | | } |
| | | BaseGoods bp = new BaseGoods(); |
| | | bp.setCategoryId(category.getPlatCateId()); |
| | | bp.setIsdeleted(Constants.ZERO); |
| | | List<BaseGoods> goodsList = new ArrayList<>(); |
| | | List<Integer> ids = null; |
| | | if(Constants.equalsInteger(Constants.ONE, param.getType())){ |
| | | //如果选择部分商品 |
| | | for(PlatGoodsParam p : param.getGoodsParamList()){ |
| | | if(p.getGoodsId() == null || p.getPrice() == null){ |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请正确选择平台商品并配置入手价!"); |
| | | } |
| | | if(ids == null){ |
| | | ids = new ArrayList<>(); |
| | | } |
| | | ids.add(p.getGoodsId()); |
| | | } |
| | | } |
| | | goodsList = baseGoodsMapper.selectList(new QueryWrapper<>(bp).lambda().in((ids!=null && ids.size()>0),BaseGoods::getId,ids)); |
| | | if(Constants.equalsInteger(Constants.ONE, param.getType()) &&( goodsList==null || ids.size()!=goodsList.size())){ |
| | | // 如果选择平台商品和查询结果对不上,提示错误 |
| | | throw new BusinessException(ResponseStatus.BAD_REQUEST.getCode(),"对不起,请正确选择平台商品!"); |
| | | } |
| | | for(BaseGoods model : goodsList){ |
| | | //遍历平台商品信息,进行商品信息同步 |
| | | Goods goods = initGoodsPlatParam(user,model,param); |
| | | if(goods == null){ |
| | | continue; |
| | | } |
| | | goodsMapper.insert(goods); |
| | | //开始处理附件 |
| | | dealPlatMultifule(goods.getId(),user,model); |
| | | //开始处理参数配置 |
| | | dealPlatGoodsParam(model,goods,user); |
| | | } |
| | | |
| | | if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("ISDELETED",Constants.ZERO).eq("name",goods.getName()))>0){ |
| | | |
| | | return 1; |
| | | } |
| | | |
| | | private void dealPlatGoodsParam(BaseGoods model, Goods goods, LoginUserInfo user) { |
| | | BaseGoodsParam baseGoodsParam = new BaseGoodsParam(); |
| | | baseGoodsParam.setGoodsId(model.getId()); |
| | | baseGoodsParam.setIsdeleted(Constants.ZERO); |
| | | List<BaseGoodsParam> goodsParamList = baseGoodsParamMapper.selectList(new QueryWrapper<>(baseGoodsParam)); |
| | | if(!Objects.isNull(goodsParamList)&&goodsParamList.size()>0){ |
| | | for (int i = 0; i < goodsParamList.size(); i++) { |
| | | BaseGoodsParam bgParam = goodsParamList.get(i); |
| | | GoodsParam goodsParam = new GoodsParam(); |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | | goodsParam.setIsdeleted(Constants.ZERO); |
| | | goodsParam.setSortnum(i+Constants.ONE); |
| | | goodsParam.setStatus(Constants.ZERO); |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParam.setVal(bgParam.getVal()); |
| | | goodsParam.setName(bgParam.getName()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private Goods initGoodsPlatParam(LoginUserInfo user, BaseGoods model, GoodCreatePlatRequest param) { |
| | | Goods goods = new Goods(); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | goods.setGoodsId(model.getId()); |
| | | if(goodsMapper.selectCount(new QueryWrapper<>(goods))>0){ |
| | | //如果已经同步过,跳过此次同步 |
| | | return null; |
| | | } |
| | | goods.setType(Constants.ONE); |
| | | goods.setStatus(Constants.ZERO); |
| | | goods.setCreateDate(new Date()); |
| | | goods.setCreator(user.getId()); |
| | | goods.setCompanyId(user.getCompanyId()); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | //处理拼音问题 |
| | | goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goods.setName(model.getName()); |
| | | goods.setCategoryId(param.getCategoryId()); |
| | | //获取入手价格 |
| | | goods.setPrice(getPriceFromParam(model,param)); |
| | | goods.setZdPrice(model.getZdPrice()); |
| | | goods.setRemark(model.getRemark()); |
| | | goods.setImgurl(model.getImgurl()); |
| | | goods.setBrandId(model.getBrandId()); |
| | | return goods; |
| | | } |
| | | |
| | | /** |
| | | * 开始处理平台商品关联附件,复制一套到企业商品上 |
| | | */ |
| | | private void dealPlatMultifule(Integer id, LoginUserInfo user, BaseGoods model) { |
| | | Multifile f = new Multifile(); |
| | | f.setObjId(model.getId()); |
| | | f.setIsdeleted(Constants.ZERO); |
| | | List<Multifile> multifileList =multifileMapper.selectList(new QueryWrapper<>(f)); |
| | | if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < multifileList.size(); i++) { |
| | | Multifile multifile = multifileList.get(i); |
| | | multifile.setCreator(user.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setSortnum(i+Constants.ONE); |
| | | multifile.setObjId(id); |
| | | multifile.setType(Constants.ZERO); |
| | | multifile.setObjType(Constants.ZERO); |
| | | multifile.setFileurl(multifile.getFileurl()); |
| | | multifile.setName(multifile.getName()); |
| | | multifile.setSortnum(multifile.getSortnum()); |
| | | multifile.setCompanyId(user.getCompanyId()); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | } |
| | | |
| | | private BigDecimal getPriceFromParam(BaseGoods model, GoodCreatePlatRequest param) { |
| | | if(Constants.equalsInteger(Constants.ONE, param.getType())){ |
| | | for(PlatGoodsParam p: param.getGoodsParamList()){ |
| | | if(Constants.equalsInteger(model.getId(),p.getGoodsId())){ |
| | | return p.getPrice(); |
| | | } |
| | | } |
| | | } |
| | | //如果没有配置入手价,安装加价系数来计算 |
| | | if(model.getCateRatePrice()==null){ |
| | | model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate()); |
| | | } |
| | | //返回 |
| | | return Constants.formatBigdecimal(model.getPrice()).multiply(model.getCateRatePrice()).multiply(param.getRate()); |
| | | |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public Integer companyCreate(Goods goods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user.getType()==1){ |
| | | goods.setCompanyId(user.getCompanyId()); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前登录用户类别错误,无法进行该操作"); |
| | | } |
| | | if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("COMPANY_ID",user.getCompanyId()).eq("ISDELETED",Constants.ZERO).eq("name",goods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+goods.getName()+"】已存在"); |
| | | } |
| | | goods.setStatus(Constants.ZERO); |
| | |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | | goodsParam.setIsdeleted(Constants.ZERO); |
| | | goodsParam.setSortnum(i+Constants.ONE); |
| | | goodsParam.setStatus(Constants.ZERO); |
| | | goodsParam.setSortnum(i+Constants.ONE); |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | //存储 cate_param_select 查询是否已存在 |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(goodsParam.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | } |
| | | } |
| | | |
| | | return goods.getId(); |
| | | } |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void companyUpdateById(Goods goods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(user.getType()==1){ |
| | | goods.setCompanyId(user.getCompanyId()); |
| | | }else{ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"当前登录用户类别错误,无法进行该操作"); |
| | | } |
| | | if(goodsMapper.selectCount(new QueryWrapper<Goods>().eq("COMPANY_ID",user.getCompanyId()).eq("ISDELETED",Constants.ZERO).ne("id",goods.getId()).eq("name",goods.getName()))>0){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"【"+goods.getName()+"】已存在"); |
| | | }; |
| | | goods.setStatus(Constants.ZERO); |
| | | goods.setEditDate(new Date()); |
| | | goods.setEditor(user.getId()); |
| | | goods.setIsdeleted(Constants.ZERO); |
| | | //处理拼音问题 |
| | | goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); |
| | | goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); |
| | | goodsMapper.updateById(goods); |
| | | |
| | | multifileMapper.delete(new QueryWrapper<Multifile>().eq("OBJ_ID",goods.getId())); |
| | | List<Multifile> multifileList = goods.getMultifileList(); |
| | | if(!Objects.isNull(multifileList)&&multifileList.size()>Constants.ZERO){ |
| | | for (int i = 0; i < multifileList.size(); i++) { |
| | | Multifile multifile = multifileList.get(i); |
| | | multifile.setCreator(user.getId()); |
| | | multifile.setCreateDate(new Date()); |
| | | multifile.setIsdeleted(Constants.ZERO); |
| | | multifile.setSortnum(i+Constants.ONE); |
| | | multifile.setObjId(goods.getId()); |
| | | multifile.setType(Constants.ZERO); |
| | | multifile.setObjType(Constants.ZERO); |
| | | multifileMapper.insert(multifile); |
| | | } |
| | | } |
| | | goodsParamMapper.delete(new QueryWrapper<GoodsParam>().eq("GOODS_ID",goods.getId())); |
| | | List<GoodsParam> goodsParamList = goods.getGoodsParamList(); |
| | | if(!Objects.isNull(goodsParamList)&&goodsParamList.size()>0){ |
| | | for (int i = 0; i < goodsParamList.size(); i++) { |
| | | GoodsParam goodsParam = goodsParamList.get(i); |
| | | goodsParam.setCreator(user.getId()); |
| | | goodsParam.setCreateDate(new Date()); |
| | | goodsParam.setIsdeleted(Constants.ZERO); |
| | | goodsParam.setSortnum(i+Constants.ONE); |
| | | goodsParam.setStatus(Constants.ZERO); |
| | | goodsParam.setGoodsId(goods.getId()); |
| | | goodsParamMapper.insert(goodsParam); |
| | | //存储 cate_param_select 查询是否已存在 |
| | | if(cateParamSelectMapper.selectCount(new QueryWrapper<CateParamSelect>() |
| | | .eq("PARAM_ID",goodsParam.getPramaId()).eq("NAME",goodsParam.getName()))<=Constants.ZERO){ |
| | | CateParamSelect cateParamSelect = new CateParamSelect(); |
| | | cateParamSelect.setCreator(user.getId()); |
| | | cateParamSelect.setCreateDate(new Date()); |
| | | cateParamSelect.setName(goodsParam.getVal()); |
| | | cateParamSelect.setIsdeleted(Constants.ZERO); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelect.setParamId(goodsParam.getPramaId()); |
| | | cateParamSelect.setCategoryId(goods.getCategoryId()); |
| | | cateParamSelect.setStatus(Constants.ZERO); |
| | | cateParamSelectMapper.insert(cateParamSelect); |
| | | }; |
| | | } |
| | | } |
| | | } |
| | | |
| | | |
| | | @Override |
| | | public void updateByIdInBatch(List<Goods> goodss) { |
| | | if (CollectionUtils.isEmpty(goodss)) { |
| | |
| | | @Override |
| | | public void updateDisableById(Goods goods) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | Goods dbGoods = goodsMapper.selectById(goods.getId()); |
| | | if(Objects.isNull(dbGoods)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY); |
| | | } |
| | | //拉式商品 且 上架时,需要限制 平台商品是否已下架 |
| | | if(dbGoods.getType().equals(Constants.goodsType.PULL)&&goods.getStatus().equals(Constants.ZERO)){ |
| | | BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); |
| | | if(Objects.isNull(baseGoods)){ |
| | | throw new BusinessException(ResponseStatus.DATA_EMPTY.getCode(),"未查询到平台商品信息"); |
| | | } |
| | | if(!baseGoods.getStatus().equals(Constants.ZERO)){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"平台商品已下架,无法上架"); |
| | | } |
| | | } |
| | | goods.setEditDate(new Date()); |
| | | goods.setEditor(user.getId()); |
| | | goodsMapper.updateById(goods); |
| | | } |
| | | |
| | | /** |
| | | * 批量上下架 |
| | | * @param batchDisableDTO |
| | | * @return |
| | | */ |
| | | @Override |
| | | public String batchUpdateDisableById(BatchDisableDTO batchDisableDTO) { |
| | | LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); |
| | | if(StringUtils.isBlank(batchDisableDTO.getIds())){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"请选择对应的商品进行该操作"); |
| | | } |
| | | if(!(batchDisableDTO.getStatus().equals(Constants.ZERO)||batchDisableDTO.getStatus().equals(Constants.ONE))){ |
| | | throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"操作类型错误"); |
| | | } |
| | | Integer okNum = 0; |
| | | Integer errNum = 0; |
| | | List<String> goodsList = Arrays.asList(batchDisableDTO.getIds().split(",")); |
| | | for (String goodsId:goodsList) { |
| | | Goods dbGoods = goodsMapper.selectById(goodsId); |
| | | if(Objects.isNull(dbGoods)){ |
| | | errNum++; |
| | | continue; |
| | | } |
| | | //拉式商品 且 上架时,需要限制 平台商品是否已下架 |
| | | if(dbGoods.getType().equals(Constants.goodsType.PULL)&&batchDisableDTO.getStatus().equals(Constants.ZERO)){ |
| | | BaseGoods baseGoods = baseGoodsMapper.selectById(dbGoods.getGoodsId()); |
| | | if(Objects.isNull(baseGoods)||!baseGoods.getStatus().equals(Constants.ZERO)){ |
| | | errNum++; |
| | | continue; |
| | | } |
| | | } |
| | | dbGoods.setEditDate(new Date()); |
| | | dbGoods.setEditor(user.getId()); |
| | | dbGoods.setStatus(batchDisableDTO.getStatus()); |
| | | goodsMapper.updateById(dbGoods); |
| | | okNum++; |
| | | } |
| | | return "更新成功数量("+okNum+");更新失败数量("+errNum+")"; |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | @Override |
| | | public Goods findById(Integer id) { |
| | |
| | | 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){ |