瀏覽代碼

Merge branch 'master' of ssh://192.168.8.213:10022/miaxis/zzjs

Althars123 4 年之前
父節點
當前提交
3b001b566d
共有 16 個文件被更改,包括 549 次插入431 次删除
  1. 0 45
      zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletCarouselChartInfoController.java
  2. 40 0
      zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletHomePageDataInfoController.java
  3. 0 99
      zzjs-admin/src/main/java/com/miaxis/pc/controller/carousel/CarouselChartInfoController.java
  4. 99 0
      zzjs-admin/src/main/java/com/miaxis/pc/controller/carousel/HomePageDataInfoController.java
  5. 2 2
      zzjs-common/src/main/java/com/miaxis/common/constant/Constants.java
  6. 35 0
      zzjs-common/src/main/java/com/miaxis/common/enums/HomePageDataType.java
  7. 12 6
      zzjs-service/src/main/java/com/miaxis/carousel/domain/HomePageDataInfo.java
  8. 0 31
      zzjs-service/src/main/java/com/miaxis/carousel/mapper/CarouselChartInfoMapper.java
  9. 31 0
      zzjs-service/src/main/java/com/miaxis/carousel/mapper/HomePageDataInfoMapper.java
  10. 0 60
      zzjs-service/src/main/java/com/miaxis/carousel/service/ICarouselChartInfoService.java
  11. 60 0
      zzjs-service/src/main/java/com/miaxis/carousel/service/IHomePageDataInfoService.java
  12. 0 169
      zzjs-service/src/main/java/com/miaxis/carousel/service/impl/CarouselChartInfoServiceImpl.java
  13. 242 0
      zzjs-service/src/main/java/com/miaxis/carousel/service/impl/HomePageDataInfoServiceImpl.java
  14. 9 10
      zzjs-service/src/main/java/com/miaxis/carousel/vo/HomePageDataInfoVo.java
  15. 15 8
      zzjs-service/src/main/resources/mapper/carousel/HomePageDataInfoMapper.xml
  16. 4 1
      zzjs-service/src/main/resources/mapper/customer/CustomerInfoMapper.xml

+ 0 - 45
zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletCarouselChartInfoController.java

@@ -1,45 +0,0 @@
-package com.miaxis.app.controller.carousel;
-
-import com.miaxis.carousel.service.ICarouselChartInfoService;
-import com.miaxis.carousel.vo.CarouselChartInfoVo;
-import com.miaxis.common.annotation.Log;
-import com.miaxis.common.constant.Constants;
-import com.miaxis.common.core.controller.BaseController;
-import com.miaxis.common.core.page.ResponsePageInfo;
-import com.miaxis.common.enums.BusinessTypeEnum;
-import io.swagger.annotations.Api;
-import io.swagger.annotations.ApiOperation;
-import lombok.RequiredArgsConstructor;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
-
-import java.util.List;
-
-/**
- * 【小程序-轮播图】Controller
- * @author wwl
- * @version 1.0
- * @date 2021/4/16 16:13
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping(Constants.STUDENT_PREFIX+"/applet/carousel")
-@Api(tags = {"【小程序-轮播图】"})
-public class AppletCarouselChartInfoController extends BaseController {
-
-    private final ICarouselChartInfoService carouselChartInfoService;
-
-    /**
-     * 查询轮播图列表
-     */
-    @GetMapping(value = "/getCarouselChartList")
-    @ApiOperation("查询轮播图列表")
-    public ResponsePageInfo<CarouselChartInfoVo> getCarouselChartList() {
-        List<CarouselChartInfoVo> list = carouselChartInfoService.getCarouselChartList();
-        return toResponsePageInfo(list);
-    }
-
-
-
-}

+ 40 - 0
zzjs-admin/src/main/java/com/miaxis/app/controller/carousel/AppletHomePageDataInfoController.java

@@ -0,0 +1,40 @@
+package com.miaxis.app.controller.carousel;
+
+import com.miaxis.carousel.service.IHomePageDataInfoService;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import io.swagger.annotations.Api;
+import io.swagger.annotations.ApiOperation;
+import lombok.RequiredArgsConstructor;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 【小程序-首页数据】Controller
+ * @author wwl
+ * @version 1.0
+ * @date 2021/4/16 16:13
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping(Constants.STUDENT_PREFIX+"/applet/homePage")
+@Api(tags = {"【小程序-首页数据】"})
+public class AppletHomePageDataInfoController extends BaseController {
+
+    private final IHomePageDataInfoService homePageDataInfoService;
+
+    /**
+     * 查询首页数据列表
+     */
+    @GetMapping(value = "/getHomePageDataList")
+    @ApiOperation("查询首页数据列表")
+    public Response getHomePageDataList() {
+
+        return homePageDataInfoService.getHomePageDataList();
+    }
+
+
+
+}

+ 0 - 99
zzjs-admin/src/main/java/com/miaxis/pc/controller/carousel/CarouselChartInfoController.java

