Procházet zdrojové kódy

feat: 商品进销存

Joburgess před 5 roky
rodič
revize
36e81edb7d

+ 1 - 1
mec-biz/src/main/java/com/ym/mec/biz/dal/dao/GoodsDao.java

@@ -45,7 +45,7 @@ public interface GoodsDao extends BaseDAO<Integer, Goods> {
      * @date 2020/9/4
      * @time 14:39
      */
-    void batchInsert(@Param("goodsList") List<Goods> goodsList);
+    void batchInsert(List<Goods> goodsList);
 
     /**
      * @describe 批量更新商品

+ 35 - 2
mec-biz/src/main/java/com/ym/mec/biz/service/impl/GoodsServiceImpl.java

@@ -250,6 +250,40 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			int taxStockCount = goods.stream().mapToInt(Goods::getTaxStockCount).sum();
 			existsGood.setStockCount((Objects.isNull(existsGood.getStockCount())?0:existsGood.getStockCount()) + stockCount);
 			existsGood.setTaxStockCount((Objects.isNull(existsGood.getTaxStockCount())?0:existsGood.getTaxStockCount()) + taxStockCount);
+			Goods newGoods = goods.get(0);
+			if(Objects.nonNull(newGoods.getGoodsCategoryId())&&!newGoods.getGoodsCategoryId().equals(existsGood.getGoodsCategoryId())){
+				existsGood.setGoodsCategoryId(newGoods.getGoodsCategoryId());
+			}
+			if(Objects.nonNull(newGoods.getName())&&!newGoods.getName().equals(existsGood.getName())){
+				existsGood.setName(newGoods.getName());
+			}
+			if(Objects.nonNull(newGoods.getType())&&!newGoods.getType().equals(existsGood.getType())){
+				existsGood.setType(newGoods.getType());
+			}
+			if(Objects.nonNull(newGoods.getSpecification())&&!newGoods.getSpecification().equals(existsGood.getSpecification())){
+				existsGood.setSpecification(newGoods.getSpecification());
+			}
+			if(Objects.nonNull(newGoods.getMarketPrice())&&!newGoods.getMarketPrice().equals(existsGood.getMarketPrice())){
+				existsGood.setMarketPrice(newGoods.getMarketPrice());
+			}
+			if(Objects.nonNull(newGoods.getDiscountPrice())&&!newGoods.getDiscountPrice().equals(existsGood.getDiscountPrice())){
+				existsGood.setDiscountPrice(newGoods.getDiscountPrice());
+			}
+			if(Objects.nonNull(newGoods.getGroupPurchasePrice())&&!newGoods.getGroupPurchasePrice().equals(existsGood.getGroupPurchasePrice())){
+				existsGood.setGroupPurchasePrice(newGoods.getGroupPurchasePrice());
+			}
+			if(Objects.nonNull(newGoods.getImage())&&!newGoods.getImage().equals(existsGood.getImage())){
+				existsGood.setImage(newGoods.getImage());
+			}
+			if(Objects.nonNull(newGoods.getStockType())&&!newGoods.getStockType().equals(existsGood.getStockType())){
+				existsGood.setStockType(newGoods.getStockType());
+			}
+			if(Objects.nonNull(newGoods.getBrief())&&!newGoods.getBrief().equals(existsGood.getBrief())){
+				existsGood.setBrief(newGoods.getBrief());
+			}
+			if(Objects.nonNull(newGoods.getStockWarning())&&!newGoods.getStockWarning().equals(existsGood.getStockWarning())){
+				existsGood.setStockWarning(newGoods.getStockWarning());
+			}
 		}
 
 		if(!CollectionUtils.isEmpty(existsGoods)){
@@ -271,8 +305,7 @@ public class GoodsServiceImpl extends BaseServiceImpl<Integer, Goods>  implement
 			gp.setGoodsId(existsSnIdMap.get(goods.getSn()));
 			gp.setGoodsCategoryId(goods.getGoodsCategoryId());
 			gp.setSupplyChannel(goods.getSupplyChannel());
-			gp.setDiscountPrice(goods.getCostPrice()
-			);
+			gp.setDiscountPrice(goods.getCostPrice());
 			gp.setAgreeCostPrice(goods.getAgreeCostPrice());
 			gp.setStockCount(goods.getStockCount());
 			gp.setTaxStockCount(goods.getTaxStockCount());

+ 2 - 2
mec-biz/src/main/resources/config/mybatis/GoodsMapper.xml

@@ -63,13 +63,13 @@
         #{clientShow,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{stockWarning,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},
         #{stockType,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler})
     </insert>
-    <insert id="batchInsert">
+    <insert id="batchInsert" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
         INSERT INTO goods
         (goods_category_id_,name_,brand_,specification_,image_,market_price_,
         discount_price_,group_purchase_price_,brief_,desc_,update_time_,create_time_,type_,agree_cost_price_,sn_,
         stock_count_,tax_stock_count_,client_show_,stock_warning_,stock_type_)
         VALUES
-        <foreach collection="goodsList" separator="," item="goods">
+        <foreach collection="list" separator="," item="goods">
             (#{goods.goodsCategoryId},#{goods.name},#{goods.brand},#{goods.specification},#{goods.image},#{goods.marketPrice},
             #{goods.discountPrice},#{goods.groupPurchasePrice},#{goods.brief},#{goods.desc},now(),now(),
             #{goods.type,typeHandler=com.ym.mec.common.dal.CustomEnumTypeHandler},#{goods.agreeCostPrice},#{goods.sn},

+ 1 - 1
mec-web/src/main/resources/columnMapper.ini

@@ -10,7 +10,7 @@
 商品团购价(元) = groupPurchasePrice
 商品采购价1(元) = costPrice
 商品图片(插入一张图片) = image
-商品明细 = desc
+商品明细 = brief
 商品采购价2(元) = agreeCostPrice
 内部库存 = stockCount
 税务库存 = taxStockCount