Browse Source

查询全部渠道接口

fubojin 3 tuần trước cách đây
mục cha
commit
360bd1b196
17 tập tin đã thay đổi với 227 bổ sung79 xóa
  1. 1 1
      yami-shop-bean/src/main/java/com/yami/shop/bean/dto/ShopCategoryExcelDTO.java
  2. 9 1
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/ChannelProd.java
  3. 9 0
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/FrontCategory.java
  4. 1 1
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/Product.java
  5. 10 1
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/ShopCategory.java
  6. 15 1
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/ShopDetail.java
  7. 2 2
      yami-shop-bean/src/main/java/com/yami/shop/bean/model/Sku.java
  8. 47 4
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ChannelController.java
  9. 4 3
      yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ShopDetailController.java
  10. 22 0
      yami-shop-service/src/main/java/com/yami/shop/dao/HBTransport2Mapper.java
  11. 1 1
      yami-shop-service/src/main/java/com/yami/shop/dao/ProductMapper.java
  12. 2 0
      yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBFrontCategoryService.java
  13. 22 19
      yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBGoodsService.java
  14. 27 2
      yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/StoreManagementService.java
  15. 19 13
      yami-shop-service/src/main/java/com/yami/shop/service/impl/PointsRechargeServiceImpl.java
  16. 35 27
      yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopCategoryServiceImpl.java
  17. 1 3
      yami-shop-service/src/main/resources/mapper/ChannelProdMapper.xml

+ 1 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/dto/ShopCategoryExcelDTO.java

