From 8e8a08572fafd3d75e81784a82dab554b0eead50 Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期二, 19 九月 2023 19:24:47 +0800
Subject: [PATCH] 基础字段

---
 server/service/src/main/java/com/doumee/service/business/impl/GoodsServiceImpl.java |   37 +++++++++++++++----------------------
 1 files changed, 15 insertions(+), 22 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 bb7ec36..16e0905 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
@@ -229,6 +229,7 @@
         Goods goods = new Goods();
         goods.setIsdeleted(Constants.ZERO);
         goods.setGoodsId(model.getId());
+        goods.setCompanyId(user.getCompanyId());
         if(goodsMapper.selectCount(new QueryWrapper<>(goods))>0){
             //濡傛灉宸茬粡鍚屾杩囷紝璺宠繃姝ゆ鍚屾
             return  null;
@@ -284,16 +285,16 @@
         if(Constants.equalsInteger(Constants.ONE, param.getType())){
             for(PlatGoodsParam p: param.getGoodsParamList()){
                 if(Constants.equalsInteger(model.getId(),p.getGoodsId())){
-                    return p.getPrice();
+                    return p.getPrice().setScale(0,BigDecimal.ROUND_CEILING);
                 }
             }
         }
         //濡傛灉娌℃湁閰嶇疆鍏ユ墜浠凤紝瀹夎鍔犱环绯绘暟鏉ヨ绠�
-        if(model.getCateRatePrice()==null){
-            model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate());
-        }
-        //杩斿洖
-        return Constants.formatBigdecimal(model.getPrice()).multiply(model.getCateRatePrice()).multiply(param.getRate());
+//        if(model.getCateRatePrice()==null){
+//            model.setCateRatePrice(systemDictDataBiz.getGoodsPriceRate());
+//        }
+        //杩斿洖 .multiply(model.getCateRatePrice())
+        return (Constants.formatBigdecimal(model.getPrice()).multiply(param.getRate())).setScale(0,BigDecimal.ROUND_CEILING);
 
     }
 
@@ -329,6 +330,7 @@
                 multifile.setObjId(goods.getId());
                 multifile.setType(Constants.ZERO);
                 multifile.setObjType(Constants.ZERO);
+                multifile.setCompanyId(goods.getCompanyId());
                 multifileMapper.insert(multifile);
             }
         }
@@ -343,20 +345,6 @@
                 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();
@@ -441,7 +429,8 @@
         }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){
+        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);
@@ -465,6 +454,7 @@
                 multifile.setSortnum(i+Constants.ONE);
                 multifile.setObjId(goods.getId());
                 multifile.setType(Constants.ZERO);
+                multifile.setCompanyId(goods.getCompanyId());
                 multifile.setObjType(Constants.ZERO);
                 multifileMapper.insert(multifile);
             }
@@ -1075,7 +1065,10 @@
         goodsIPage.getRecords().forEach(i->{
             i.setPrefixUrl(prefixUrl);
             i.setMultifileList(multifileMapper.selectList(new QueryWrapper<Multifile>().eq("OBJ_ID",i.getId()).orderByAsc(" SORTNUM ")));
-            i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>().eq("GOODS_ID",i.getId()).orderByAsc(" SORTNUM ")));
+            i.setGoodsParamList(goodsParamMapper.selectList(new QueryWrapper<GoodsParam>()
+                    .eq("GOODS_ID",i.getId())
+                            .apply(" name in ( select cp.NAME from cate_param cp where cp.CATEGORY_ID = "+i.getCategoryId()+" and cp.ISSHOW = 1 and cp.ISDELETED = 0 and cp.STATUS = 0 ) ")
+                    .orderByAsc(" SORTNUM ")));
         });
         return PageData.from(goodsIPage);
     }

--
Gitblit v1.9.3