@@ -1,99 +0,0 @@
-package com.miaxis.pc.controller.carousel;
-
-import com.miaxis.carousel.domain.CarouselChartInfo;
-import com.miaxis.carousel.service.ICarouselChartInfoService;
-import com.miaxis.carousel.vo.CarouselChartInfoVo;
-import com.miaxis.common.annotation.Log;
-import com.miaxis.common.core.controller.BaseController;
-import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.core.page.ResponsePageInfo;
-import com.miaxis.common.enums.BusinessTypeEnum;
-import io.swagger.annotations.*;
-import lombok.RequiredArgsConstructor;
-import org.springframework.security.access.prepost.PreAuthorize;
-import org.springframework.web.bind.annotation.*;
-
-import java.util.List;
-
-/**
- * 【轮播图】Controller
- *
- * @author miaxis
- * @date 2021-03-11
- */
-@RestController
-@RequiredArgsConstructor
-@RequestMapping("/pc/carousel")
-@Api(tags={"【pc-轮播图】"})
-public class CarouselChartInfoController extends BaseController{
-
-    private final ICarouselChartInfoService carouselChartInfoService;
-
-    /**
-     * 查询轮播图列表
-     */
-    @PreAuthorize("@ss.hasPermi('carousel:carousel:list')")
-    @GetMapping("/list")
-    @ApiOperation("查询轮播图列表")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
-            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
-    })
-    public ResponsePageInfo<CarouselChartInfoVo> list(@ModelAttribute CarouselChartInfo carouselChartInfo){
-        startPage();
-        List<CarouselChartInfoVo> list = carouselChartInfoService.selectCarouselChartInfoList(carouselChartInfo);
-        return toResponsePageInfo(list);
-    }
-
-
-    /**
-     * 新增轮播图
-     */
-    @PreAuthorize("@ss.hasPermi('carousel:carousel:add')")
-    @Log(title = "轮播图", businessType = BusinessTypeEnum.INSERT)
-    @PostMapping
-    @ApiOperation("新增轮播图")
-    public Response add(@RequestBody CarouselChartInfo carouselChartInfo){
-
-        return carouselChartInfoService.saveCarouselChartInfo(carouselChartInfo);
-    }
-
-    /**
-     * 获取轮播图详细信息
-     */
-    @PreAuthorize("@ss.hasPermi('carousel:carousel:query')")
-    @GetMapping(value = "/{id}")
-    @ApiOperation("获取轮播图详细信息")
-    public Response<CarouselChartInfoVo> getCarouselChartInfo(
-            @ApiParam(name = "id", value = "轮播图id", required = true)
-            @PathVariable("id") Long id
-    ) {
-        return carouselChartInfoService.getCarouselChartById(id);
-    }
-
-    /**
-     * 修改轮播图
-     */
-    @PreAuthorize("@ss.hasPermi('carousel:carousel:edit')")
-    @Log(title = "轮播图", businessType = BusinessTypeEnum.UPDATE)
-    @PutMapping
-    @ApiOperation("修改轮播图")
-    public Response<Integer> edit(@RequestBody CarouselChartInfo carouselChartInfo) {
-        return carouselChartInfoService.updateCarouselChartInfoById(carouselChartInfo);
-    }
-
-
-    /**
-     * 删除轮播图(伪删除)
-     */
-    @PreAuthorize("@ss.hasPermi('carousel:carousel:remove')")
-    @Log(title = "轮播图", businessType = BusinessTypeEnum.UPDATE)
-	@PutMapping("/{ids}")
-    @ApiOperation("删除轮播图")
-    public  Response<Integer> remove(
-            @ApiParam(name = "ids", value = "轮播图ids参数", required = true)
-            @PathVariable Long[] ids
-    ){
-        return carouselChartInfoService.removeCarouselByIds(ids);
-    }
-}

+ 99 - 0
zzjs-admin/src/main/java/com/miaxis/pc/controller/carousel/HomePageDataInfoController.java

@@ -0,0 +1,99 @@
+package com.miaxis.pc.controller.carousel;
+
+import com.miaxis.carousel.domain.HomePageDataInfo;
+import com.miaxis.carousel.service.IHomePageDataInfoService;
+import com.miaxis.carousel.vo.HomePageDataInfoVo;
+import com.miaxis.common.annotation.Log;
+import com.miaxis.common.core.controller.BaseController;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.core.page.ResponsePageInfo;
+import com.miaxis.common.enums.BusinessTypeEnum;
+import io.swagger.annotations.*;
+import lombok.RequiredArgsConstructor;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+/**
+ * 【首页数据】Controller
+ *
+ * @author miaxis
+ * @date 2021-03-11
+ */
+@RestController
+@RequiredArgsConstructor
+@RequestMapping("/pc/homePage")
+@Api(tags={"【pc-首页数据】"})
+public class HomePageDataInfoController extends BaseController{
+
+    private final IHomePageDataInfoService homePageDataInfoService;
+
+    /**
+     * 查询首页数据列表
+     */
+    @PreAuthorize("@ss.hasPermi('carousel:carousel:list')")
+    @GetMapping("/list")
+    @ApiOperation("查询首页数据列表")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "pageNum",value = "当前页码" ,dataType = "int", paramType = "query", required = false),
+            @ApiImplicitParam(name = "pageSize",value = "每页数据量" , dataType = "int", paramType = "query", required = false),
+    })
+    public ResponsePageInfo<HomePageDataInfoVo> list(@ModelAttribute HomePageDataInfo homePageDataInfo){
+        startPage();
+        List<HomePageDataInfoVo> list = homePageDataInfoService.selectHomePageDataInfoList(homePageDataInfo);
+        return toResponsePageInfo(list);
+    }
+
+
+    /**
+     * 新增首页数据
+     */
+    @PreAuthorize("@ss.hasPermi('carousel:carousel:add')")
+    @Log(title = "首页数据", businessType = BusinessTypeEnum.INSERT)
+    @PostMapping
+    @ApiOperation("新增首页数据")
+    public Response add(@RequestBody HomePageDataInfo homePageDataInfo){
+
+        return homePageDataInfoService.saveHomePageDataInfo(homePageDataInfo);
+    }
+
+    /**
+     * 获取首页数据详细信息
+     */
+    @PreAuthorize("@ss.hasPermi('carousel:carousel:query')")
+    @GetMapping(value = "/{id}")
+    @ApiOperation("获取首页数据详细信息")
+    public Response<HomePageDataInfoVo> getHomePageDataInfo(
+            @ApiParam(name = "id", value = "首页数据id", required = true)
+            @PathVariable("id") Long id
+    ) {
+        return homePageDataInfoService.getHomePageDataById(id);
+    }
+
+    /**
+     * 修改首页数据
+     */
+    @PreAuthorize("@ss.hasPermi('carousel:carousel:edit')")
+    @Log(title = "首页数据", businessType = BusinessTypeEnum.UPDATE)
+    @PutMapping
+    @ApiOperation("修改首页数据")
+    public Response<Integer> edit(@RequestBody HomePageDataInfo homePageDataInfo) {
+        return homePageDataInfoService.updateHomePageDataInfoById(homePageDataInfo);
+    }
+
+
+    /**
+     * 删除首页数据(伪删除)
+     */
+    @PreAuthorize("@ss.hasPermi('carousel:carousel:remove')")
+    @Log(title = "首页数据", businessType = BusinessTypeEnum.UPDATE)
+	@PutMapping("/{ids}")
+    @ApiOperation("删除首页数据")
+    public  Response remove(
+            @ApiParam(name = "ids", value = "首页数据ids参数", required = true)
+            @PathVariable Long[] ids
+    ){
+        return homePageDataInfoService.removeCarouselByIds(ids);
+    }
+}