@@ -12,7 +12,7 @@ public class ShopCategoryExcelDTO {
 
     @ExcelProperty("门店ID")
     @ColumnWidth(20)
-    private Long shopId;
+    private String shopId;
 
     @ExcelProperty("门店名称")
     @ColumnWidth(20)

+ 9 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/model/ChannelProd.java

@@ -11,6 +11,7 @@
 package com.yami.shop.bean.model;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import lombok.Data;
@@ -32,13 +33,15 @@ public class ChannelProd implements Serializable {
     /**
      * 主键
      */
-    @TableId(type = IdType.INPUT)
+    @TableId
     private Long id;
 
     /**
      * 渠道ID
      */
     private Long channelId;
+    @TableField(exist = false)
+    private String channelName;
 
     /**
      * 单品ID
@@ -48,6 +51,11 @@ public class ChannelProd implements Serializable {
      * 门店ID
      */
     private Long shopId;
+    /**
+     *  渠道类型(1-企业用户,2-B端用户,3-C端用户)
+     */
+    @TableField(exist = false)
+    private String channelType;
     /**
      * 门店名称
      */

+ 9 - 0
yami-shop-bean/src/main/java/com/yami/shop/bean/model/FrontCategory.java

@@ -80,6 +80,15 @@ public class FrontCategory implements Serializable {
      */
     private String icon;
 
+    /**
+     * 图片
+     */
+    private String pic;
+    /**
+     *标签ID
+     */
+    private Long label;
+
     /**
      * 是否叶子(1-是,2-不是)
      */

+ 1 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/model/Product.java

@@ -54,7 +54,7 @@ public class Product implements Serializable {
     /**
      * 在海博平台中的前台分类id
      */
-    private Long hbFrontCategoryId;
+    private String hbFrontCategoryId;
 
     /**
      * 在店铺当中的分类id

+ 10 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/model/ShopCategory.java

@@ -24,13 +24,22 @@ public class ShopCategory implements Serializable {
     @TableId
     private Long id;
 
+    /**
+     * pid
+     */
+    private Long pid;
+
     /**
      * 类目名称
      */
     private String name;
 
     /**
-     * 门店ID
+     * 海博门店ID
+     */
+    private String hbShopId;
+    /**
+     * 店铺ID
      */
     private Long shopId;
 

+ 15 - 1
yami-shop-bean/src/main/java/com/yami/shop/bean/model/ShopDetail.java

@@ -133,7 +133,6 @@ public class ShopDetail implements Serializable {
     /**
      * 店铺状态(-1:未开通 0: 停业中 1:营业中),可修改
      */
-
     private Integer shopStatus;
 
     /**
@@ -185,6 +184,20 @@ public class ShopDetail implements Serializable {
      */
     private String mapType;
 
+    /**
+     * 店铺公告
+     */
+    private String notice;
+
+    /**
+     *
+     * 经营状态(0:停业,1正常)
+     */
+    private Integer runStatus;
+    /**
+     * 营业时间
+     */
+    private String businessTime;
     /**
      * 物品类型
      */
@@ -194,4 +207,5 @@ public class ShopDetail implements Serializable {
      * 第三方id
      */
     private String thirdPartyCode;
+
 }

+ 2 - 2
yami-shop-bean/src/main/java/com/yami/shop/bean/model/Sku.java

@@ -37,11 +37,11 @@ public class Sku implements Serializable {
     /**
      * 商品编码(海博)
      */
-    private Long hbSpuId;
+    private String hbSpuId;
     /**
      * 单品编码(海博)
      */
-    private Long hbSkuId;
+    private String hbSkuId;
 
     /**
      * 销售属性组合字符串,格式是p1:v1;p2:v2

+ 47 - 4
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ChannelController.java

@@ -2,17 +2,19 @@
 package com.yami.shop.platform.controller;
 
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.yami.shop.bean.model.Channel;
 import com.yami.shop.bean.model.ChannelProd;
+import com.yami.shop.bean.model.ShopDetail;
+import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.service.ChannelService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import lombok.AllArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.apache.commons.lang3.ObjectUtils;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -39,4 +41,45 @@ public class ChannelController {
         return R.SUCCESS(channels);
     }
 
+    /**
+     * 根据渠道ID获取商品列表
+     */
+    @GetMapping("/listProd/{id}")
+    @ApiOperation(value = "根据渠道ID获取商品列表")
+    public R<Channel> listProd(@PathVariable String id) {
+        Channel channel = channelService.getById(id);
+        return R.SUCCESS(channel);
+    }
+    /**
+     * 分页获取
+     */
+    @GetMapping("/page")
+    @ApiOperation(value = "分页获取")
+    public R<IPage<Channel>> page(@ModelAttribute PageParam pageParam,
+                                 @ModelAttribute Channel channel ) {
+        IPage<Channel> page = channelService.page(pageParam,new LambdaQueryWrapper<Channel>()
+                .eq(ObjectUtils.isNotEmpty(channel.getChannelName()),Channel::getChannelName, channel.getChannelName())
+                .eq(ObjectUtils.isNotEmpty(channel.getType()), Channel::getType, channel.getType()));
+
+        return R.SUCCESS(page);
+    }
+
+    /**
+     * 添加
+     */
+    @PostMapping
+    @ApiOperation(value = "添加")
+    public R add(@RequestBody Channel channel) {
+        channelService.save(channel);
+        return R.SUCCESS();
+    }
+    /**
+     * 修改
+     */
+    @PutMapping
+    @ApiOperation(value = "修改")
+    public R update(@RequestBody Channel channel) {
+        channelService.updateById(channel);
+        return R.SUCCESS();
+    }
 }

+ 4 - 3
yami-shop-platform/src/main/java/com/yami/shop/platform/controller/ShopDetailController.java

@@ -46,7 +46,7 @@ import java.util.*;
 import com.yami.shop.common.util.R;
 
 /**
- * 商家详细信息管理实现
+ * 门店详细信息管理实现
  *
  * @author lgh
  * @version 1.0.0
@@ -68,12 +68,13 @@ public class ShopDetailController {
      * 分页获取门店详细列表
      */
     @GetMapping("/page")
-    public R<IPage<ShopDetail>> page( @ModelAttribute PageParam<ShopDetail> pageParam,
+    public R<IPage<ShopDetail>> page(@ModelAttribute PageParam pageParam,
                                       @ModelAttribute ShopDetail shopDetail ) {
-        System.out.println("shopDetail");
         IPage<ShopDetail> page = shopDetailService.page(pageParam,new LambdaQueryWrapper<ShopDetail>()
                 .eq(ObjectUtils.isNotEmpty(shopDetail.getShopName()),ShopDetail::getShopName, shopDetail.getShopName())
                 .eq(ObjectUtils.isNotEmpty(shopDetail.getHbStationNo()),ShopDetail::getHbStationNo, shopDetail.getHbStationNo()));
+
+
         return R.SUCCESS(page);
     }
 

+ 22 - 0
yami-shop-service/src/main/java/com/yami/shop/dao/HBTransport2Mapper.java

@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2018-2999 广州亚米信息科技有限公司 All rights reserved.
+ *
+ * https://www.gz-yami.com/
+ *
+ * 未经允许,不可做商业用途!
+ *
+ * 版权所有,侵权必究!
+ */
+
+package com.yami.shop.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.yami.shop.bean.model.Transport2;
+import org.apache.ibatis.annotations.Param;
+
+public interface HBTransport2Mapper extends BaseMapper<Transport2> {
+
+
+
+
+}

+ 1 - 1
yami-shop-service/src/main/java/com/yami/shop/dao/ProductMapper.java

@@ -170,5 +170,5 @@ public interface ProductMapper extends BaseMapper<Product> {
      * @param hbSpuId 海博商品编码
      * @return 商品信息
      */
-    Product selectByHbSpuId(@Param("hbSpuId") Long hbSpuId);
+    Product selectByHbSpuId(@Param("hbSpuId") String hbSpuId);
 }

+ 2 - 0
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBFrontCategoryService.java

@@ -67,6 +67,8 @@ public class HBFrontCategoryService implements IHBFrontCategoryService {
                 frontCategory.setLevel(jsonObjectInfo.getInteger("level"));
                 frontCategory.setOperateUser(jsonObjectInfo.getString("operateUser"));
                 frontCategory.setIsLeaves(jsonObjectInfo.getInteger("isLeaves"));
+                frontCategory.setIcon(jsonObjectInfo.getString("https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/09/fe56414a161b498b8f263d3e6afdab92.png"));
+                frontCategory.setPic(jsonObjectInfo.getString("https://zswl-shop.oss-cn-chengdu.aliyuncs.com/2025/09/fe56414a161b498b8f263d3e6afdab92.png"));
                 log.info("添加前台类目信息{}",frontCategory);
                 // 3. 保存门店信息
                 frontCategoryMapper.insert(frontCategory);

+ 22 - 19
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/HBGoodsService.java

@@ -57,13 +57,12 @@ public class HBGoodsService implements IHBGoodsService {
         for (Object product : productList) {
             JSONObject jsonObject = JSON.parseObject(product.toString());
             Long prodId;
+            String hbSpuId;
             //判断海博传过来的是单规格还是多规格
             if (ObjectUtil.isEmpty(jsonObject.getString("multiSpec"))) {
                 log.info("===================进入普通商品操作===================");
                 String goodsInfoStr = selectHBGoodsInfo(jsonObject.getString("outSkuId"));
-
                 JSONObject goodsInfoJson = JSON.parseObject(goodsInfoStr);
-
                 // 2. 逐层解析获取productHostInfoDTOS数组
                 JSONObject result = goodsInfoJson.getJSONObject("result");
                 JSONObject innerResult = result.getJSONObject("result");
@@ -75,11 +74,11 @@ public class HBGoodsService implements IHBGoodsService {
                     JSONObject productInfo = productHostInfoDTOS.getJSONObject(i);
 
                     // 创建并填充Product对象
-                    Product productInfoById = productMapper.selectByHbSpuId(productInfo.getLong("spuId"));
+                    hbSpuId = productInfo.getString("spuId");
+                    Product productInfoById = productMapper.selectByHbSpuId(hbSpuId);
                     if (ObjectUtil.isNotEmpty(productInfoById) && productInfoById.getIsDelete() == 0) {
                         prodId = productInfoById.getProdId();
                         log.info("商品spuID={},spuName={}已经存在无需添加", productInfo.getLong("spuId"), productInfo.getString("spuName"));
-
                     } else {
                         Product productAdd = createProductFromProductInfo(productInfo);
                         setSpuMapper(productInfo, productAdd);
@@ -97,13 +96,15 @@ public class HBGoodsService implements IHBGoodsService {
 
                         Sku sku = createSkuFromProductInfo(productInfo);
                         sku.setProdId(prodId);
+                        sku.setHbSpuId(hbSpuId);
                         skuMapper.insert(sku);
                         log.info("SKU创建成功: skuId={}, skuName={}", sku.getSkuId(), sku.getSkuName());
                     }
                 }
             } else {
                 log.info("===================进入多规格商品操作===================");
-                String selectHBGoodsSpuInfo = selectHBGoodsSpuInfo(jsonObject.getString("spuId"));
+                hbSpuId = jsonObject.getString("spuId");
+                String selectHBGoodsSpuInfo = selectHBGoodsSpuInfo(hbSpuId);
                 JSONObject goodsInfoJson = JSON.parseObject(selectHBGoodsSpuInfo);
                 // 2. 逐层解析获取productHostInfoDTOS数组
                 JSONObject result = goodsInfoJson.getJSONObject("result");
@@ -112,9 +113,8 @@ public class HBGoodsService implements IHBGoodsService {
 
                 for (Object productHostInfoDTO : productHostInfoDTOS) {
                     JSONObject productInfo = JSON.parseObject(productHostInfoDTO.toString());
-
                     // 创建并填充Product对象
-                    Product productInfoById = productMapper.selectByHbSpuId(productInfo.getLong("spuId"));
+                    Product productInfoById = productMapper.selectByHbSpuId(hbSpuId);
                     if (ObjectUtil.isNotEmpty(productInfoById) && productInfoById.getIsDelete() == 0) {
                         log.info("商品spuID={},spuName={}已经存在无需添加", productInfo.getLong("spuId"), productInfo.getString("spuName"));
                         prodId = productInfoById.getProdId();
@@ -138,6 +138,7 @@ public class HBGoodsService implements IHBGoodsService {
                         } else {
                             Sku sku = createSkuFromProductInfo(jsonObjectSku);
                             sku.setProdId(prodId);
+                            sku.setHbSpuId(hbSpuId);
                             skuMapper.insert(sku);
                         }
                     }
@@ -390,12 +391,9 @@ public class HBGoodsService implements IHBGoodsService {
     private Product createProductFromProductInfo(JSONObject productInfo) {
         Product product = new Product();
 
-
         // 直接映射字段
-        product.setProdId(productInfo.getLong("spuId"));
+        product.setHbSpuId(productInfo.getLong("spuId"));
         product.setProdName(productInfo.getString("spuName"));
-//        Product.setShopId(productInfo.getString("shopId"));
-
         product.setBrief(productInfo.getString("sellPoint"));//简要描述,卖点等
         product.setVideo(productInfo.getString(""));//商品视频
         product.setStatus(1);
@@ -404,10 +402,16 @@ public class HBGoodsService implements IHBGoodsService {
         product.setCreateTime(new Date());
         product.setUpdateTime(new Date());
         product.setPutawayTime(new Date());
-        product.setBrandId(productInfo.getLong("brandId"));//品牌ID
-        product.setBrandName(productInfo.getString("brandName"));//品牌名称
-        product.setCategoryId(productInfo.getLong("frontCategoryCode")); // 分类转换
-        product.setHbFrontCategoryId(productInfo.getLong("frontCategoryCode"));//后台类目平台对应ID
+        //品牌ID
+        product.setBrandId(productInfo.getLong("brandId"));
+        //品牌名称
+        product.setBrandName(productInfo.getString("brandName"));
+        // 分类转换
+        product.setCategoryId(productInfo.getLong("frontCategoryCode"));
+        //后台类目平台对应ID
+//        product.setHbFrontCategoryId(productInfo.getLong("frontCategoryCode"));
+        product.setPic(productInfo.getString("spuMainImage"));
+        product.setImgs(productInfo.getString("spuImages"));
         // 需要转换或默认值的字段
 //        Product.setTotalStocks(productInfo.getString(""));//总库存
 //        Product.setDeliveryMode(productInfo.getString(""));//配送方式
@@ -444,15 +448,14 @@ public class HBGoodsService implements IHBGoodsService {
         log.info("创建Sku对象数据==========={}===========", productInfo);
         Sku sku = new Sku();
         // 直接映射字段
-        sku.setHbSkuId(productInfo.getLong("skuId"));//单品id - 关联海博同步
-        sku.setHbSpuId(productInfo.getLong("spuId"));//商品id - 关联海博同步
+        sku.setHbSkuId(productInfo.getString("skuId"));//单品id - 关联海博同步
         sku.setSkuName(productInfo.getString("skuName"));//单品名称
         sku.setProdName(productInfo.getString("spuName"));//商品名称
         sku.setModelId(productInfo.getString("upc")); // 商品条码
         sku.setPartyCode(productInfo.getString("outSkuId"));//商家商品编码
         sku.setSkuCode(productInfo.getString("outSkuId"));//商家商品编码
         sku.setSpec(productInfo.getString("spec"));//规格
-        sku.setPic(productInfo.getString("skuImages"));//sku图片
+//        sku.setPic(productInfo.getString("skuImages"));//sku图片
 //        Sku.setVolume(productInfo.getString(""));//体积
         sku.setStatus(1);
         sku.setIsDelete(0);
@@ -462,7 +465,7 @@ public class HBGoodsService implements IHBGoodsService {
         sku.setWeightUnit(productInfo.getString("unit"));//单位
         // 商品原价
         sku.setOriPrice(productInfo.getDouble("basicPrice") != null ?
-                productInfo.getDouble("basicPrice") : null);
+                productInfo.getDouble("basicPrice") : 0);
         //实际库存
         sku.setActualStocks(productInfo.getInteger("initStock") == null ? 0 :
                 productInfo.getInteger("initStock"));

+ 27 - 2
yami-shop-service/src/main/java/com/yami/shop/service/hb/impl/StoreManagementService.java

@@ -1,6 +1,7 @@
 package com.yami.shop.service.hb.impl;
 
 import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
@@ -8,9 +9,11 @@ import com.yami.shop.bean.dto.hb.HBBaseReq;
 import com.yami.shop.bean.dto.hb.HBStoreBaseInfoReq;
 import com.yami.shop.bean.dto.hb.StoreRegister;
 import com.yami.shop.bean.model.ShopDetail;
+import com.yami.shop.bean.model.Transport2;
 import com.yami.shop.common.util.PageParam;
 import com.yami.shop.common.util.R;
 import com.yami.shop.common.util.hb.HBR;
+import com.yami.shop.dao.HBTransport2Mapper;
 import com.yami.shop.dao.ShopDetailMapper;
 import com.yami.shop.service.hb.IStoreManagementService;
 import com.yami.shop.utils.HBSignUtil;
@@ -20,6 +23,7 @@ import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.StringUtils;
 
+import java.util.Date;
 import java.util.List;
 
 import static com.yami.shop.common.util.HttpUtil.post;
@@ -39,6 +43,7 @@ import static com.yami.shop.common.util.HttpUtil.post;
 public class StoreManagementService implements IStoreManagementService {
     private final ShopDetailMapper shopDetailMapper;
     private final HBSignUtil hbSignUtil;
+    private final HBTransport2Mapper transport2Mapper;
 
 
     /**
@@ -139,11 +144,31 @@ public class StoreManagementService implements IStoreManagementService {
             shopDetailInfo.setShopLat(resultData.getString("longitude"));
             shopDetailInfo.setShopLng(resultData.getString("latitude"));
             shopDetailInfo.setThirdPartyCode(resultData.getString("stationId"));
-            shopDetailInfo.setHbStationId(resultData.getString("stationId"));//海博门店编码
-            shopDetailInfo.setOutStationNo(resultData.getString("outStationNo"));//商家门店编码
+            shopDetailInfo.setNotice(resultData.getString("notice"));
+            //海博门店ID
+            shopDetailInfo.setHbStationId(resultData.getString("stationId"));
+            //商家门店编码
+            shopDetailInfo.setOutStationNo(resultData.getString("outStationNo"));
+            //经营状态
+            shopDetailInfo.setRunStatus(resultData.getInteger("runStatus"));
+            //营业状态
+            shopDetailInfo.setShopStatus(resultData.getInteger("businessStatus"));
+            //营业时间
+            shopDetailInfo.setBusinessTime(resultData.getString("businessTime"));
             shopDetailMapper.insert(shopDetailInfo);
             //添加默认配送模板
 
+            Transport2 transport2 = new Transport2();
+            //所有数据设置默认值
+            //配送范围经纬度
+            JSONArray coordinates = resultData.getJSONArray("coordinates");
+            transport2.setTransName("默认配送模板");
+            transport2.setDistance(100.0);
+            transport2.setAmount(1.0);
+            transport2.setPiece(5.0);
+            transport2.setCreateTime(new Date());
+            transport2.setShopId(shopDetailInfo.getShopId());
+            transport2Mapper.insert(transport2);
 
             return HBR.success();
         } catch (Exception e) {

+ 19 - 13
yami-shop-service/src/main/java/com/yami/shop/service/impl/PointsRechargeServiceImpl.java

@@ -73,6 +73,7 @@ public class PointsRechargeServiceImpl extends ServiceImpl<PointsRechargeMapper,
         for (int i = 0; i < importData.size(); i++) {
             com.yami.shop.service.impl.PointsRechargeTemplateDTO templateDTO = importData.get(i);
             try {
+
                 // 数据校验
                 if (templateDTO.getChannelName() == null) {
                     throw new GlobalException("所属企业不能为空");
@@ -87,17 +88,7 @@ public class PointsRechargeServiceImpl extends ServiceImpl<PointsRechargeMapper,
                 if (templateDTO.getUserName() == null) {
                     throw new GlobalException("员工名称不能为空");
                 }
-                if (templateDTO.getUserPhone() == null) {
-                    throw new GlobalException("员工电话号码不能为空");
-                }
-                //通过用户名称和电话号码校验员工是否存在
-                SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
-                        .eq(SysUser::getUsername, templateDTO.getUserName().trim())
-                        .eq(SysUser::getMobile, templateDTO.getUserPhone().trim())
-                        .last("LIMIT 1"));
-                if (sysUser == null) {
-                    throw new GlobalException("员工不存在");
-                }
+
                 if (templateDTO.getPoints() == null) {
                     throw new GlobalException("充值积分不能为空");
                 }
@@ -105,11 +96,26 @@ public class PointsRechargeServiceImpl extends ServiceImpl<PointsRechargeMapper,
                 if (templateDTO.getExpiryDate() == null) {
                     throw new GlobalException("过期时间不能为空");
                 }
-
                 // 构造实体对象
                 PointsRecharge pointsRecharge = new PointsRecharge();
+                String userPhone = templateDTO.getUserPhone();
+                if (userPhone == null) {
+                    throw new GlobalException("员工电话号码不能为空");
+                }
+                userPhone = userPhone.trim();
+                //电话号码格式验证
+                if (!userPhone.matches("^1[3-9]\\d{8}$")) {
+                    throw new GlobalException("手机号码格式错误");
+                }
+                //通过用户名称和电话号码校验员工是否存在(存在用户绑定用户,不存在正常添加数据)
+                SysUser sysUser = sysUserMapper.selectOne(new LambdaQueryWrapper<SysUser>()
+                        .eq(SysUser::getUsername, templateDTO.getUserName().trim())
+                        .eq(SysUser::getMobile, userPhone)
+                        .last("LIMIT 1"));
+                if (sysUser != null) {
+                    pointsRecharge.setUserId(sysUser.getUserId());
+                }
 
-                pointsRecharge.setUserId(sysUser.getUserId());
                 pointsRecharge.setUserName(templateDTO.getUserName());
                 pointsRecharge.setUserPhone(templateDTO.getUserPhone());
                 pointsRecharge.setChannelId(channel.getId());

+ 35 - 27
yami-shop-service/src/main/java/com/yami/shop/service/impl/ShopCategoryServiceImpl.java

@@ -9,12 +9,15 @@ import com.yami.shop.bean.dto.ShopCategoryExcelDTO;
 import com.yami.shop.bean.model.FrontCategory;
 import com.yami.shop.bean.model.ShopCategory;
 import com.yami.shop.bean.model.ShopCategory;
+import com.yami.shop.bean.model.ShopDetail;
 import com.yami.shop.bean.vo.FrontCategoryVO;
 import com.yami.shop.common.exception.GlobalException;
 import com.yami.shop.dao.FrontCategoryMapper;
 import com.yami.shop.dao.ShopCategoryMapper;
+import com.yami.shop.dao.ShopDetailMapper;
 import com.yami.shop.service.IShopCategoryService;
 import lombok.AllArgsConstructor;
+import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.web.multipart.MultipartFile;
@@ -38,6 +41,8 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 
     private final FrontCategoryMapper frontCategoryMapper;
 
+    private final ShopDetailMapper shopDetailMapper;
+
 
 
     @Override
@@ -107,15 +112,19 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
 
             // 批量保存数据
             if (!shopCategories.isEmpty()) {
-                // 检查数据有效性
-                validateShopCategories(shopCategories);
-                for (ShopCategory shopCategory : shopCategories) {
-                    this.save(shopCategory);
+
+                for (int i = 0; i < shopCategories.size(); i++) {
+                    ShopCategory category = shopCategories.get(i);
+                    // 检查数据有效性
+                    Long shopId = validateShopCategories(category, i);
+                    category.setShopId(shopId);
+                    category.setPid(0L);
+                    this.save(category);
                     //添加对应的二级和三级类目
-                    FrontCategory  frontCategoryByName = frontCategoryMapper.selectListName(shopCategory.getSubName());
-                    frontCategoryByName.setParentCode(shopCategory.getCode());
-                    frontCategoryByName.setParentName(shopCategory.getName());
-                    addShopCategory(frontCategoryByName,shopCategory.getShopId());
+                    FrontCategory  frontCategoryByName = frontCategoryMapper.selectListName(category.getSubName());
+                    frontCategoryByName.setParentCode(category.getCode());
+                    frontCategoryByName.setParentName(category.getName());
+                    addShopCategory(frontCategoryByName,category.getHbShopId(),shopId,category.getId());
                 }
             }
         } catch (Exception e) {
@@ -127,13 +136,14 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
     /**
      * 添加对应的二级和三级类目
      * @param frontCategory 前台类目模板
+     * @param hbShopId 海报
      * @param shopId 门店ID
      */
-    private void addShopCategory(FrontCategory frontCategory, Long shopId) {
+    private void addShopCategory(FrontCategory frontCategory, String hbShopId, Long shopId,Long id) {
         ShopCategory shopCategory = new ShopCategory();
+        shopCategory.setPid(id);
         shopCategory.setName(frontCategory.getName());
         shopCategory.setCode(frontCategory.getCode());
-        shopCategory.setShopId(shopId);
         shopCategory.setParentCode(frontCategory.getParentCode());
         shopCategory.setParentName(frontCategory.getName());
         shopCategory.setLevel(frontCategory.getLevel());
@@ -141,11 +151,15 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
         shopCategory.setIsDelete(0);
         shopCategory.setOperateUser("admin");
         shopCategory.setIsLeaves(1);
+
+        shopCategory.setHbShopId(hbShopId);
+        shopCategory.setShopId(shopId);
+
         this.save(shopCategory);
         List<FrontCategory> frontCategoryList = frontCategoryMapper.selectList(new LambdaQueryWrapper<FrontCategory>()
                 .eq(FrontCategory::getParentCode, frontCategory.getCode()));
         for (FrontCategory frontCategory1 : frontCategoryList) {
-            addShopCategory(frontCategory1,shopId);
+            addShopCategory(frontCategory1,hbShopId,shopId,shopCategory.getId());
         }
     }
 
@@ -193,7 +207,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
         shopCategory.setName(excelDTO.getName());
         shopCategory.setSubName(excelDTO.getSubName());
         shopCategory.setCode(generateUniqueCode());
-        shopCategory.setShopId(excelDTO.getShopId());
+        shopCategory.setHbShopId(excelDTO.getShopId());
         shopCategory.setIsDelete(0); // 默认未删除
         shopCategory.setParentCode("0"); // 默认未删除
 
@@ -214,24 +228,20 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
     /**
      * 验证门店前台类目数据有效性
      *
-     * @param shopCategories 门店前台类目列表
+     * @param category 门店前台类目
      */
-    private void validateShopCategories(List<ShopCategory> shopCategories) {
-        if (shopCategories == null || shopCategories.isEmpty()) {
-            return;
-        }
-
-        for (int i = 0; i < shopCategories.size(); i++) {
-            ShopCategory category = shopCategories.get(i);
-
+    private Long validateShopCategories(ShopCategory category,int i) {
             // 检查必填字段
-            if (category.getName() == null || category.getName().trim().isEmpty()) {
+            if (ObjectUtils.isEmpty(category.getName())) {
                 throw new GlobalException("第" + (i + 1) + "行:类目名称不能为空");
             }
-
-            if (category.getShopId() == null) {
+            if (ObjectUtils.isEmpty(category.getHbShopId())) {
                 throw new GlobalException("第" + (i + 1) + "行:门店ID不能为空");
             }
+            ShopDetail shopDetail = shopDetailMapper.selectByHbStationId(category.getHbShopId());
+            if (ObjectUtils.isEmpty(shopDetail)) {
+                throw new GlobalException("第" + (i + 1) + "行:门店不存在");
+            }
 
             // 检查类目名称长度
             if (category.getName().length() > 255) {
@@ -261,9 +271,7 @@ public class ShopCategoryServiceImpl extends ServiceImpl<ShopCategoryMapper, Sho
             if (integer > 1) {
                 throw new GlobalException("第" + (i + 1) + "行:二级类目"+category.getSubName()+"存在多个");
             }
-
-//            .eq(FrontCategory::getLevel, 1));
-        }
+            return shopDetail.getShopId();
     }
 
 

+ 1 - 3
yami-shop-service/src/main/resources/mapper/ChannelProdMapper.xml

@@ -77,7 +77,7 @@
 
     <update id="deleteChannelProd">
         UPDATE tz_channel_prod
-        SET is_delete   = 1,
+        SET is_delete = 1,
             update_time = NOW()
         WHERE sku_id = #{skuId} AND shop_id = #{shopId}
     </update>
@@ -116,8 +116,6 @@
         WHERE c.sku_id = #{skuId}
           AND c.shop_id = #{shopId}
           AND c.is_delete = 0
-
-
     </select>
     <select id="exportList" resultType="com.yami.shop.bean.vo.ChannelProdExportVO">
         SELECT