Pārlūkot izejas kodu

标签功能修改

zhangchen 5 dienas atpakaļ
vecāks
revīzija
294ae9e95a

+ 0 - 2
alien-entity/src/main/java/shop/alien/entity/store/TagCategory.java

@@ -65,12 +65,10 @@ public class TagCategory extends Model<TagCategory> {
 
 
     @ApiModelProperty(value = "按钮名称1")
-    @JsonProperty("labelButtonOption_1")
     @TableField("label_button_option_one")
     private String labelButtonOptionOne;
 
     @ApiModelProperty(value = "按钮名称2")
-    @JsonProperty("labelButtonOption_2")
     @TableField("label_button_option_two")
     private String labelButtonOptionTwo;
 

+ 31 - 26
alien-entity/src/main/java/shop/alien/entity/store/TagStoreRelation.java

@@ -15,7 +15,7 @@ import java.util.Date;
  */
 @Data
 @JsonInclude
-@TableName("tag_category")
+@TableName("tag_store_relation")
 @ApiModel(value = "tag_store_relation", description = "tag_store_relation")
 public class TagStoreRelation extends Model<TagStoreRelation> {
     private static final long serialVersionUID = 1L;
@@ -27,103 +27,103 @@ public class TagStoreRelation extends Model<TagStoreRelation> {
     private Integer storeId;
 
     @ApiModelProperty(value = "标签信息1")
-    @TableField("tag_column1")
+    @TableField("tag_column_a")
     private String  tagColumn1;
 
     @ApiModelProperty(value = "标签信息2")
-    @TableField("tag_column2")
+    @TableField("tag_column_b")
     private String tagColumn2;
 
     @ApiModelProperty(value = "标签信息3")
-    @TableField("tag_column3")
+    @TableField("tag_column_c")
     private String  tagColumn3;
 
     @ApiModelProperty(value = "标签信息4")
-    @TableField("tag_column4")
+    @TableField("tag_column_d")
     private String tagColumn4;
 
     @ApiModelProperty(value = "标签信息5")
-    @TableField("tag_column5")
+    @TableField("tag_column_e")
     private String  tagColumn5;
 
     @ApiModelProperty(value = "标签信息6")
-    @TableField("tag_column6")
+    @TableField("tag_column_f")
     private String tagColumn6;
 
     @ApiModelProperty(value = "标签信息7")
-    @TableField("tag_column7")
+    @TableField("tag_column_g")
     private String  tagColumn7;
 
     @ApiModelProperty(value = "标签信息8")
-    @TableField("tag_column8")
+    @TableField("tag_column_h")
     private String tagColumn8;
 
     @ApiModelProperty(value = "标签信息9")
-    @TableField("tag_column9")
+    @TableField("tag_column_i")
     private String  tagColumn9;
 
     @ApiModelProperty(value = "标签信息10")
-    @TableField("tag_column10")
+    @TableField("tag_column_j")
     private String tagColumn10;
 
     @ApiModelProperty(value = "标签信息11")
-    @TableField("tag_column11")
+    @TableField("tag_column_k")
     private String  tagColumn11;
 
     @ApiModelProperty(value = "标签信息12")
-    @TableField("tag_column12")
+    @TableField("tag_column_l")
     private String tagColumn12;
 
     @ApiModelProperty(value = "标签信息13")
-    @TableField("tag_column13")
+    @TableField("tag_column_m")
     private String  tagColumn13;
 
     @ApiModelProperty(value = "标签信息14")
-    @TableField("tag_column14")
+    @TableField("tag_column_n")
     private String tagColumn14;
 
     @ApiModelProperty(value = "标签信息15")
-    @TableField("tag_column15")
+    @TableField("tag_column_o")
     private String  tagColumn15;
 
     @ApiModelProperty(value = "标签信息16")
-    @TableField("tag_column16")
+    @TableField("tag_column_p")
     private String tagColumn16;
 
     @ApiModelProperty(value = "标签信息17")
-    @TableField("tag_column17")
+    @TableField("tag_column_q")
     private String  tagColumn17;
 
     @ApiModelProperty(value = "标签信息18")
-    @TableField("tag_column18")
+    @TableField("tag_column_r")
     private String tagColumn18;
 
     @ApiModelProperty(value = "标签信息19")
-    @TableField("tag_column19")
+    @TableField("tag_column_s")
     private String  tagColumn19;
 
     @ApiModelProperty(value = "标签信息20")
-    @TableField("tag_column20")
+    @TableField("tag_column_t")
     private String tagColumn20;
 
     @ApiModelProperty(value = "标签信息21")
-    @TableField("tag_column21")
+    @TableField("tag_column_u")
     private String tagColumn21;
 
     @ApiModelProperty(value = "标签信息22")
-    @TableField("tag_column22")
+    @TableField("tag_column_v")
     private String tagColumn22;
 
     @ApiModelProperty(value = "标签信息23")
-    @TableField("tag_column23")
+    @TableField("tag_column_w")
     private String tagColumn23;
 
     @ApiModelProperty(value = "标签信息24")
-    @TableField("tag_column24")
+    @TableField("tag_column_x")
     private String tagColumn24;
 
     @ApiModelProperty(value = "标签信息25")
-    @TableField("tag_column25")
+    @TableField("tag_column_y")
     private String tagColumn25;
 
     @ApiModelProperty(value = "创建时间")
@@ -143,4 +143,9 @@ public class TagStoreRelation extends Model<TagStoreRelation> {
     @ApiModelProperty(value = "修改人ID")
     @TableField("updated_user_id")
     private Integer updatedUserId;
+
+    @ApiModelProperty(value = "删除标记, 0:未删除, 1:已删除")
+    @TableField("delete_flag")
+    @TableLogic
+    private Integer deleteFlag;
 }

+ 15 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/LabelButtonOptionVo.java

@@ -0,0 +1,15 @@
+package shop.alien.entity.store.vo;
+
+import com.fasterxml.jackson.annotation.JsonInclude;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+
+@Data
+@JsonInclude
+public class LabelButtonOptionVo {
+    @ApiModelProperty(value = "名称")
+    private String name;
+
+    @ApiModelProperty(value = "值")
+    private String value;
+}

+ 15 - 0
alien-entity/src/main/java/shop/alien/entity/store/vo/TagCategoryVo.java

@@ -1,6 +1,8 @@
 package shop.alien.entity.store.vo;
 
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.fasterxml.jackson.annotation.JsonInclude;
+import com.fasterxml.jackson.annotation.JsonProperty;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
@@ -8,6 +10,8 @@ import lombok.EqualsAndHashCode;
 import lombok.NoArgsConstructor;
 import shop.alien.entity.store.TagCategory;
 
+import java.util.List;
+
 @Data
 @EqualsAndHashCode(callSuper = false)
 @JsonInclude
@@ -20,4 +24,15 @@ public class TagCategoryVo extends TagCategory {
 
     @ApiModelProperty(value = "标签类型")
     private String businessSectionName;
+
+    @ApiModelProperty(value = "标签类型名称")
+    private String labelName;
+
+    @ApiModelProperty(value = "按钮名称1列表")
+    @JsonProperty("labelButtonOption_1")
+    private List<LabelButtonOptionVo> labelButtonOption1;
+
+    @ApiModelProperty(value = "按钮名称2列表")
+    @JsonProperty("labelButtonOption_2")
+    private List<LabelButtonOptionVo> labelButtonOption2;
 }

+ 1 - 1
alien-entity/src/main/java/shop/alien/mapper/TagCategoryMapper.java

@@ -21,6 +21,6 @@ public interface TagCategoryMapper extends BaseMapper<TagCategory> {
      * @return List<StoreMenuVo>
      */
     //"图片类型, 0:其他, 1:入口图, 2:相册, 3:菜品, 4:环境, 5:价目表, 6:推荐菜, 7:菜单, 8:用户评论, 9:商家申诉, 10:商家头像, 11:店铺轮播图"
-    @Select("select tc.*, tbr.business_section,tbr.business_section_name from tag_business_relation tbr left join tag_category tc on tc.id = tbr.tag_id and tc.delete_flag =0  where tbr.business_section  = #{businessSection} and tbr.delete_flag = 0")
+    @Select("select tc.*, tbr.business_section,tbr.business_section_name, case when tc.label_type = 'infrastructure' then '基础设施' when tc.label_type = 'storeIntroduction' then '门店介绍' else '基础设施' end as label_name from tag_business_relation tbr left join tag_category tc on tc.id = tbr.tag_id and tc.delete_flag =0  where tbr.business_section  = #{businessSection} and tbr.delete_flag = 0 order by tc.tag_sort")
     List<TagCategoryVo> getBusinessRelationTagList(@Param("businessSection") Integer businessSection);
 }

+ 1 - 1
alien-store/src/main/java/shop/alien/store/controller/TagCategoryController.java

@@ -135,7 +135,7 @@ public class TagCategoryController {
     @ApiOperation("获取标签经营类型关系")
     @ApiOperationSupport(order = 9)
     @GetMapping("/getTagStoreRelationByStoreId")
-    public R<TagStoreRelation> getTagStoreRelationByStoreId(int storeId) {
+    public R<TagStoreRelation> getTagStoreRelationByStoreId( @RequestParam(required = true) Integer storeId) {
         log.info("TagCategoryController.getTagStoreRelationByStoreId={}", storeId);
         TagStoreRelation tagStoreRelation = tagStoreRelationService.getTagStoreRelationByStoreId(storeId);
         return R.data(tagStoreRelation);

+ 2 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreInfoServiceImpl.java

@@ -36,6 +36,7 @@ import shop.alien.store.config.GaoDeMapUtil;
 import shop.alien.store.service.NearMeService;
 import shop.alien.store.service.StoreInfoService;
 import shop.alien.store.util.FileUploadUtil;
+import shop.alien.store.util.GroupConstant;
 import shop.alien.util.common.DistanceUtil;
 
 import java.io.IOException;
@@ -1728,7 +1729,7 @@ public class StoreInfoServiceImpl extends ServiceImpl<StoreInfoMapper, StoreInfo
                 return result;
             }
             int imgType = storeImgInfoVo.getImgType();
-            if (imgType == 21 || imgType == 22) {
+            if (imgType == GroupConstant.IMG_TYPE_SINGLE_MODE || imgType == GroupConstant.IMG_TYPE_MULTI_MODE) {
                 LambdaUpdateWrapper<StoreInfo> wrapper = new LambdaUpdateWrapper<>();
                 wrapper.eq(StoreInfo::getId, storeImgInfoVo.getStoreId());
                 wrapper.set(StoreInfo::getImgMode, storeImgInfoVo.getImgMode());

+ 36 - 1
alien-store/src/main/java/shop/alien/store/service/impl/StoreTagServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -17,6 +18,7 @@ import org.springframework.transaction.annotation.Transactional;
 import shop.alien.entity.store.LifeDiscountCoupon;
 import shop.alien.entity.store.StoreClockIn;
 import shop.alien.entity.store.TagCategory;
+import shop.alien.entity.store.vo.LabelButtonOptionVo;
 import shop.alien.entity.store.vo.LifeDiscountCouponStoreFriendVo;
 import shop.alien.entity.store.vo.LifeDiscountCouponVo;
 import shop.alien.entity.store.vo.TagCategoryVo;
@@ -141,11 +143,44 @@ public class StoreTagServiceImpl extends ServiceImpl<TagCategoryMapper, TagCateg
     @Override
     public List<TagCategoryVo> getBusinessRelationTagList(Integer businessSection) {
         if(businessSection!=null){
-            return tagCategoryMapper.getBusinessRelationTagList(businessSection);
+            List<TagCategoryVo> tagCategoryVoList = tagCategoryMapper.getBusinessRelationTagList(businessSection);
+            return getCategories(tagCategoryVoList);
         }
         return Collections.emptyList();
     }
 
+
+    private static List<TagCategoryVo> getCategories(List<TagCategoryVo> tagCategoryVoList) {
+        tagCategoryVoList.forEach(tagCategoryVo -> {
+            String labelButtonOptionOne = tagCategoryVo.getLabelButtonOptionOne();
+            String labelButtonOptionTwo = tagCategoryVo.getLabelButtonOptionTwo();
+            if(StringUtils.isNotBlank(labelButtonOptionOne)){
+                try {
+                    ObjectMapper objectMapper = new ObjectMapper();
+                    List<LabelButtonOptionVo> tagValueVoList1 = objectMapper.readValue(labelButtonOptionOne,
+                            new TypeReference<List<LabelButtonOptionVo>>() {});
+                    tagCategoryVo.setLabelButtonOption1(tagValueVoList1);
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+            if(StringUtils.isNotBlank(labelButtonOptionTwo)){
+                try {
+                    ObjectMapper objectMapper = new ObjectMapper();
+                    List<LabelButtonOptionVo> tagValueVoList2 = objectMapper.readValue(labelButtonOptionTwo,
+                            new TypeReference<List<LabelButtonOptionVo>>() {});
+                    tagCategoryVo.setLabelButtonOption2(tagValueVoList2);
+                } catch (JsonProcessingException e) {
+                    throw new RuntimeException(e);
+                }
+            }
+        });
+        return tagCategoryVoList;
+    }
+
+
+
+
     /**
      * 构造树形结构方法
      *

+ 1 - 0
alien-store/src/main/java/shop/alien/store/service/impl/TagStoreRelationServiceImpl.java

@@ -37,6 +37,7 @@ public class TagStoreRelationServiceImpl implements TagStoreRelationService {
         TagStoreRelation tagStoreRelation = new TagStoreRelation();
         LambdaQueryWrapper<TagStoreRelation> wrapper = new LambdaQueryWrapper<>();
         wrapper.eq(TagStoreRelation::getStoreId, storeId);
+        wrapper.eq(TagStoreRelation::getDeleteFlag,0);
         List<TagStoreRelation> tagStoreRelationList = tagStoreRelationMapper.selectList(wrapper);
         if (CollectionUtils.isNotEmpty(tagStoreRelationList)) {
             tagStoreRelation = tagStoreRelationList.get(0);

+ 3 - 0
alien-store/src/main/java/shop/alien/store/util/GroupConstant.java

@@ -35,4 +35,7 @@ public class GroupConstant {
     public static final String LABEL_TYPE_MENU = "1";
     public static final String LABEL_TYPE_SHOP = "2";
 
+
+    public static final Integer IMG_TYPE_SINGLE_MODE = 20;
+    public static final Integer IMG_TYPE_MULTI_MODE = 21;
 }