diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/shop/CereShopGroupLangInfoController.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/shop/CereShopGroupLangInfoController.java
new file mode 100644
index 0000000..a5f9ea3
--- /dev/null
+++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/controller/shop/CereShopGroupLangInfoController.java
@@ -0,0 +1,29 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.admin.controller.shop;
+
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@RestController
+@RequestMapping("/cereShopGroupLangInfo")
+@Api(value = "CereShopGroupLangInfo", tags = "")
+public class CereShopGroupLangInfoController {
+
+}
diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/shop/CereShopGroupLangInfoDAO.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/shop/CereShopGroupLangInfoDAO.java
new file mode 100644
index 0000000..b32266a
--- /dev/null
+++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/dao/shop/CereShopGroupLangInfoDAO.java
@@ -0,0 +1,16 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.admin.dao.shop;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CereShopGroupLangInfoDAO extends BaseMapper {
+
+}
diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/CereShopGroupLangInfoService.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/CereShopGroupLangInfoService.java
new file mode 100644
index 0000000..d7b8949
--- /dev/null
+++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/CereShopGroupLangInfoService.java
@@ -0,0 +1,22 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.admin.service.shop;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+/**
+ *
+ * 业务接口
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+public interface CereShopGroupLangInfoService extends IService {
+
+}
diff --git a/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopGroupLangInfoServiceImpl.java b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
new file mode 100644
index 0000000..b813723
--- /dev/null
+++ b/cereshop-admin/src/main/java/com/shop/cereshop/admin/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.admin.service.shop.impl;
+
+import com.shop.cereshop.admin.dao.shop.CereShopGroupLangInfoDAO;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.admin.service.shop.CereShopGroupLangInfoService;
+
+import lombok.extern.slf4j.Slf4j;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 业务实现类
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@Service
+public class CereShopGroupLangInfoServiceImpl extends ServiceImpl implements CereShopGroupLangInfoService {
+}
diff --git a/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml b/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
new file mode 100644
index 0000000..c45db24
--- /dev/null
+++ b/cereshop-admin/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, shop_group_id, group_name, group_describe, language_type
+
+
+
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java
index 99f2a9f..04d75c6 100644
--- a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/canvas/CanvasController.java
@@ -19,6 +19,7 @@ import com.shop.cereshop.app.param.canvas.CanvasAppProductParam;
import com.shop.cereshop.app.param.canvas.CanvasCouponParam;
import com.shop.cereshop.app.param.canvas.RenovationParam;
import com.shop.cereshop.app.param.member.MemberProductPageParam;
+import com.shop.cereshop.app.param.shop.ProductGetGroupParam;
import com.shop.cereshop.app.service.activity.CerePlatformActivityService;
import com.shop.cereshop.app.service.buyer.CereBuyerUserService;
import com.shop.cereshop.app.service.coupon.CereShopCouponService;
@@ -30,6 +31,7 @@ import com.shop.cereshop.app.service.platformtool.CerePlatformSeckillService;
import com.shop.cereshop.app.service.price.CereShopPriceService;
import com.shop.cereshop.app.service.product.CereProductMemberService;
import com.shop.cereshop.app.service.product.CereShopProductService;
+import com.shop.cereshop.app.service.shop.CereShopGroupService;
import com.shop.cereshop.app.utils.ContextUtil;
import com.shop.cereshop.commons.constant.CoReturnFormat;
import com.shop.cereshop.commons.domain.buyer.CereBuyerUser;
@@ -37,6 +39,7 @@ import com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.common.PageParam;
import com.shop.cereshop.commons.domain.product.Classify;
+import com.shop.cereshop.commons.domain.shop.CereShopGroup;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.result.Result;
import com.shop.cereshop.commons.utils.EmptyUtils;
@@ -96,6 +99,9 @@ public class CanvasController {
@Autowired
private CereLiveService cereLiveService;
+ @Autowired
+ private CereShopGroupService cereShopGroupService;
+
/**
* 画布选择商品查询
* @param param
@@ -133,6 +139,19 @@ public class CanvasController {
}
/**
+ * 查询商品分组
+ * @return
+ */
+ @GetMapping("getProductGroup")
+ @ApiOperation(value = "查询商品分组")
+ public Result getProductGroup() throws CoBusinessException{
+ ProductGetGroupParam param = new ProductGetGroupParam();
+ param.setShopId(Long.parseLong(ContextUtil.getProject()));
+ List list=cereShopGroupService.getGroupSelect(param);
+ return new Result(list);
+ }
+
+ /**
* 查询所有平台优惠券
* @return
*/
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/controller/shop/CereShopGroupLangInfoController.java b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/shop/CereShopGroupLangInfoController.java
new file mode 100644
index 0000000..21d3d2d
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/controller/shop/CereShopGroupLangInfoController.java
@@ -0,0 +1,29 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.app.controller.shop;
+
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@RestController
+@RequestMapping("/cereShopGroupLangInfo")
+@Api(value = "CereShopGroupLangInfo", tags = "")
+public class CereShopGroupLangInfoController {
+
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupDAO.java b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupDAO.java
new file mode 100644
index 0000000..a2fecea
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupDAO.java
@@ -0,0 +1,41 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.dao.shop;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.shop.cereshop.app.page.group.Group;
+import com.shop.cereshop.app.page.group.GroupDetail;
+import com.shop.cereshop.app.page.group.GroupProduct;
+import com.shop.cereshop.app.param.shop.GroupGetAllParam;
+import com.shop.cereshop.commons.domain.shop.CereShopGroup;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface CereShopGroupDAO extends BaseMapper {
+ int deleteByPrimaryKey(@Param("shopGroupId") Long shopGroupId);
+
+ int insertSelective(CereShopGroup record);
+
+ CereShopGroup selectByPrimaryKey(Long shopGroupId);
+
+ int updateByPrimaryKeySelective(CereShopGroup record);
+
+ int updateByPrimaryKey(CereShopGroup record);
+
+ List getGroupSelect(@Param("project") String project, @Param("shopId") Long shopId);
+
+ void updateGroup(@Param("shopGroupId") Long shopGroupId);
+
+ GroupDetail getById(@Param("shopGroupId") Long shopGroupId);
+
+ List getAll(GroupGetAllParam param);
+ List findProducts(@Param("shopGroupId") Long shopGroupId);
+
+ List selectAll(@Param("project") String project);
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupLangInfoDAO.java b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupLangInfoDAO.java
new file mode 100644
index 0000000..1e7a815
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/dao/shop/CereShopGroupLangInfoDAO.java
@@ -0,0 +1,16 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.app.dao.shop;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CereShopGroupLangInfoDAO extends BaseMapper {
+
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/Group.java b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/Group.java
new file mode 100644
index 0000000..8938aeb
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/Group.java
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.page.group;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 分组列表数据
+ */
+@Data
+@ApiModel(value = "Group", description = "分组列表数据")
+public class Group {
+ /**
+ * 商品分组id
+ */
+ @ApiModelProperty(value = "商品分组id")
+ private Long shopGroupId;
+
+ /**
+ * 分组名称
+ */
+ @ApiModelProperty(value = "分组名称")
+ private String groupName;
+
+ /**
+ * 分组描述
+ */
+ @ApiModelProperty(value = "分组描述")
+ private String groupDescribe;
+
+ /**
+ * 商品数量
+ */
+ @ApiModelProperty(value = "商品数量")
+ private Integer number;
+
+ /**
+ * 修改时间
+ */
+ @ApiModelProperty(value = "修改时间")
+ private String updateTime;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue();
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ langInfo = langInfoMap.get(defaultLangType);
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ langInfo = langInfoMap.get(LangUtil.ZH);
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ langInfo = langInfoMap.get(LangUtil.EN);
+ }
+ if (Objects.nonNull(langInfo)) {
+ setGroupName(langInfo.getGroupName());
+ setGroupDescribe(langInfo.getGroupDescribe());
+ }
+ }else if(StringUtils.isNotEmpty(groupName)){
+ langInfoMap = new HashMap<>();
+ CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo();
+ groupLangInfo.setGroupName(getGroupName());
+ groupLangInfo.setGroupDescribe(getGroupDescribe());
+ groupLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, groupLangInfo);
+ }
+ }
+
+ public void initMap(List groupLangInfoList){
+ if (CollectionUtils.isNotEmpty(groupLangInfoList)) {
+ List langInfoList =
+ groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList());
+
+ Map groupLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(langInfoList)){
+ for (CereShopGroupLangInfo langInfo : langInfoList) {
+ groupLangInfoMap.put(langInfo.getLanguageType(), langInfo);
+ }
+ }
+ setLangInfoMap(groupLangInfoMap);
+ }
+ }
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupDetail.java b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupDetail.java
new file mode 100644
index 0000000..913ce69
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupDetail.java
@@ -0,0 +1,113 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.page.group;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 分组详情数据
+ */
+@Data
+@ApiModel(value = "GroupDetail", description = "分组详情数据")
+public class GroupDetail {
+ /**
+ * 商品分组id
+ */
+ @ApiModelProperty(value = "商品分组id")
+ private Long shopGroupId;
+
+ /**
+ * 关联店铺id
+ */
+ @ApiModelProperty(value = "关联店铺id")
+ private Long shopId;
+
+ /**
+ * 分组名称
+ */
+ @ApiModelProperty(value = "分组名称")
+ private String groupName;
+
+ /**
+ * 分组封面图片地址
+ */
+ @ApiModelProperty(value = "分组封面图片地址")
+ private String groupImage;
+
+ /**
+ * 分组描述
+ */
+ @ApiModelProperty(value = "分组描述")
+ private String groupDescribe;
+
+ /**
+ * 关联商品数据
+ */
+ @ApiModelProperty(value = "关联商品数据")
+ private List products;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue();
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ langInfo = langInfoMap.get(defaultLangType);
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ langInfo = langInfoMap.get(LangUtil.ZH);
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ langInfo = langInfoMap.get(LangUtil.EN);
+ }
+ if (Objects.nonNull(langInfo)) {
+ setGroupName(langInfo.getGroupName());
+ setGroupDescribe(langInfo.getGroupDescribe());
+ }
+ }else if(StringUtils.isNotEmpty(groupName)){
+ langInfoMap = new HashMap<>();
+ CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo();
+ groupLangInfo.setGroupName(getGroupName());
+ groupLangInfo.setGroupDescribe(getGroupDescribe());
+ groupLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, groupLangInfo);
+ }
+ }
+
+ public void initMap(List groupLangInfoList){
+ if (CollectionUtils.isNotEmpty(groupLangInfoList)) {
+ List langInfoList =
+ groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList());
+
+ Map groupLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(langInfoList)){
+ for (CereShopGroupLangInfo langInfo : langInfoList) {
+ groupLangInfoMap.put(langInfo.getLanguageType(), langInfo);
+ }
+ }
+ setLangInfoMap(groupLangInfoMap);
+ }
+ }
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupProduct.java b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupProduct.java
new file mode 100644
index 0000000..ba2ce4c
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/page/group/GroupProduct.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.page.group;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
+/**
+ * 分组商品数据
+ */
+@Data
+@ApiModel(value = "GroupProduct", description = "分组商品数据")
+public class GroupProduct {
+
+ /**
+ * 商品id
+ */
+ @ApiModelProperty(value = "商品id")
+ private Long productId;
+
+ /**
+ * 商品名称
+ */
+ @ApiModelProperty(value = "商品名称")
+ private String productName;
+
+ /**
+ * 上架状态 1-已上架 0-未上架
+ */
+ @ApiModelProperty(value = "上架状态 1-已上架 0-未上架")
+ private Integer shelveState;
+
+ /**
+ * 图片
+ */
+ @ApiModelProperty(value = "图片")
+ private String image;
+
+ /**
+ * 商品原价
+ */
+ @ApiModelProperty(value = "商品原价")
+ private BigDecimal originalPrice;
+
+ /**
+ * 库存数量
+ */
+ @ApiModelProperty(value = "库存数量")
+ private Integer stockNumber;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ setProductName(langInfoMap.get(defaultLangType).getProductName());
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ setProductName(langInfoMap.get(LangUtil.ZH).getProductName());
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ setProductName(langInfoMap.get(LangUtil.EN).getProductName());
+ } else {
+ setProductName(langInfoMap.entrySet().stream().findFirst().get().getValue().getProductName());
+ }
+ }else if(StringUtils.isNotEmpty(productName)){
+ langInfoMap = new HashMap<>();
+ CereShopProductLangInfo classifyLangInfo = new CereShopProductLangInfo();
+ classifyLangInfo.setProductId(getProductId());
+ classifyLangInfo.setProductName(getProductName());
+ classifyLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, classifyLangInfo);
+ }
+ }
+
+ public void initMap(List cereProductClassifyLangInfoList){
+ if (CollectionUtils.isNotEmpty(cereProductClassifyLangInfoList)) {
+ List productClassifyLangInfoList =
+ cereProductClassifyLangInfoList.stream().filter(item -> Objects.equals(item.getProductId(), getProductId())).collect(Collectors.toList());
+
+ Map cereProductClassifyLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(productClassifyLangInfoList)){
+ for (CereShopProductLangInfo cereProductClassifyLangInfo : productClassifyLangInfoList) {
+ cereProductClassifyLangInfoMap.put(cereProductClassifyLangInfo.getLanguageType(), cereProductClassifyLangInfo);
+ }
+ }
+ setLangInfoMap(cereProductClassifyLangInfoMap);
+ }
+ }
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/GroupGetAllParam.java b/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/GroupGetAllParam.java
new file mode 100644
index 0000000..f5cdb65
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/GroupGetAllParam.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.param.shop;
+
+import com.shop.cereshop.commons.domain.common.PageParam;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 获取分组列表请求
+ */
+@Data
+@ApiModel(value = "GroupGetAllParam", description = "获取分组列表请求")
+public class GroupGetAllParam extends PageParam {
+
+ /**
+ * 店铺id
+ */
+ @ApiModelProperty(value = "店铺id")
+ private Long shopId;
+
+ /**
+ * 搜索字段
+ */
+ @ApiModelProperty(value = "搜索字段")
+ private String search;
+
+ /**
+ * 平台号
+ */
+ @ApiModelProperty(value = "平台号", hidden = true)
+ private String project;
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/ProductGetGroupParam.java b/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/ProductGetGroupParam.java
new file mode 100644
index 0000000..1c6bca2
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/param/shop/ProductGetGroupParam.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.param.shop;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+/**
+ * 获取商品分组下拉请求
+ */
+@Data
+@ApiModel(value = "ProductGetGroupParam", description = "获取商品分组下拉请求")
+public class ProductGetGroupParam {
+
+ /**
+ * 关联店铺id
+ */
+ @ApiModelProperty(value = "关联店铺id")
+ private Long shopId;
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupLangInfoService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupLangInfoService.java
new file mode 100644
index 0000000..3df2ae5
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupLangInfoService.java
@@ -0,0 +1,22 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.app.service.shop;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+/**
+ *
+ * 业务接口
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+public interface CereShopGroupLangInfoService extends IService {
+
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupService.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupService.java
new file mode 100644
index 0000000..2084ae4
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/CereShopGroupService.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.service.shop;
+
+import com.shop.cereshop.app.page.group.GroupDetail;
+import com.shop.cereshop.app.param.shop.GroupGetAllParam;
+import com.shop.cereshop.app.param.shop.ProductGetGroupParam;
+import com.shop.cereshop.commons.domain.common.Page;
+import com.shop.cereshop.commons.domain.shop.CereShopGroup;
+import com.shop.cereshop.commons.exception.CoBusinessException;
+
+import java.util.List;
+
+public interface CereShopGroupService {
+ List getGroupSelect(ProductGetGroupParam param) throws CoBusinessException;
+ GroupDetail getById(Long shopGroupId) throws CoBusinessException;
+
+ Page getAll(GroupGetAllParam param) throws CoBusinessException;
+
+ List selectAll();
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupLangInfoServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
new file mode 100644
index 0000000..27716d3
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.app.service.shop.impl;
+
+import com.shop.cereshop.app.dao.shop.CereShopGroupLangInfoDAO;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.app.service.shop.CereShopGroupLangInfoService;
+
+import lombok.extern.slf4j.Slf4j;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 业务实现类
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@Service
+public class CereShopGroupLangInfoServiceImpl extends ServiceImpl implements CereShopGroupLangInfoService {
+}
diff --git a/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupServiceImpl.java b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupServiceImpl.java
new file mode 100644
index 0000000..46981ff
--- /dev/null
+++ b/cereshop-app/src/main/java/com/shop/cereshop/app/service/shop/impl/CereShopGroupServiceImpl.java
@@ -0,0 +1,151 @@
+/*
+ * Copyright (C) 2017-2021
+ * All rights reserved, Designed By 深圳中科鑫智科技有限公司
+ * Copyright authorization contact 18814114118
+ */
+package com.shop.cereshop.app.service.shop.impl;
+
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import com.shop.cereshop.app.dao.product.CereShopProductLangInfoDAO;
+import com.shop.cereshop.app.dao.shop.CereShopGroupDAO;
+import com.shop.cereshop.app.dao.shop.CereShopGroupLangInfoDAO;
+import com.shop.cereshop.app.page.group.Group;
+import com.shop.cereshop.app.page.group.GroupDetail;
+import com.shop.cereshop.app.page.group.GroupProduct;
+import com.shop.cereshop.app.param.shop.GroupGetAllParam;
+import com.shop.cereshop.app.param.shop.ProductGetGroupParam;
+import com.shop.cereshop.app.service.shop.CereShopGroupService;
+import com.shop.cereshop.app.utils.ContextUtil;
+import com.shop.cereshop.commons.domain.common.Page;
+import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo;
+import com.shop.cereshop.commons.domain.shop.CereShopGroup;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.commons.exception.CoBusinessException;
+import com.shop.cereshop.commons.utils.ProjectUtil;
+import org.apache.commons.collections4.CollectionUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.stream.Collectors;
+
+@Service
+public class CereShopGroupServiceImpl implements CereShopGroupService {
+
+ @Autowired
+ private CereShopGroupDAO cereShopGroupDAO;
+
+ @Autowired
+ private CereShopGroupLangInfoDAO cereShopGroupLangInfoDAO;
+
+ @Autowired
+ private CereShopProductLangInfoDAO cereShopProductLangInfoDAO;
+
+
+ @Override
+ public List getGroupSelect(ProductGetGroupParam param) throws CoBusinessException {
+// ContextUtil.getProject()
+ List shopGroupList = cereShopGroupDAO.getGroupSelect(ProjectUtil.DEFAULT_PROJECT, param.getShopId());
+ setShopGroupLangInfo(shopGroupList);
+ return shopGroupList;
+ }
+ @Override
+ public GroupDetail getById(Long shopGroupId) throws CoBusinessException {
+ GroupDetail detail=cereShopGroupDAO.getById(shopGroupId);
+ if(detail!=null){
+ //设置商品数据
+ detail.setProducts(cereShopGroupDAO.findProducts(shopGroupId));
+ setGroupProductLangInfo(detail.getProducts());
+ }
+ setGroupDetailLangInfo(detail);
+ return detail;
+ }
+
+ @Override
+ public Page getAll(GroupGetAllParam param) throws CoBusinessException {
+ param.setProject(ContextUtil.getProject());
+ PageHelper.startPage(param.getPage(),param.getPageSize());
+ List list = cereShopGroupDAO.getAll(param);
+ setGroupLangInfo(list);
+ PageInfo pageInfo=new PageInfo<>(list);
+ Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
+ return page;
+ }
+
+
+ @Override
+ public List selectAll() {
+ List groupList = cereShopGroupDAO.selectAll(ContextUtil.getProject());
+ setShopGroupLangInfo(groupList);
+ return groupList;
+ }
+
+ private void setGroupProductLangInfo(List groupProductList){
+ if(CollectionUtils.isEmpty(groupProductList)){
+ return;
+ }
+ List productIdList = new ArrayList<>();
+ productIdList.addAll(groupProductList.stream().map(GroupProduct::getProductId).collect(Collectors.toList()));
+ productIdList = productIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(productIdList)){
+ List productLangInfoList = cereShopProductLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopProductLangInfo::getProductId,productIdList));
+ if(CollectionUtils.isNotEmpty(groupProductList)){
+ for (GroupProduct product : groupProductList) {
+ product.initMap(productLangInfoList);
+ product.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setShopGroupLangInfo(List shopGroupList){
+ if(CollectionUtils.isEmpty(shopGroupList)){
+ return;
+ }
+ List groupIdList = new ArrayList<>();
+ groupIdList.addAll(shopGroupList.stream().map(CereShopGroup::getShopGroupId).collect(Collectors.toList()));
+ groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(groupIdList)){
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList));
+ if(CollectionUtils.isNotEmpty(shopGroupList)){
+ for (CereShopGroup shopGroup : shopGroupList) {
+ shopGroup.initMap(groupLangInfoList);
+ shopGroup.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setGroupLangInfo(List groupList){
+ if(CollectionUtils.isEmpty(groupList)){
+ return;
+ }
+ List groupIdList = new ArrayList<>();
+ groupIdList.addAll(groupList.stream().map(Group::getShopGroupId).collect(Collectors.toList()));
+ groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(groupIdList)){
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList));
+ if(CollectionUtils.isNotEmpty(groupList)){
+ for (Group group : groupList) {
+ group.initMap(groupLangInfoList);
+ group.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setGroupDetailLangInfo(GroupDetail groupDetail){
+ if(groupDetail == null){
+ return;
+ }
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().eq(CereShopGroupLangInfo::getShopGroupId,groupDetail.getShopGroupId()));
+ groupDetail.initMap(groupLangInfoList);
+ groupDetail.initData(ContextUtil.getLanguage());
+ }
+}
diff --git a/cereshop-app/src/main/resources/application.yml b/cereshop-app/src/main/resources/application.yml
index 6a6d8dc..e7fa29a 100644
--- a/cereshop-app/src/main/resources/application.yml
+++ b/cereshop-app/src/main/resources/application.yml
@@ -75,7 +75,7 @@ scrmTrackReportUrl: https://scrm-demo.zkthink.com/stage-api/wecom/clue-user/add
pay:
paymentMode: 4
-spay:
+xspay:
url: https://uwebgate.hnapay.com/webgate/unifiedAPI.htm
app_return_url: xx
app_notice_url: https://wechat.hnthee.com/ceres-app-api/extend/xsPay/pay/notify
diff --git a/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml b/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
new file mode 100644
index 0000000..a411aef
--- /dev/null
+++ b/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ shop_group_id, shop_id, project, group_name,group_describe, group_image, create_time, update_time
+
+
+
+ delete from cere_shop_group
+ where shop_group_id = #{shopGroupId,jdbcType=BIGINT}
+
+
+ insert into cere_shop_group
+
+
+ shop_id,
+
+
+ project,
+
+
+ group_name,
+
+
+ group_describe,
+
+
+ group_image,
+
+
+ create_time,
+
+
+ update_time,
+
+
+
+
+ #{shopId,jdbcType=BIGINT},
+
+
+ #{project,jdbcType=VARCHAR},
+
+
+ #{groupName,jdbcType=VARCHAR},
+
+
+ #{groupDescribe,jdbcType=VARCHAR},
+
+
+ #{groupImage,jdbcType=VARCHAR},
+
+
+ #{createTime,jdbcType=VARCHAR},
+
+
+ #{updateTime,jdbcType=VARCHAR},
+
+
+
+
+ update cere_shop_group
+
+
+ shop_id = #{shopId,jdbcType=BIGINT},
+
+
+ project = #{groupName,jdbcType=VARCHAR},
+
+
+ group_name = #{groupName,jdbcType=VARCHAR},
+
+
+ group_describe = #{groupDescribe,jdbcType=VARCHAR},
+
+
+ group_image = #{groupImage,jdbcType=VARCHAR},
+
+
+ create_time = #{createTime,jdbcType=VARCHAR},
+
+
+ update_time = #{updateTime,jdbcType=VARCHAR},
+
+
+ where shop_group_id = #{shopGroupId,jdbcType=BIGINT}
+
+
+ update cere_shop_group
+ set shop_id = #{shopId,jdbcType=BIGINT},
+ project = #{project,jdbcType=VARCHAR},
+ group_name = #{groupName,jdbcType=VARCHAR},
+ group_describe = #{groupDescribe,jdbcType=VARCHAR},
+ group_image = #{groupImage,jdbcType=VARCHAR},
+ create_time = #{createTime,jdbcType=VARCHAR},
+ update_time = #{updateTime,jdbcType=VARCHAR}
+ where shop_group_id = #{shopGroupId,jdbcType=BIGINT}
+
+
+
+
+
+
+
+ UPDATE cere_shop_product set shop_group_id=NULL where shop_group_id=#{shopGroupId}
+
+
+
+
+
+
+
+
+
diff --git a/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml b/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
new file mode 100644
index 0000000..8caf852
--- /dev/null
+++ b/cereshop-app/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, shop_group_id, group_name, group_describe, language_type
+
+
+
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java
index 08c1818..3b84c5c 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/CanvasController.java
@@ -11,6 +11,7 @@ import com.shop.cereshop.business.page.price.ShopPriceDetail;
import com.shop.cereshop.business.page.product.CanvasBusinessProductParam;
import com.shop.cereshop.business.page.product.MemberProduct;
import com.shop.cereshop.business.param.canvas.CanvasCouponParam;
+import com.shop.cereshop.business.param.product.ProductGetGroupParam;
import com.shop.cereshop.business.param.renovation.RenovationParam;
import com.shop.cereshop.business.service.activity.CerePlatformActivityService;
import com.shop.cereshop.business.service.canvas.CerePlatformCanvasService;
@@ -19,12 +20,14 @@ import com.shop.cereshop.business.service.price.CereShopPriceService;
import com.shop.cereshop.business.service.product.CereProductClassifyService;
import com.shop.cereshop.business.service.product.CereProductMemberService;
import com.shop.cereshop.business.service.product.CereShopProductService;
+import com.shop.cereshop.business.service.shop.CereShopGroupService;
import com.shop.cereshop.business.service.tool.CereShopCouponService;
import com.shop.cereshop.business.utils.ContextUtil;
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser;
import com.shop.cereshop.commons.domain.canvas.CerePlatformCanvas;
import com.shop.cereshop.commons.domain.common.Page;
import com.shop.cereshop.commons.domain.product.Classify;
+import com.shop.cereshop.commons.domain.shop.CereShopGroup;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.result.Result;
import com.shop.cereshop.commons.utils.GsonUtil;
@@ -58,6 +61,8 @@ public class CanvasController {
private CereProductClassifyService cereProductClassifyService;
@Autowired
+ private CereShopGroupService cereShopGroupService;
+ @Autowired
private CerePlatformCanvasService cerePlatformCanvasService;
@Autowired
@@ -129,6 +134,19 @@ public class CanvasController {
}
/**
+ * 查询商品分组
+ * @return
+ */
+ @GetMapping("getProductGroup")
+ @ApiOperation(value = "查询商品分组")
+ public Result getProductGroup() throws CoBusinessException{
+ ProductGetGroupParam param = new ProductGetGroupParam();
+ param.setShopId(ContextUtil.getBusinessId());
+ List list=cereShopGroupService.getGroupSelect(param);
+ return new Result(list);
+ }
+
+ /**
* 查询所有平台优惠券
* @return
*/
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupController.java
index 57769e5..4fa4463 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupController.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/ShopGroupController.java
@@ -140,7 +140,7 @@ public class ShopGroupController {
@PostMapping(value = "getProducts")
@ApiOperation(value = "手动添加商品查询")
public Result> getProducts(@RequestBody GroupProductParam param) throws CoBusinessException{
- param.setShopId(ContextUtil.getBusinessId());
+ param.setBusinessId(ContextUtil.getBusinessId());
Page page=cereShopGroupService.getProducts(param);
return new Result(page);
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/controller/shop/CereShopGroupLangInfoController.java b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/shop/CereShopGroupLangInfoController.java
new file mode 100644
index 0000000..2750f77
--- /dev/null
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/controller/shop/CereShopGroupLangInfoController.java
@@ -0,0 +1,29 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.business.controller.shop;
+
+import io.swagger.annotations.Api;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+
+/**
+ *
+ * 前端控制器
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@RestController
+@RequestMapping("/cereShopGroupLangInfo")
+@Api(value = "CereShopGroupLangInfo", tags = "")
+public class CereShopGroupLangInfoController {
+
+}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopGroupLangInfoDAO.java b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopGroupLangInfoDAO.java
new file mode 100644
index 0000000..7fe32eb
--- /dev/null
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/dao/shop/CereShopGroupLangInfoDAO.java
@@ -0,0 +1,16 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.business.dao.shop;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+import org.apache.ibatis.annotations.Mapper;
+
+@Mapper
+public interface CereShopGroupLangInfoDAO extends BaseMapper {
+
+}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/Group.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/Group.java
index 997c428..08e730c 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/Group.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/Group.java
@@ -5,10 +5,21 @@
*/
package com.shop.cereshop.business.page.group;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
+
/**
* 分组列表数据
*/
@@ -44,4 +55,53 @@ public class Group {
*/
@ApiModelProperty(value = "修改时间")
private String updateTime;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue();
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ langInfo = langInfoMap.get(defaultLangType);
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ langInfo = langInfoMap.get(LangUtil.ZH);
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ langInfo = langInfoMap.get(LangUtil.EN);
+ }
+ if (Objects.nonNull(langInfo)) {
+ setGroupName(langInfo.getGroupName());
+ setGroupDescribe(langInfo.getGroupDescribe());
+ }
+ }else if(StringUtils.isNotEmpty(groupName)){
+ langInfoMap = new HashMap<>();
+ CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo();
+ groupLangInfo.setGroupName(getGroupName());
+ groupLangInfo.setGroupDescribe(getGroupDescribe());
+ groupLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, groupLangInfo);
+ }
+ }
+
+ public void initMap(List groupLangInfoList){
+ if (CollectionUtils.isNotEmpty(groupLangInfoList)) {
+ List langInfoList =
+ groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList());
+
+ Map groupLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(langInfoList)){
+ for (CereShopGroupLangInfo langInfo : langInfoList) {
+ groupLangInfoMap.put(langInfo.getLanguageType(), langInfo);
+ }
+ }
+ setLangInfoMap(groupLangInfoMap);
+ }
+ }
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupDetail.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupDetail.java
index ddc2e5f..fd17e97 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupDetail.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupDetail.java
@@ -5,11 +5,20 @@
*/
package com.shop.cereshop.business.page.group;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* 分组详情数据
@@ -52,4 +61,53 @@ public class GroupDetail {
*/
@ApiModelProperty(value = "关联商品数据")
private List products;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue();
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ langInfo = langInfoMap.get(defaultLangType);
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ langInfo = langInfoMap.get(LangUtil.ZH);
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ langInfo = langInfoMap.get(LangUtil.EN);
+ }
+ if (Objects.nonNull(langInfo)) {
+ setGroupName(langInfo.getGroupName());
+ setGroupDescribe(langInfo.getGroupDescribe());
+ }
+ }else if(StringUtils.isNotEmpty(groupName)){
+ langInfoMap = new HashMap<>();
+ CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo();
+ groupLangInfo.setGroupName(getGroupName());
+ groupLangInfo.setGroupDescribe(getGroupDescribe());
+ groupLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, groupLangInfo);
+ }
+ }
+
+ public void initMap(List groupLangInfoList){
+ if (CollectionUtils.isNotEmpty(groupLangInfoList)) {
+ List langInfoList =
+ groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList());
+
+ Map groupLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(langInfoList)){
+ for (CereShopGroupLangInfo langInfo : langInfoList) {
+ groupLangInfoMap.put(langInfo.getLanguageType(), langInfo);
+ }
+ }
+ setLangInfoMap(groupLangInfoMap);
+ }
+ }
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupProduct.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupProduct.java
index 049f8d3..d2bfbc6 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupProduct.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/group/GroupProduct.java
@@ -5,11 +5,21 @@
*/
package com.shop.cereshop.business.page.group;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* 分组商品数据
@@ -53,4 +63,50 @@ public class GroupProduct {
*/
@ApiModelProperty(value = "库存数量")
private Integer stockNumber;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ setProductName(langInfoMap.get(defaultLangType).getProductName());
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ setProductName(langInfoMap.get(LangUtil.ZH).getProductName());
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ setProductName(langInfoMap.get(LangUtil.EN).getProductName());
+ } else {
+ setProductName(langInfoMap.entrySet().stream().findFirst().get().getValue().getProductName());
+ }
+ }else if(StringUtils.isNotEmpty(productName)){
+ langInfoMap = new HashMap<>();
+ CereShopProductLangInfo classifyLangInfo = new CereShopProductLangInfo();
+ classifyLangInfo.setProductId(getProductId());
+ classifyLangInfo.setProductName(getProductName());
+ classifyLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, classifyLangInfo);
+ }
+ }
+
+ public void initMap(List cereProductClassifyLangInfoList){
+ if (CollectionUtils.isNotEmpty(cereProductClassifyLangInfoList)) {
+ List productClassifyLangInfoList =
+ cereProductClassifyLangInfoList.stream().filter(item -> Objects.equals(item.getProductId(), getProductId())).collect(Collectors.toList());
+
+ Map cereProductClassifyLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(productClassifyLangInfoList)){
+ for (CereShopProductLangInfo cereProductClassifyLangInfo : productClassifyLangInfoList) {
+ cereProductClassifyLangInfoMap.put(cereProductClassifyLangInfo.getLanguageType(), cereProductClassifyLangInfo);
+ }
+ }
+ setLangInfoMap(cereProductClassifyLangInfoMap);
+ }
+ }
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/page/order/Product.java b/cereshop-business/src/main/java/com/shop/cereshop/business/page/order/Product.java
index 96a742a..17ac7a6 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/page/order/Product.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/page/order/Product.java
@@ -5,12 +5,21 @@
*/
package com.shop.cereshop.business.page.order;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
+import java.util.HashMap;
import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* 订单商品返回数据实体类
@@ -132,4 +141,50 @@ public class Product {
*/
@ApiModelProperty(value = "品牌名称")
private String brandName;
+
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ setProductName(langInfoMap.get(defaultLangType).getProductName());
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ setProductName(langInfoMap.get(LangUtil.ZH).getProductName());
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ setProductName(langInfoMap.get(LangUtil.EN).getProductName());
+ } else {
+ setProductName(langInfoMap.entrySet().stream().findFirst().get().getValue().getProductName());
+ }
+ }else if(StringUtils.isNotEmpty(productName)){
+ langInfoMap = new HashMap<>();
+ CereShopProductLangInfo classifyLangInfo = new CereShopProductLangInfo();
+ classifyLangInfo.setProductId(getProductId());
+ classifyLangInfo.setProductName(getProductName());
+ classifyLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, classifyLangInfo);
+ }
+ }
+
+ public void initMap(List cereProductClassifyLangInfoList){
+ if (CollectionUtils.isNotEmpty(cereProductClassifyLangInfoList)) {
+ List productClassifyLangInfoList =
+ cereProductClassifyLangInfoList.stream().filter(item -> Objects.equals(item.getProductId(), getProductId())).collect(Collectors.toList());
+
+ Map cereProductClassifyLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(productClassifyLangInfoList)){
+ for (CereShopProductLangInfo cereProductClassifyLangInfo : productClassifyLangInfoList) {
+ cereProductClassifyLangInfoMap.put(cereProductClassifyLangInfo.getLanguageType(), cereProductClassifyLangInfo);
+ }
+ }
+ setLangInfoMap(cereProductClassifyLangInfoMap);
+ }
+ }
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/GroupProductParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/GroupProductParam.java
index badd41c..d4d8f90 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/GroupProductParam.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/GroupProductParam.java
@@ -18,7 +18,13 @@ import java.math.BigDecimal;
@Data
@ApiModel(value = "GroupProductParam", description = "获取分组商品列表请求")
public class GroupProductParam extends PageParam {
-
+
+ /**
+ * 商家id
+ */
+ @ApiModelProperty(value = "商家id")
+ private Long businessId;
+
/**
* 店铺id
*/
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupSaveParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupSaveParam.java
index 6a7edf3..6668820 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupSaveParam.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupSaveParam.java
@@ -5,12 +5,15 @@
*/
package com.shop.cereshop.business.param.group;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
/**
* @author 新增商品分组
@@ -61,6 +64,13 @@ public class ShopGroupSaveParam implements Serializable {
@ApiModelProperty(value = "筛选条件数组")
private List conditions;
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
private static final long serialVersionUID = 1L;
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupUpdateParam.java b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupUpdateParam.java
index 077033f..138239d 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupUpdateParam.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/param/group/ShopGroupUpdateParam.java
@@ -5,12 +5,15 @@
*/
package com.shop.cereshop.business.param.group;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
+import java.util.Map;
/**
* @author 修改商品分组
@@ -66,6 +69,13 @@ public class ShopGroupUpdateParam implements Serializable {
@ApiModelProperty(value = "筛选条件数组")
private List conditions;
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
private static final long serialVersionUID = 1L;
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
index 072b549..c6981a0 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/product/impl/CereShopProductServiceImpl.java
@@ -811,16 +811,16 @@ public class CereShopProductServiceImpl implements CereShopProductService {
list=cereShopProductDAO.getProducts(param);
}
- List classifyIdList = new ArrayList<>();
- classifyIdList.addAll(list.stream().map(CanvasProduct::getProductId).collect(Collectors.toList()));
- classifyIdList = classifyIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+ List productIdList = new ArrayList<>();
+ productIdList.addAll(list.stream().map(CanvasProduct::getProductId).collect(Collectors.toList()));
+ productIdList = productIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
- if(CollectionUtils.isNotEmpty(classifyIdList)){
- List cereProductClassifyLangInfoList = shopProductLangInfoService.list(Wrappers.lambdaQuery().in(CereShopProductLangInfo::getProductId,classifyIdList));
+ if(CollectionUtils.isNotEmpty(productIdList)){
+ List productLangInfoList = shopProductLangInfoService.list(Wrappers.lambdaQuery().in(CereShopProductLangInfo::getProductId,productIdList));
if(CollectionUtils.isNotEmpty(list)){
- for (CanvasProduct classify : list) {
- classify.initMap(cereProductClassifyLangInfoList);
- classify.initData(ContextUtil.getLanguage());
+ for (CanvasProduct product : list) {
+ product.initMap(productLangInfoList);
+ product.initData(ContextUtil.getLanguage());
}
}
}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopGroupLangInfoService.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopGroupLangInfoService.java
new file mode 100644
index 0000000..a86021f
--- /dev/null
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/CereShopGroupLangInfoService.java
@@ -0,0 +1,22 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.business.service.shop;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+
+/**
+ *
+ * 业务接口
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+public interface CereShopGroupLangInfoService extends IService {
+
+}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupLangInfoServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
new file mode 100644
index 0000000..361b05a
--- /dev/null
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupLangInfoServiceImpl.java
@@ -0,0 +1,28 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.business.service.shop.impl;
+
+import com.shop.cereshop.business.dao.shop.CereShopGroupLangInfoDAO;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
+import com.shop.cereshop.business.service.shop.CereShopGroupLangInfoService;
+
+import lombok.extern.slf4j.Slf4j;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ *
+ * 业务实现类
+ *
+ *
+ *
+ * @author
+ * @date 2024-03-06
+ */
+@Slf4j
+@Service
+public class CereShopGroupLangInfoServiceImpl extends ServiceImpl implements CereShopGroupLangInfoService {
+}
diff --git a/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupServiceImpl.java b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupServiceImpl.java
index 04746a8..0c612f7 100644
--- a/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupServiceImpl.java
+++ b/cereshop-business/src/main/java/com/shop/cereshop/business/service/shop/impl/CereShopGroupServiceImpl.java
@@ -5,9 +5,12 @@
*/
package com.shop.cereshop.business.service.shop.impl;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
+import com.shop.cereshop.business.dao.product.CereShopProductLangInfoDAO;
import com.shop.cereshop.business.dao.shop.CereShopGroupDAO;
+import com.shop.cereshop.business.dao.shop.CereShopGroupLangInfoDAO;
import com.shop.cereshop.business.page.group.Group;
import com.shop.cereshop.business.page.group.GroupDetail;
import com.shop.cereshop.business.page.group.GroupProduct;
@@ -20,16 +23,20 @@ import com.shop.cereshop.business.utils.ContextUtil;
import com.shop.cereshop.commons.constant.IntegerEnum;
import com.shop.cereshop.commons.domain.business.CerePlatformBusinessUser;
import com.shop.cereshop.commons.domain.common.Page;
+import com.shop.cereshop.commons.domain.product.CereShopProductLangInfo;
import com.shop.cereshop.commons.domain.shop.CereShopGroup;
+import com.shop.cereshop.commons.domain.shop.CereShopGroupLangInfo;
import com.shop.cereshop.commons.exception.CoBusinessException;
import com.shop.cereshop.commons.utils.EmptyUtils;
import com.shop.cereshop.commons.utils.TimeUtils;
+import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
+import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -44,9 +51,18 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
@Autowired
private CerePlatformLogService cerePlatformLogService;
+ @Autowired
+ private CereShopGroupLangInfoDAO cereShopGroupLangInfoDAO;
+
+ @Autowired
+ private CereShopProductLangInfoDAO cereShopProductLangInfoDAO;
+
+
@Override
public List getGroupSelect(ProductGetGroupParam param) throws CoBusinessException {
- return cereShopGroupDAO.getGroupSelect(ContextUtil.getProject(), param.getShopId());
+ List shopGroupList = cereShopGroupDAO.getGroupSelect(ContextUtil.getProject(), param.getShopId());
+ setShopGroupLangInfo(shopGroupList);
+ return shopGroupList;
}
@Override
@@ -62,7 +78,17 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
group.setCreateTime(time);
group.setUpdateTime(time);
group.setGroupDescribe(param.getGroupDescribe());
+ group.setLangInfoMap(param.getLangInfoMap());
+ group.initData();
cereShopGroupDAO.insert(group);
+
+ for (Map.Entry groupLangInfoEntry : param.getLangInfoMap().entrySet()) {
+ CereShopGroupLangInfo groupLangInfo = groupLangInfoEntry.getValue();
+ groupLangInfo.setShopGroupId(group.getShopGroupId());
+ groupLangInfo.setId(null);
+ cereShopGroupLangInfoDAO.insert(groupLangInfo);
+ }
+
if(!EmptyUtils.isEmpty(param.getIds())){
//手动添加商品
cereShopGroupDAO.addProduct(param.getIds(),group.getShopGroupId());
@@ -112,7 +138,17 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
group.setGroupImage(param.getGroupImage());
group.setGroupDescribe(param.getGroupDescribe());
group.setUpdateTime(time);
+ group.setLangInfoMap(param.getLangInfoMap());
+ group.initData();
cereShopGroupDAO.updateByPrimaryKeySelective(group);
+ cereShopGroupLangInfoDAO.delete(Wrappers.lambdaQuery().eq(CereShopGroupLangInfo::getShopGroupId,group.getShopGroupId()));
+ for (Map.Entry groupLangInfoEntry : param.getLangInfoMap().entrySet()) {
+ CereShopGroupLangInfo groupLangInfo = groupLangInfoEntry.getValue();
+ groupLangInfo.setShopGroupId(group.getShopGroupId());
+ groupLangInfo.setId(null);
+ cereShopGroupLangInfoDAO.insert(groupLangInfo);
+ }
+
if(!EmptyUtils.isEmpty(param.getIds())){
//清空之前添加的商品
cereShopGroupDAO.deleteProduct(group.getShopGroupId());
@@ -185,6 +221,7 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
//查询商品数据
list=cereShopGroupDAO.findProductByIds(ids);
}
+ setProductLangInfo(list);
return list;
}
@@ -205,7 +242,9 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
if(detail!=null){
//设置商品数据
detail.setProducts(cereShopGroupDAO.findProducts(shopGroupId));
+ setGroupProductLangInfo(detail.getProducts());
}
+ setGroupDetailLangInfo(detail);
return detail;
}
@@ -214,6 +253,7 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
param.setProject(ContextUtil.getProject());
PageHelper.startPage(param.getPage(),param.getPageSize());
List list = cereShopGroupDAO.getAll(param);
+ setGroupLangInfo(list);
PageInfo pageInfo=new PageInfo<>(list);
Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
return page;
@@ -223,6 +263,7 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
public Page getProducts(GroupProductParam param) throws CoBusinessException {
PageHelper.startPage(param.getPage(),param.getPageSize());
List list = cereShopGroupDAO.getProducts(param);
+ setGroupProductLangInfo(list);
PageInfo pageInfo=new PageInfo<>(list);
Page page=new Page(pageInfo.getList(),pageInfo.getTotal());
return page;
@@ -231,6 +272,93 @@ public class CereShopGroupServiceImpl implements CereShopGroupService {
@Override
public List selectAll() {
- return cereShopGroupDAO.selectAll(ContextUtil.getProject());
+ List groupList = cereShopGroupDAO.selectAll(ContextUtil.getProject());
+ setShopGroupLangInfo(groupList);
+ return groupList;
+ }
+
+ private void setGroupProductLangInfo(List groupProductList){
+ if(CollectionUtils.isEmpty(groupProductList)){
+ return;
+ }
+ List productIdList = new ArrayList<>();
+ productIdList.addAll(groupProductList.stream().map(GroupProduct::getProductId).collect(Collectors.toList()));
+ productIdList = productIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(productIdList)){
+ List productLangInfoList = cereShopProductLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopProductLangInfo::getProductId,productIdList));
+ if(CollectionUtils.isNotEmpty(groupProductList)){
+ for (GroupProduct product : groupProductList) {
+ product.initMap(productLangInfoList);
+ product.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setProductLangInfo(List productList){
+ if(CollectionUtils.isEmpty(productList)){
+ return;
+ }
+ List productIdList = new ArrayList<>();
+ productIdList.addAll(productList.stream().map(Product::getProductId).collect(Collectors.toList()));
+ productIdList = productIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(productIdList)){
+ List productLangInfoList = cereShopProductLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopProductLangInfo::getProductId,productIdList));
+ if(CollectionUtils.isNotEmpty(productList)){
+ for (Product product : productList) {
+ product.initMap(productLangInfoList);
+ product.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setShopGroupLangInfo(List shopGroupList){
+ if(CollectionUtils.isEmpty(shopGroupList)){
+ return;
+ }
+ List groupIdList = new ArrayList<>();
+ groupIdList.addAll(shopGroupList.stream().map(CereShopGroup::getShopGroupId).collect(Collectors.toList()));
+ groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(groupIdList)){
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList));
+ if(CollectionUtils.isNotEmpty(shopGroupList)){
+ for (CereShopGroup shopGroup : shopGroupList) {
+ shopGroup.initMap(groupLangInfoList);
+ shopGroup.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setGroupLangInfo(List groupList){
+ if(CollectionUtils.isEmpty(groupList)){
+ return;
+ }
+ List groupIdList = new ArrayList<>();
+ groupIdList.addAll(groupList.stream().map(Group::getShopGroupId).collect(Collectors.toList()));
+ groupIdList = groupIdList.stream().filter(item -> item != null && item > 0).distinct().collect(Collectors.toList());
+
+ if(CollectionUtils.isNotEmpty(groupIdList)){
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().in(CereShopGroupLangInfo::getShopGroupId,groupIdList));
+ if(CollectionUtils.isNotEmpty(groupList)){
+ for (Group group : groupList) {
+ group.initMap(groupLangInfoList);
+ group.initData(ContextUtil.getLanguage());
+ }
+ }
+ }
+ }
+
+ private void setGroupDetailLangInfo(GroupDetail groupDetail){
+ if(groupDetail == null){
+ return;
+ }
+ List groupLangInfoList = cereShopGroupLangInfoDAO.selectList(Wrappers.lambdaQuery().eq(CereShopGroupLangInfo::getShopGroupId,groupDetail.getShopGroupId()));
+ groupDetail.initMap(groupLangInfoList);
+ groupDetail.initData(ContextUtil.getLanguage());
}
}
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
index 3bc4c16..0b48eb7 100644
--- a/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
+++ b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupDAO.xml
@@ -163,7 +163,14 @@
ON a.product_id=c.product_id
LEFT JOIN (SELECT a.product_id,a.product_image from cere_product_image a,cere_shop_product b where a.product_id=b.product_id
GROUP BY a.product_id) d ON a.product_id=d.product_id
- where a.shop_id=#{shopId}
+ INNER JOIN cere_platform_shop cps ON cps.shop_id = a.shop_id
+ where 1=1
+
+ AND a.shop_id=#{shopId}
+
+
+ AND cps.business_id = #{businessId}
+
and (a.product_id like concat('%',#{search},'%') OR
a.product_name like concat('%',#{search},'%'))
diff --git a/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
new file mode 100644
index 0000000..59c7856
--- /dev/null
+++ b/cereshop-business/src/main/resources/mybatis/mapper/shop/CereShopGroupLangInfoDAO.xml
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id, shop_group_id, group_name, group_describe, language_type
+
+
+
diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroup.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroup.java
index 2cf3a62..bd61def 100644
--- a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroup.java
+++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroup.java
@@ -6,12 +6,21 @@
package com.shop.cereshop.commons.domain.shop;
import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
+import com.shop.cereshop.commons.utils.LangUtil;
+import com.shop.cereshop.commons.utils.StringUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Objects;
+import java.util.stream.Collectors;
/**
* cere_shop_group 店铺商品分组实体类
@@ -71,4 +80,53 @@ public class CereShopGroup implements Serializable {
private static final long serialVersionUID = 1L;
+ /**
+ * 名称Map
+ */
+ @ApiModelProperty(value = "名称Map")
+ @TableField(exist = false)
+ private Map langInfoMap;
+
+ public void initData(){
+ initData(LangUtil.ZH);
+ }
+ public void initData(String defaultLangType){
+ if(CollectionUtils.isNotEmpty(langInfoMap)) {
+ CereShopGroupLangInfo langInfo = langInfoMap.entrySet().stream().findFirst().get().getValue();
+ if (StringUtils.isNotEmpty(defaultLangType) && langInfoMap.containsKey(defaultLangType)) {
+ langInfo = langInfoMap.get(defaultLangType);
+ }else if (langInfoMap.containsKey(LangUtil.ZH)) {
+ langInfo = langInfoMap.get(LangUtil.ZH);
+ } else if (langInfoMap.containsKey(LangUtil.EN)) {
+ langInfo = langInfoMap.get(LangUtil.EN);
+ }
+ if (Objects.nonNull(langInfo)) {
+ setGroupName(langInfo.getGroupName());
+ setGroupDescribe(langInfo.getGroupDescribe());
+ }
+ }else if(StringUtils.isNotEmpty(groupName)){
+ langInfoMap = new HashMap<>();
+ CereShopGroupLangInfo groupLangInfo = new CereShopGroupLangInfo();
+ groupLangInfo.setGroupName(getGroupName());
+ groupLangInfo.setGroupDescribe(getGroupDescribe());
+ groupLangInfo.setLanguageType(LangUtil.ZH);
+ langInfoMap.put(LangUtil.ZH, groupLangInfo);
+ }
+ }
+
+ public void initMap(List groupLangInfoList){
+ if (CollectionUtils.isNotEmpty(groupLangInfoList)) {
+ List langInfoList =
+ groupLangInfoList.stream().filter(item -> Objects.equals(item.getShopGroupId(), getShopGroupId())).collect(Collectors.toList());
+
+ Map groupLangInfoMap = new HashMap<>();
+ if(CollectionUtils.isNotEmpty(langInfoList)){
+ for (CereShopGroupLangInfo langInfo : langInfoList) {
+ groupLangInfoMap.put(langInfo.getLanguageType(), langInfo);
+ }
+ }
+ setLangInfoMap(groupLangInfoMap);
+ }
+ }
+
}
diff --git a/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroupLangInfo.java b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroupLangInfo.java
new file mode 100644
index 0000000..3c14fe5
--- /dev/null
+++ b/cereshop-commons/src/main/java/com/shop/cereshop/commons/domain/shop/CereShopGroupLangInfo.java
@@ -0,0 +1,93 @@
+/*
+* Copyright (C) 2017-2021
+* All rights reserved, Designed By 深圳中科鑫智科技有限公司
+* Copyright authorization contact 18814114118
+*/
+package com.shop.cereshop.commons.domain.shop;
+
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableField;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import javax.validation.constraints.NotEmpty;
+import javax.validation.constraints.NotNull;
+import org.hibernate.validator.constraints.Length;
+import org.hibernate.validator.constraints.Range;
+import java.time.LocalDateTime;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+import lombok.NoArgsConstructor;
+import lombok.ToString;
+import lombok.experimental.Accessors;
+
+import static com.baomidou.mybatisplus.annotation.SqlCondition.LIKE;
+
+/**
+ *
+ * 实体类
+ *
+ *
+ *
+ * @since 2024-03-06
+ */
+@Data
+@NoArgsConstructor
+@ToString(callSuper = true)
+@TableName("cere_shop_group_lang_info")
+@ApiModel(value = "CereShopGroupLangInfo", description = "")
+@AllArgsConstructor
+public class CereShopGroupLangInfo {
+
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * 主键Id
+ */
+ @ApiModelProperty(value = "主键Id")
+ @NotNull(message = "主键Id不能为空")
+ @TableId(value = "id", type = IdType.AUTO)
+ private Long id;
+
+
+ /**
+ * 分组主键
+ */
+ @ApiModelProperty(value = "分组主键")
+ @TableField("shop_group_id")
+ private Long shopGroupId;
+
+
+ /**
+ * 分组名字
+ */
+ @ApiModelProperty(value = "分组名字")
+ @Length(max = 255, message = "分组名字长度不能超过255")
+ @TableField(value = "group_name", condition = LIKE)
+ private String groupName;
+
+
+ /**
+ * 分组描述
+ */
+ @ApiModelProperty(value = "分组描述")
+ @Length(max = 255, message = "分组描述长度不能超过255")
+ @TableField(value = "group_describe", condition = LIKE)
+ private String groupDescribe;
+
+
+ /**
+ * 语言类型
+ */
+ @ApiModelProperty(value = "语言类型")
+ @Length(max = 32, message = "语言类型长度不能超过32")
+ @TableField(value = "language_type", condition = LIKE)
+ private String languageType;
+
+
+
+
+}