+ 2 - 2
zzjs-common/src/main/java/com/miaxis/common/constant/Constants.java

@@ -138,9 +138,9 @@ public class Constants
     public static final String BROWSE_RECORD_KEY = "browse_record:";
 
     /**
-     * 轮播图 cache key
+     * 首页数据 cache key
      */
-    public static final String CAROUSEL_CHART_KEY = "carousel_chart:";
+    public static final String HOME_PAGE_DATA_KEY = "home_page_data:";
 
     /**
      * 资源映射路径 前缀

+ 35 - 0
zzjs-common/src/main/java/com/miaxis/common/enums/HomePageDataType.java

@@ -0,0 +1,35 @@
+package com.miaxis.common.enums;
+
+/**
+ * @author wwl
+ * @version 1.0
+ * @date 2021/4/27 15:18
+ */
+public enum HomePageDataType {
+
+    CAROUSElCHART(1, "carouselChart", "轮播图"),
+    COUPON(2, "coupon", "优惠劵"),
+    MENU(3, "menu", "首页菜单");
+
+    private final Integer code;
+    private final String dataType;//文件类型
+    private final String info;
+
+    HomePageDataType(Integer code, String dataType, String info)
+    {
+        this.code = code;
+        this.dataType = dataType;
+        this.info = info;
+    }
+
+    public Integer getCode() {
+        return code;
+    }
+
+    public String getDataType() {
+        return dataType;
+    }
+
+    public String getInfo() {
+        return info;
+    }}

+ 12 - 6
zzjs-service/src/main/java/com/miaxis/carousel/domain/CarouselChartInfo.java → zzjs-service/src/main/java/com/miaxis/carousel/domain/HomePageDataInfo.java

@@ -8,18 +8,16 @@ import com.miaxis.common.core.domain.BaseBusinessEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 /**
- * 轮播图对象 carousel_chart_info
+ * 首页数据表 home_page_data_info
  *
  * @author miaxis
  * @date 2021-03-11
  */
 @Data
