From 0b80f415c2ab98d545f246d2c8adb4c40c0f55d6 Mon Sep 17 00:00:00 2001
From: Administrator <15274802129@163.com>
Date: Mon, 21 Jul 2025 17:18:00 +0800
Subject: [PATCH] feat(mall): 添加我的社区收藏功能

---
 src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java |  206 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 203 insertions(+), 3 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
index e5ca549..47699fd 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/clothes/ViewClothesTypeController.java
@@ -2,17 +2,24 @@
 
 import cc.mrbird.febs.common.controller.BaseController;
 import cc.mrbird.febs.common.entity.FebsConstant;
+import cc.mrbird.febs.common.entity.FebsResponse;
+import cc.mrbird.febs.common.enumerates.SocialPatternLocationTypeEnum;
+import cc.mrbird.febs.common.utils.AppContants;
 import cc.mrbird.febs.common.utils.FebsUtil;
+import cc.mrbird.febs.common.utils.RedisUtils;
+import cc.mrbird.febs.mall.dto.clothes.AdminClothesPrintOrderDto;
 import cc.mrbird.febs.mall.entity.*;
 import cc.mrbird.febs.mall.mapper.*;
 import cc.mrbird.febs.mall.service.ClothesTypeService;
 import cc.mrbird.febs.mall.service.IAdminBannerService;
 import cc.mrbird.febs.mall.vo.AdminLabelSetVo;
 import cc.mrbird.febs.mall.vo.AdminMallOrderVo;
-import cc.mrbird.febs.mall.vo.clothes.AdminClothesDeliverGoodsVo;
-import cc.mrbird.febs.mall.vo.clothes.AdminClothesTypeInfoVo;
+import cc.mrbird.febs.mall.vo.clothes.*;
 import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.util.ObjectUtil;
+import cn.hutool.core.util.StrUtil;
+import cn.hutool.json.JSON;
+import cn.hutool.json.JSONUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
@@ -46,7 +53,177 @@
     private final ClothesTypePatternMapper clothesTypePatternMapper;
     private final ClothesTypeLocationMapper clothesTypeLocationMapper;
     private final ClothesOrderMapper clothesOrderMapper;
+    private final ClothesSocialCategoryMapper clothesSocialCategoryMapper;
+    private final ClothesSocialMapper clothesSocialMapper;
+    private final ClothesSocialMuseMapper clothesSocialMuseMapper;
+    private final ClothesSocialFileMapper clothesSocialFileMapper;
     private final MallExpressInfoMapper mallExpressInfoMapper;
