From 0ebb006ea17307cbd9d681f45467f8f49715a5fb Mon Sep 17 00:00:00 2001
From: jiangping <jp@doumee.com>
Date: 星期四, 14 九月 2023 16:52:01 +0800
Subject: [PATCH] 解决冲突

---
 server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java |  109 +++++++++++++++++++++++++++++++-----------------------
 1 files changed, 62 insertions(+), 47 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 1b54d9a..4e04375 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
@@ -644,9 +644,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();
@@ -761,54 +762,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();
 
@@ -890,6 +891,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