From 04d88ef5d6e9f4814ad16f51f1550bd5be7c6fe6 Mon Sep 17 00:00:00 2001 From: jiangping <jp@doumee.com> Date: 星期五, 15 九月 2023 09:12:31 +0800 Subject: [PATCH] 优化素材库处理源数据 --- server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java | 469 ++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 417 insertions(+), 52 deletions(-) diff --git a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java index cd8eea3..4312e70 100644 --- a/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java +++ b/server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java @@ -17,7 +17,10 @@ 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; @@ -36,14 +39,10 @@ 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.*; /** * 鍟嗗搧淇℃伅琛⊿ervice瀹炵幇 @@ -55,6 +54,10 @@ @Autowired private GoodsMapper goodsMapper; + @Autowired + private BaseGoodsMapper baseGoodsMapper; + @Autowired + private BaseGoodsParamMapper baseGoodsParamMapper; @Autowired private CategoryMapper categoryMapper; @Autowired @@ -73,6 +76,10 @@ @Autowired private GoodsJoinMapper goodsJoinMapper; + @Autowired + private CateParamSelectMapper cateParamSelectMapper; + + @Override @@ -118,6 +125,225 @@ } } + return goods.getId(); + } + @Override + public Integer createPlat(GoodCreatePlatRequest param){ + LoginUserInfo user = (LoginUserInfo) SecurityUtils.getSubject().getPrincipal(); + if(!Constants.equalsInteger(user.getType(), Constants.UserType.COMPANY.getKey())){ + //闈炰紒涓氱敤鎴蜂笉鑳芥搷浣� + throw new BusinessException(ResponseStatus.NOT_ALLOWED); + } + if(param.getCategoryId() == null + || param.getType() == null + || param.getRate() == null + || (Constants.equalsInteger(param.getType(), Constants.ONE) + && (param.getGoodsParamList() == null + || param.getGoodsParamList().size()==0))){ + throw new BusinessException(ResponseStatus.BAD_REQUEST); + } + 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); + } + + + 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); + goods.setCreateDate(new Date()); + goods.setCreator(user.getId()); + goods.setIsdeleted(Constants.ZERO); + //澶勭悊鎷奸煶闂 + goods.setPinyin(PinYinUtil.getFullSpell(goods.getName())); + goods.setShortPinyin(PinYinUtil.getFirstSpell(goods.getName())); + goodsMapper.insert(goods); + + 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); + } + } + 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.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(); } @@ -191,6 +417,73 @@ } } + + @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)) { @@ -205,10 +498,67 @@ @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) { @@ -298,9 +648,10 @@ 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(); @@ -415,54 +766,54 @@ //鏌ヨ鍏ㄩ儴灞炴��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(); @@ -544,6 +895,20 @@ 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){ -- Gitblit v1.9.3