+    private final ClothesPatternRemarkMapper clothesPatternRemarkMapper;
+    private final ClothesLocationRemarkMapper clothesLocationRemarkMapper;
+    private final RedisUtils redisUtils;
+
+    /**
+     * 社区分类列表
+     */
+    @GetMapping("groupList")
+    @RequiresPermissions("groupList:view")
+    public String groupList() {
+
+        return FebsUtil.view("modules/clothesType/groupList");
+    }
+
+    /**
+     * 社区分类新增
+     * @return
+     */
+    @GetMapping(value = "/groupAdd")
+    @RequiresPermissions("groupAdd:add")
+    public String groupAdd() {
+
+        return FebsUtil.view("modules/clothesType/groupAdd");
+    }
+
+    /**
+     * 社区分类编辑
+     * @param id
+     * @param model
+     * @return
+     */
+    @GetMapping("groupInfo/{id}")
+    @RequiresPermissions("groupInfo:view")
+    public String groupInfo(@PathVariable long id, Model model) {
+
+        ClothesSocialCategory clothesSocialCategory = clothesSocialCategoryMapper.selectById(id);
+        model.addAttribute("voteActivityGroup", clothesSocialCategory);
+        return FebsUtil.view("modules/clothesType/groupInfo");
+    }
+
+    /**
+     * 社区列表
+     */
+    @GetMapping("socialList")
+    @RequiresPermissions("socialList:view")
+    public String socialList() {
+
+        return FebsUtil.view("modules/clothesType/socialList");
+    }
+
+
+
+    /**
+     * 社区列表-查看评论
+     * @return
+     */
+    @GetMapping("/socialComment/{id}")
+    @RequiresPermissions("socialComment:view")
+    public String socialComment(@PathVariable Long id, Model model) {
+
+        String existToken = redisUtils.getString(AppContants.SOCIAL_COMMENT);
+        if (StrUtil.isNotBlank(existToken)) {
+            Object o = redisUtils.get(existToken);
+            if (ObjectUtil.isNotEmpty(o)) {
+                redisUtils.del(existToken);
+            }
+        }
+        redisUtils.set(AppContants.SOCIAL_COMMENT, id, -1);
+        return FebsUtil.view("modules/clothesType/socialComment");
+    }
+
+    /**
+     * 社区-新增
+     */
+    @GetMapping("socialAdd")
+    @RequiresPermissions("socialAdd:add")
+    public String socialAdd() {
+        return FebsUtil.view("modules/clothesType/socialAdd");
+    }
+
+
+
+    /**
+     * 社区-修改
+     */
+    @GetMapping("socialUpdate/{id}")
+    @RequiresPermissions("socialUpdate:update")
+    public String socialUpdate(@PathVariable long id, Model model) {
+        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
+        List<ClothesSocialFile> clothesSocialFiles = clothesSocialFileMapper.selectList(
+                Wrappers.lambdaQuery(ClothesSocialFile.class)
+                        .eq(ClothesSocialFile::getSocialId, id)
+        );
+        if(CollUtil.isNotEmpty(clothesSocialFiles)){
+            clothesSocial.setImages(clothesSocialFiles.stream().map(ClothesSocialFile::getFileUrl).collect(Collectors.toList()));
+        }
+        ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne(
+                Wrappers.lambdaQuery(ClothesSocialMuse.class)
+                        .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId())
+                .last("LIMIT 1")
+        );
+        if(ObjectUtil.isNotNull(clothesSocialMuse)){
+            clothesSocial.setTypeId(clothesSocialMuse.getTypeId());
+        }
+        model.addAttribute("activity", clothesSocial);
+
+        return FebsUtil.view("modules/clothesType/socialUpdate");
+    }
+
+    /**
+     * 社区-灵感
+     */
+    @GetMapping("socialMuseUpdate/{id}")
+    @RequiresPermissions("socialMuseUpdate:update")
+    public String socialMuseUpdate(@PathVariable long id, Model model) {
+        ClothesSocial clothesSocial = clothesSocialMapper.selectById(id);
+
+        ClothesSocialMuse clothesSocialMuse = clothesSocialMuseMapper.selectOne(
+                Wrappers.lambdaQuery(ClothesSocialMuse.class)
+                        .eq(ClothesSocialMuse::getSocialId, clothesSocial.getId())
+                .last("LIMIT 1")
+        );
+
+        List<AdminClothesPatternRemarkVo> patternData = new ArrayList<>();
+        List<ClothesPatternRemark> patternRemarks = clothesPatternRemarkMapper.selectList(
+                Wrappers.lambdaQuery(ClothesPatternRemark.class)
+                        .eq(ClothesPatternRemark::getSourceId, clothesSocialMuse.getId())
+                        .eq(ClothesPatternRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue())
+        );
+        if(CollUtil.isNotEmpty(patternRemarks)){
+            for (ClothesPatternRemark entity : patternRemarks){
+                AdminClothesPatternRemarkVo vo = new AdminClothesPatternRemarkVo();
+                vo.setPatternId(entity.getPatternId());
+                ClothesPattern clothesPattern = clothesPatternMapper.selectById(entity.getPatternId());
+                vo.setPatternName(clothesPattern.getName());
+                JSON parse = JSONUtil.parse(entity.getRemark());
+                vo.setPatternText(parse.getByPath("text", String.class));
+                vo.setSkuPatternImage(parse.getByPath("file", String.class));
+                patternData.add(vo);
+            }
+            clothesSocialMuse.setPatternData(patternData);
+        }
+        List<AdminClothesLocationRemarkVo> locationData = new ArrayList<>();
+        List<ClothesLocationRemark> locationRemarks = clothesLocationRemarkMapper.selectList(
+                Wrappers.lambdaQuery(ClothesLocationRemark.class)
+                        .eq(ClothesLocationRemark::getSourceId, clothesSocialMuse.getId())
+                        .eq(ClothesLocationRemark::getType, SocialPatternLocationTypeEnum.MUSE.getValue())
+        );
+        if(CollUtil.isNotEmpty(locationRemarks)){
+            for (ClothesLocationRemark entity : locationRemarks){
+                AdminClothesLocationRemarkVo vo = new AdminClothesLocationRemarkVo();
+                vo.setLocationId(entity.getLocationId());
+                ClothesLocation clothesLocation = clothesLocationMapper.selectById(entity.getLocationId());
+                vo.setLocationName(clothesLocation.getName());
+                JSON parse = JSONUtil.parse(entity.getRemark());
+                vo.setLocationText(parse.getByPath("text", String.class));
+                vo.setSkuLocationImage(parse.getByPath("file", String.class));
+                locationData.add(vo);
+            }
+            clothesSocialMuse.setLocationData(locationData);
+        }
+
+        model.addAttribute("socialMuse", clothesSocialMuse);
+
+        return FebsUtil.view("modules/clothesType/socialMuseUpdate");
+    }
 
     /**
      * 订单列表
@@ -58,6 +235,25 @@
         return FebsUtil.view("modules/clothesType/orderList");
     }
 
+
+
+
+
+    /**
+     * 社区列表-查看评论
+     * @return
+     */
+    @GetMapping("/orderPrint/{id}")
+    @RequiresPermissions("orderPrint:view")
+    public String orderPrint(@PathVariable Long id, Model model) {
+
+        AdminClothesPrintOrderDto dto = new AdminClothesPrintOrderDto();
+        dto.setId(id);
+        AdminClothesPrintOrderVo adminClothesPrintOrderVo = clothesTypeService.printOrderEvent(dto);
+        model.addAttribute("orderPrint", adminClothesPrintOrderVo);
+        return FebsUtil.view("modules/clothesType/orderPrint");
+    }
+
     /**
      * 订单-发货
      * @param id
@@ -66,9 +262,13 @@
      */
     @GetMapping("deliverGoods/{id}")
     @RequiresPermissions("deliverGoods:update")
-    public String deliverGoods(@PathVariable long id, Model model) {
+    public String deliverGoods(@PathVariable Long id, Model model) {
         AdminClothesDeliverGoodsVo data = new AdminClothesDeliverGoodsVo();
         ClothesOrder clothesOrder = clothesOrderMapper.selectById(id);
+        data.setId(clothesOrder.getId());
+        data.setName(clothesOrder.getName());
+        data.setPhone(clothesOrder.getPhone());
+        data.setAddress(clothesOrder.getAddress());
         data.setExpressCom("极兔快递");
         MallExpressInfo mallExpressInfo = mallExpressInfoMapper.selectOne(
                 Wrappers.lambdaQuery(MallExpressInfo.class)

--
Gitblit v1.9.1