-@TableName("carousel_chart_info")
-@ApiModel(value = "CarouselChartInfo", description = "轮播图对象 carousel_chart_info")
-public class CarouselChartInfo extends BaseBusinessEntity{
+@TableName("home_page_data_info")
+@ApiModel(value = "HomePageDataInfo", description = "首页数据表 home_page_data_info")
+public class HomePageDataInfo extends BaseBusinessEntity{
     private static final long serialVersionUID = 1L;
 
     /** 主键 */
@@ -50,6 +48,14 @@ public class CarouselChartInfo extends BaseBusinessEntity{
     @ApiModelProperty(value = "权重(数值从大到小)")
     private Integer weight;
 
+    @TableField("data_type")
+    @ApiModelProperty(value = "类型:carouselChart:轮播图、coupon:优惠劵、menu:首页菜单")
+    private String dataType;
+
+    @TableField("data_describe")
+    @ApiModelProperty(value = "内容描述")
+    private String dataDescribe;
+
     /** 状态  0:有效(默认)、1:失效 (伪删除) */
     @Excel(name = "状态  0:有效(默认)、1:失效 (伪删除)", readConverterExp = "伪=删除")
     @TableField("status")

+ 0 - 31
zzjs-service/src/main/java/com/miaxis/carousel/mapper/CarouselChartInfoMapper.java

@@ -1,31 +0,0 @@
-package com.miaxis.carousel.mapper;
-
-import com.baomidou.mybatisplus.core.mapper.BaseMapper;
-import com.miaxis.carousel.domain.CarouselChartInfo;
-import com.miaxis.carousel.vo.CarouselChartInfoVo;
-import org.apache.ibatis.annotations.Param;
-
-import java.util.List;
-
-/**
- * 轮播图Mapper接口
- *
- * @author miaxis
- * @date 2021-03-11
- */
-public interface CarouselChartInfoMapper extends BaseMapper<CarouselChartInfo> {
-    /**
-     * 查询轮播图列表
-     *
-     * @param carouselChartInfo 轮播图
-     * @return 轮播图集合
-     */
-    List<CarouselChartInfoVo> selectCarouselChartInfoList(CarouselChartInfo carouselChartInfo);
-
-    /**
-     * 获取轮播图详细信息
-     * @param id
-     * @return
-     */
-    CarouselChartInfoVo getCarouselChartById(@Param("id") Long id);
-}

+ 31 - 0
zzjs-service/src/main/java/com/miaxis/carousel/mapper/HomePageDataInfoMapper.java

@@ -0,0 +1,31 @@
+package com.miaxis.carousel.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.carousel.domain.HomePageDataInfo;
+import com.miaxis.carousel.vo.HomePageDataInfoVo;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+/**
+ * 首页数据Mapper接口
+ *
+ * @author miaxis
+ * @date 2021-03-11
+ */
+public interface HomePageDataInfoMapper extends BaseMapper<HomePageDataInfo> {
+    /**
+     * 查询首页数据列表
+     *
+     * @param homePageDataInfo 首页数据
+     * @return 首页数据集合
+     */
+    List<HomePageDataInfoVo> selectHomePageDataInfoList(HomePageDataInfo homePageDataInfo);
+
+    /**
+     * 获取首页数据详细信息
+     * @param id
+     * @return
+     */
+    HomePageDataInfoVo getHomePageDataById(@Param("id") Long id);
+}

+ 0 - 60
zzjs-service/src/main/java/com/miaxis/carousel/service/ICarouselChartInfoService.java

@@ -1,60 +0,0 @@
-package com.miaxis.carousel.service;
-
-import com.baomidou.mybatisplus.extension.service.IService;
-import com.miaxis.carousel.domain.CarouselChartInfo;
-import com.miaxis.carousel.vo.CarouselChartInfoVo;
-import com.miaxis.common.core.domain.Response;
-
-import java.util.List;
-
-/**
- * 轮播图Service接口
- *
- * @author miaxis
- * @date 2021-03-11
- */
-public interface ICarouselChartInfoService extends IService<CarouselChartInfo>{
-
-    /**
-     * 查询轮播图列表
-     *
-     * @param carouselChartInfo 轮播图
-     * @return 轮播图集合
-     */
-    List<CarouselChartInfoVo> selectCarouselChartInfoList(CarouselChartInfo carouselChartInfo);
-
-    /**
-     * 新增轮播图
-     * @param carouselChartInfo
-     * @return
-     */
-    Response saveCarouselChartInfo(CarouselChartInfo carouselChartInfo);
-
-    /**
-     * 修改轮播图
-     * @param carouselChartInfo
-     * @return
-     */
-    Response<Integer> updateCarouselChartInfoById(CarouselChartInfo carouselChartInfo);
-
-    /**
-     * 获取轮播图详细信息
-     * @param id
-     * @return
-     */
-    Response<CarouselChartInfoVo> getCarouselChartById(Long id);
-
-    /**
-     * 删除轮播图(伪删除)
-     * @param ids
-     * @return
-     */
-    Response<Integer> removeCarouselByIds(Long[] ids);
-
-    /**
-     * applet
-     * 获取轮播图列表
-     * @return
-     */
-    List<CarouselChartInfoVo> getCarouselChartList();
-}

+ 60 - 0
zzjs-service/src/main/java/com/miaxis/carousel/service/IHomePageDataInfoService.java

@@ -0,0 +1,60 @@
+package com.miaxis.carousel.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.miaxis.carousel.domain.HomePageDataInfo;
+import com.miaxis.carousel.vo.HomePageDataInfoVo;
+import com.miaxis.common.core.domain.Response;
+
+import java.util.List;
+
+/**
+ * 首页数据Service接口
+ *
+ * @author miaxis
+ * @date 2021-03-11
+ */
+public interface IHomePageDataInfoService extends IService<HomePageDataInfo>{
+
+    /**
+     * 查询首页数据列表
+     *
+     * @param homePageDataInfo 首页数据
+     * @return 首页数据集合
+     */
+    List<HomePageDataInfoVo> selectHomePageDataInfoList(HomePageDataInfo homePageDataInfo);
+
+    /**
+     * 新增首页数据
+     * @param homePageDataInfo
+     * @return
+     */
+    Response saveHomePageDataInfo(HomePageDataInfo homePageDataInfo);
+
+    /**
+     * 修改首页数据
+     * @param homePageDataInfo
+     * @return
+     */
+    Response<Integer> updateHomePageDataInfoById(HomePageDataInfo homePageDataInfo);
+
+    /**
+     * 获取首页数据详细信息
+     * @param id
+     * @return
+     */
+    Response<HomePageDataInfoVo> getHomePageDataById(Long id);
+
+    /**
+     * 删除首页数据(伪删除)
+     * @param ids
+     * @return
+     */
+    Response<Integer> removeCarouselByIds(Long[] ids);
+
+    /**
+     * applet
+     * 获取首页数据列表
+     * @return
+     */
+    Response getHomePageDataList();
+}

+ 0 - 169
zzjs-service/src/main/java/com/miaxis/carousel/service/impl/CarouselChartInfoServiceImpl.java

@@ -1,169 +0,0 @@
-package com.miaxis.carousel.service.impl;
-
-import com.alibaba.fastjson.JSONObject;
-import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.miaxis.carousel.domain.CarouselChartInfo;
-import com.miaxis.carousel.mapper.CarouselChartInfoMapper;
-import com.miaxis.carousel.service.ICarouselChartInfoService;
-import com.miaxis.carousel.vo.CarouselChartInfoVo;
-import com.miaxis.common.constant.Constants;
-import com.miaxis.common.core.domain.Response;
-import com.miaxis.common.exception.CustomException;
-import com.miaxis.common.utils.bean.BeanUtils;
-import com.miaxis.file.domain.FileInfo;
-import com.miaxis.file.service.IFileInfoService;
-import lombok.RequiredArgsConstructor;
-import lombok.SneakyThrows;
-import org.springframework.data.redis.core.RedisTemplate;
-import org.springframework.stereotype.Service;
-import org.springframework.transaction.annotation.Transactional;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-/**
- * 轮播图Service业务层处理
- *
- * @author miaxis
- * @date 2021-03-11
- */
-@Service
-@RequiredArgsConstructor
-public class CarouselChartInfoServiceImpl extends ServiceImpl<CarouselChartInfoMapper, CarouselChartInfo> implements ICarouselChartInfoService {
-
-    private final CarouselChartInfoMapper carouselChartInfoMapper;
-
-    private final RedisTemplate redisTemplate;
-
-    private final IFileInfoService fileInfoService;
-
-    /**
-     * 查询轮播图列表
-     *
-     * @param carouselChartInfo 轮播图
-     * @return 轮播图
-     */
-    @Override
-    public List<CarouselChartInfoVo> selectCarouselChartInfoList(CarouselChartInfo carouselChartInfo){
-        return carouselChartInfoMapper.selectCarouselChartInfoList(carouselChartInfo);
-    }
-
-    /**
-     * 新增轮播图
-     * @param carouselChartInfo
-     * @return
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Response saveCarouselChartInfo(CarouselChartInfo carouselChartInfo) {
-        try{
-            CarouselChartInfo chartInfo = new CarouselChartInfo();
-            BeanUtils.copyProperties(carouselChartInfo,chartInfo);
-            carouselChartInfoMapper.insert(chartInfo);
-            //更新缓存
-            updateCarouselChartRedis(chartInfo);
-            return Response.success();
-        }catch (Exception e){
-            throw new CustomException("系统异常");
-        }
-    }
-
-    /**
-     * 修改轮播图
-     * @param carouselChartInfo
-     * @return
-     */
-    @Override
-    @Transactional(rollbackFor = Exception.class)
-    public Response<Integer> updateCarouselChartInfoById(CarouselChartInfo carouselChartInfo) {
-        try {
-            carouselChartInfoMapper.updateById(carouselChartInfo);
-            if ("1".equals(carouselChartInfo.getStatus())){
-                //删除缓存
-                redisTemplate.delete(Constants.CAROUSEL_CHART_KEY + carouselChartInfo.getId());
-            }else{
-                //更新缓存
-                updateCarouselChartRedis(carouselChartInfo);
-            }
-            return Response.success();
-        }catch (Exception e){
-            throw new CustomException("系统异常");
-        }
-    }
-
-    /**
-     * 获取轮播图详细信息
-     * @param id
-     * @return
-     */
-    @Override
-    public Response<CarouselChartInfoVo> getCarouselChartById(Long id) {
-        return Response.success(carouselChartInfoMapper.getCarouselChartById(id));
-    }
-
-    /**
-     * 删除轮播图(伪删除)
-     * @param ids
-     * @return
-     */
-    @Override
-    @SneakyThrows
-    @Transactional(rollbackFor = Exception.class)
-    public Response removeCarouselByIds(Long[] ids) {
-        for (Long id : ids) {
-            this.update(new UpdateWrapper<CarouselChartInfo>().set("status","1").eq("id",id));
-            //删除缓存
-            redisTemplate.delete(Constants.CAROUSEL_CHART_KEY + id);
-        }
-        return Response.success();
-    }
-
-
-    /**
-     * applet
-     * 获取轮播图列表
-     * @return
-     */
-    @Override
-    public List<CarouselChartInfoVo> getCarouselChartList() {
-        List<CarouselChartInfoVo> infoVos = new ArrayList<>();
-        //从缓存获取
-        Set keys = redisTemplate.keys(Constants.CAROUSEL_CHART_KEY + "*");
-        if (!keys.isEmpty()){
-            for (Object key : keys) {
-                String jsonStr = (String) redisTemplate.opsForValue().get(key);
-                CarouselChartInfoVo carouselChartInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(CarouselChartInfoVo.class);
-                infoVos.add(carouselChartInfoVo);
-            }
-        }else {
-            //数据库获取(此处可不做查询!)
-            CarouselChartInfo carouselChartInfo = new CarouselChartInfo();
-            carouselChartInfo.setStatus("0");//启用状态
-            infoVos = carouselChartInfoMapper.selectCarouselChartInfoList(carouselChartInfo);
-        }
-
-        return infoVos.stream()
-                .sorted(Comparator.comparing(CarouselChartInfoVo::getWeight).reversed())
-                .collect(Collectors.toList());
-    }
-
-
-    /**
-     * 更新轮播图缓存
-     * @param carouselChartInfo
-     */
-    private void updateCarouselChartRedis(CarouselChartInfo carouselChartInfo){
-        //更新缓存
-        FileInfo fileInfo = fileInfoService.getById(carouselChartInfo.getFileId());
-        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(carouselChartInfo));
-        jsonObject.put("fileUrl",fileInfo.getFileUrl());
-        //同时更新缓存
-        redisTemplate.opsForValue().set(Constants.CAROUSEL_CHART_KEY + carouselChartInfo.getId(),JSONObject.toJSONString(jsonObject));
-    }
-
-
-}

+ 242 - 0
zzjs-service/src/main/java/com/miaxis/carousel/service/impl/HomePageDataInfoServiceImpl.java

@@ -0,0 +1,242 @@
+package com.miaxis.carousel.service.impl;
+
+import com.alibaba.fastjson.JSONObject;
+import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.miaxis.carousel.domain.HomePageDataInfo;
+import com.miaxis.carousel.mapper.HomePageDataInfoMapper;
+import com.miaxis.carousel.service.IHomePageDataInfoService;
+import com.miaxis.carousel.vo.HomePageDataInfoVo;
+import com.miaxis.common.constant.Constants;
+import com.miaxis.common.core.domain.Response;
+import com.miaxis.common.enums.HomePageDataType;
+import com.miaxis.common.exception.CustomException;
+import com.miaxis.common.utils.bean.BeanUtils;
+import com.miaxis.file.domain.FileInfo;
+import com.miaxis.file.service.IFileInfoService;
+import lombok.RequiredArgsConstructor;
+import lombok.SneakyThrows;
+import org.springframework.data.redis.core.RedisTemplate;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+
+import java.util.*;
+import java.util.stream.Collectors;
+
+/**
+ * 首页数据Service业务层处理
+ *
+ * @author miaxis
+ * @date 2021-03-11
+ */
+@Service
+@RequiredArgsConstructor
+public class HomePageDataInfoServiceImpl extends ServiceImpl<HomePageDataInfoMapper, HomePageDataInfo> implements IHomePageDataInfoService {
+
+    private final HomePageDataInfoMapper homePageDataInfoMapper;
+
+    private final RedisTemplate redisTemplate;
+
+    private final IFileInfoService fileInfoService;
+
+    /**
+     * 查询首页数据列表
+     *
+     * @param homePageDataInfo 首页数据
+     * @return 首页数据
+     */
+    @Override
+    public List<HomePageDataInfoVo> selectHomePageDataInfoList(HomePageDataInfo homePageDataInfo){
+        return homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
+    }
+
+    /**
+     * 新增首页数据
+     * @param homePageDataInfo
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Response saveHomePageDataInfo(HomePageDataInfo homePageDataInfo) {
+        try{
+            HomePageDataInfo chartInfo = new HomePageDataInfo();
+            BeanUtils.copyProperties(homePageDataInfo,chartInfo);
+            homePageDataInfoMapper.insert(chartInfo);
+            //更新缓存
+            updateHomePageDataRedis(chartInfo);
+            return Response.success();
+        }catch (Exception e){
+            throw new CustomException("系统异常");
+        }
+    }
+
+    /**
+     * 修改首页数据
+     * @param homePageDataInfo
+     * @return
+     */
+    @Override
+    @Transactional(rollbackFor = Exception.class)
+    public Response<Integer> updateHomePageDataInfoById(HomePageDataInfo homePageDataInfo) {
+        try {
+            homePageDataInfoMapper.updateById(homePageDataInfo);
+            if ("1".equals(homePageDataInfo.getStatus())){
+                //删除缓存
+                redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY+homePageDataInfo.getDataType()+":"+ homePageDataInfo.getId());
+            }else{
+                //更新缓存
+                updateHomePageDataRedis(homePageDataInfo);
+            }
+            return Response.success();
+        }catch (Exception e){
+            throw new CustomException("系统异常");
+        }
+    }
+
+    /**
+     * 获取首页数据详细信息
+     * @param id
+     * @return
+     */
+    @Override
+    public Response<HomePageDataInfoVo> getHomePageDataById(Long id) {
+        return Response.success(homePageDataInfoMapper.getHomePageDataById(id));
+    }
+
+    /**
+     * 删除首页数据(伪删除)
+     * @param ids
+     * @return
+     */
+    @Override
+    @SneakyThrows
+    @Transactional(rollbackFor = Exception.class)
+    public Response removeCarouselByIds(Long[] ids) {
+
+        for (Long id : ids) {
+            this.update(new UpdateWrapper<HomePageDataInfo>().set("status","1").eq("id",id));
+
+            //判断类型 删除缓存
+            if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.CAROUSElCHART.getDataType()+":"+id)){
+                redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.CAROUSElCHART.getDataType() + ":" + id);
+            }
+            if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.COUPON.getDataType()+":"+id)){
+                redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.COUPON.getDataType() + ":" + id);
+            }
+            if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.MENU.getDataType()+":"+id)){
+                redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.MENU.getDataType() + ":" + id);
+            }
+        }
+        return Response.success();
+    }
+
+
+    /**
+     * applet
+     * 获取首页数据列表
+     * @return
+     */
+    @Override
+    public Response getHomePageDataList() {
+
+        Map<String, List<HomePageDataInfoVo>> map = new HashMap<>();
+
+        List<HomePageDataInfoVo> carouselChartInfoVos = new ArrayList<>(); //轮播图list
+        List<HomePageDataInfoVo> couponInfos = new ArrayList<>(); //优惠劵list
+        List<HomePageDataInfoVo> menuInfos = new ArrayList<>(); //首页菜单list
+
+        //-------------------从缓存获取轮播图-------------------
+        Set carouselChartkeys = redisTemplate.keys(Constants.HOME_PAGE_DATA_KEY + HomePageDataType.CAROUSElCHART.getDataType()+":*");
+        if (!carouselChartkeys.isEmpty()){
+            for (Object key : carouselChartkeys) {
+                String jsonStr = (String) redisTemplate.opsForValue().get(key);
+                HomePageDataInfoVo homePageDataInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(HomePageDataInfoVo.class);
+                carouselChartInfoVos.add(homePageDataInfoVo);
+            }
+        }else {
+            //数据库获取(此处可不做查询!)
+            HomePageDataInfo homePageDataInfo = new HomePageDataInfo();
+            homePageDataInfo.setDataType(HomePageDataType.CAROUSElCHART.getDataType());
+            homePageDataInfo.setStatus("0");//启用状态
+            carouselChartInfoVos = homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
+        }
+        //排序
+        List<HomePageDataInfoVo> chartInfoVos = carouselChartInfoVos.stream()
+                .sorted(Comparator.comparing(HomePageDataInfoVo::getWeight).reversed())
+                .collect(Collectors.toList());
+
+        //-------------------从缓存获取优惠劵-------------------
+        Set couponKeys = redisTemplate.keys(Constants.HOME_PAGE_DATA_KEY + HomePageDataType.COUPON.getDataType()+":*");
+        if (!couponKeys.isEmpty()){
+            for (Object key : couponKeys) {
+                String jsonStr = (String) redisTemplate.opsForValue().get(key);
+                HomePageDataInfoVo homePageDataInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(HomePageDataInfoVo.class);
+                couponInfos.add(homePageDataInfoVo);
+            }
+        }else {
+            //数据库获取(此处可不做查询!)
+            HomePageDataInfo homePageDataInfo = new HomePageDataInfo();
+            homePageDataInfo.setDataType(HomePageDataType.COUPON.getDataType());
+            homePageDataInfo.setStatus("0");//启用状态
+            couponInfos = homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
+        }
+        //排序
+        List<HomePageDataInfoVo> couponInfoVos = couponInfos.stream()
+                .sorted(Comparator.comparing(HomePageDataInfoVo::getWeight).reversed())
+                .collect(Collectors.toList());
+
+        //----------------从缓存获取首页菜单-------------------
+        Set menuKeys = redisTemplate.keys(Constants.HOME_PAGE_DATA_KEY + HomePageDataType.MENU.getDataType()+":*");
+        if (!menuKeys.isEmpty()){
+            for (Object key : menuKeys) {
+                String jsonStr = (String) redisTemplate.opsForValue().get(key);
+                HomePageDataInfoVo homePageDataInfoVo = JSONObject.parseObject(jsonStr).toJavaObject(HomePageDataInfoVo.class);
+                menuInfos.add(homePageDataInfoVo);
+            }
+        }else {
+            //数据库获取(此处可不做查询!)
+            HomePageDataInfo homePageDataInfo = new HomePageDataInfo();
+            homePageDataInfo.setDataType(HomePageDataType.MENU.getDataType());
+            homePageDataInfo.setStatus("0");//启用状态
+            menuInfos = homePageDataInfoMapper.selectHomePageDataInfoList(homePageDataInfo);
+        }
+        //排序
+        List<HomePageDataInfoVo> menuInfoVos = menuInfos.stream()
+                .sorted(Comparator.comparing(HomePageDataInfoVo::getWeight).reversed())
+                .collect(Collectors.toList());
+
+        map.put(HomePageDataType.CAROUSElCHART.getDataType(),chartInfoVos);
+        map.put(HomePageDataType.COUPON.getDataType(),couponInfoVos);
+        map.put(HomePageDataType.MENU.getDataType(),menuInfoVos);
+
+        return Response.success(map);
+    }
+
+
+    /**
+     * 更新首页数据缓存
+     * @param homePageDataInfo
+     */
+    private void updateHomePageDataRedis(HomePageDataInfo homePageDataInfo){
+        //更新缓存
+        FileInfo fileInfo = fileInfoService.getById(homePageDataInfo.getFileId());
+        JSONObject jsonObject = JSONObject.parseObject(JSONObject.toJSONString(homePageDataInfo));
+        jsonObject.put("fileUrl",fileInfo.getFileUrl());
+
+        //判断类型 删除缓存
+        if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.CAROUSElCHART.getDataType()+":"+homePageDataInfo.getId())){
+            redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.CAROUSElCHART.getDataType() + ":" + homePageDataInfo.getId());
+        }
+        if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.COUPON.getDataType()+":"+homePageDataInfo.getId())){
+            redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.COUPON.getDataType() + ":" + homePageDataInfo.getId());
+        }
+        if (redisTemplate.hasKey(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.MENU.getDataType()+":"+homePageDataInfo.getId())){
+            redisTemplate.delete(Constants.HOME_PAGE_DATA_KEY  + HomePageDataType.MENU.getDataType() + ":" + homePageDataInfo.getId());
+        }
+
+        //同时更新缓存(根据type拼接)
+        redisTemplate.opsForValue().set(Constants.HOME_PAGE_DATA_KEY +homePageDataInfo.getDataType()+":"+ homePageDataInfo.getId(),JSONObject.toJSONString(jsonObject));
+    }
+
+
+}

+ 9 - 10
zzjs-service/src/main/java/com/miaxis/carousel/vo/CarouselChartInfoVo.java → zzjs-service/src/main/java/com/miaxis/carousel/vo/HomePageDataInfoVo.java

@@ -1,25 +1,18 @@
 package com.miaxis.carousel.vo;
 
-import com.baomidou.mybatisplus.annotation.TableField;
-import com.baomidou.mybatisplus.annotation.TableId;
-import com.baomidou.mybatisplus.annotation.TableName;
-import com.miaxis.common.annotation.Excel;
-import com.miaxis.common.core.domain.BaseBusinessEntity;
 import io.swagger.annotations.ApiModel;
 import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-import org.apache.commons.lang3.builder.ToStringStyle;
 
 /**
- * 轮播图对象返回参
+ * 首页数据表对象返回参
  *
  * @author miaxis
  * @date 2021-03-11
  */
 @Data
-@ApiModel(value = "CarouselChartInfoVo", description = "轮播图对象返回参")
-public class CarouselChartInfoVo{
+@ApiModel(value = "HomePageDataInfoVo", description = "首页数据表对象返回参")
+public class HomePageDataInfoVo {
 
     @ApiModelProperty(value = "主键")
     private Long id;
@@ -44,6 +37,12 @@ public class CarouselChartInfoVo{
     @ApiModelProperty(value = "权重(数值从大到小)")
     private Integer weight;
 
+    @ApiModelProperty(value = "类型:carouselChart:轮播图、coupon:优惠劵、menu:首页菜单")
+    private String dataType;
+
+    @ApiModelProperty(value = "内容描述")
+    private String dataDescribe;
+
     /** 状态  0:有效(默认)、1:失效 (伪删除) */
     @ApiModelProperty(value = "状态  0:有效(默认)、1:失效 (伪删除)")
     private String status;

+ 15 - 8
zzjs-service/src/main/resources/mapper/carousel/CarouselChartInfoMapper.xml → zzjs-service/src/main/resources/mapper/carousel/HomePageDataInfoMapper.xml

@@ -2,9 +2,9 @@
 <!DOCTYPE mapper
 PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
 "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.miaxis.carousel.mapper.CarouselChartInfoMapper">
+<mapper namespace="com.miaxis.carousel.mapper.HomePageDataInfoMapper">
 
-    <resultMap type="CarouselChartInfo" id="CarouselChartInfoResult">
+    <resultMap type="HomePageDataInfo" id="HomePageDataInfoResult">
         <result property="id"    column="id"    />
         <result property="pictureName"    column="picture_name"    />
         <result property="fileId"    column="file_id"    />
@@ -13,14 +13,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <result property="createTime"    column="create_time"    />
         <result property="updateTime"    column="update_time"    />
         <result property="weight"    column="weight"    />
+        <result property="dataType"    column="data_type"    />
+        <result property="dataDescribe"    column="data_describe"    />
         <result property="status"    column="status"    />
     </resultMap>
 
-    <sql id="selectCarouselChartInfoVo">
-        select id, picture_name, file_id ,jump_url, jump_url_type, create_time, update_time, weight, status from carousel_chart_info
+    <sql id="selectHomePageDataInfoVo">
+        select id, picture_name, file_id ,jump_url, jump_url_type, create_time, update_time, weight,data_type,data_describe, status from home_page_data_info
     </sql>
 
-    <select id="selectCarouselChartInfoList" resultType="com.miaxis.carousel.vo.CarouselChartInfoVo">
+    <select id="selectHomePageDataInfoList" resultType="com.miaxis.carousel.vo.HomePageDataInfoVo">
         select
         ci.id,
         ci.file_id as fileId,
@@ -29,18 +31,21 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ci.jump_url_type as jumpUrlType,
         f.file_url as fileUrl,
         ci.weight,
+        ci.`data_type` as dataType,
+        ci.`data_describe` as dataDescribe,
         ci.status
-        from carousel_chart_info ci
+        from home_page_data_info ci
         LEFT JOIN file_info f on f.file_id = ci.file_id
         <where>
             <if test="pictureName != null  and pictureName != ''"> and picture_name like concat('%', #{pictureName}, '%')</if>
             <if test="fileId != null "> and file_id = #{fileId}</if>
+            <if test="dataType != null and dataType != ''"> and data_type = #{dataType}</if>
             <if test="status != null and status != ''"> and status = #{status}</if>
         </where>
         ORDER BY ci.weight DESC
     </select>
 
-    <select id="getCarouselChartById" resultType="com.miaxis.carousel.vo.CarouselChartInfoVo">
+    <select id="getHomePageDataById" resultType="com.miaxis.carousel.vo.HomePageDataInfoVo">
         select
         ci.id,
         ci.file_id as fileId,
@@ -49,8 +54,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         ci.jump_url_type as jumpUrlType,
         f.file_url as fileUrl,
         ci.weight,
+        ci.`data_type` as dataType,
+        ci.`data_describe` as dataDescribe,
         ci.status
-        from carousel_chart_info ci
+        from home_page_data_info ci
         LEFT JOIN file_info f on f.file_id = ci.file_id
         where ci.id = #{id}
     </select>

+ 4 - 1
zzjs-service/src/main/resources/mapper/customer/CustomerInfoMapper.xml

@@ -180,15 +180,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
             <choose>
                 <when test="customerInfoDto.customerName != null  and customerInfoDto.customerName != ''">
                     and ci.corporate_name like concat('%', #{customerInfoDto.customerName}, '%')
+                    ORDER BY (collectionCount+weight) DESC
                 </when>
                 <when test="customerInfoDto.id == 0">
                     ORDER BY (collectionCount+weight) DESC
                 </when>
                 <when test="customerInfoDto.pid != null and customerInfoDto.pid != ''">
-                    AND ci.industry_type = #{customerInfoDto.pid}
+                    AND ci.industry_type = #{customerInfoDto.id}
+                    ORDER BY (collectionCount+weight) DESC
                 </when>
                 <otherwise>
                     AND ci.industry_type IN ( SELECT id FROM product_type_info WHERE pid = #{customerInfoDto.id} )
+                    ORDER BY (collectionCount+weight) DESC
                 </otherwise>
             </choose>
         </where>