浏览代码

报表统计功能-数据看板

fushengqian 1 年之前
父节点
当前提交
0d289d821e
共有 21 个文件被更改,包括 406 次插入15 次删除
  1. 69 0
      fuint-application/src/main/java/com/fuint/common/dto/GoodsTopDto.java
  2. 69 0
      fuint-application/src/main/java/com/fuint/common/dto/MemberTopDto.java
  3. 13 0
      fuint-application/src/main/java/com/fuint/common/service/GoodsService.java
  4. 12 0
      fuint-application/src/main/java/com/fuint/common/service/MemberService.java
  5. 4 0
      fuint-application/src/main/java/com/fuint/common/service/impl/BalanceServiceImpl.java
  6. 25 0
      fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java
  7. 27 1
      fuint-application/src/main/java/com/fuint/common/service/impl/MemberServiceImpl.java
  8. 3 1
      fuint-application/src/main/java/com/fuint/common/service/impl/PointServiceImpl.java
  9. 1 0
      fuint-application/src/main/java/com/fuint/common/service/impl/StaffServiceImpl.java
  10. 1 1
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBalanceController.java
  11. 3 4
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCouponController.java
  12. 1 1
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendPointController.java
  13. 28 6
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStatisticController.java
  14. 1 1
      fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientPointsController.java
  15. 1 0
      fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientSignController.java
  16. 54 0
      fuint-repository/src/main/java/com/fuint/repository/bean/GoodsTopBean.java
  17. 52 0
      fuint-repository/src/main/java/com/fuint/repository/bean/MemberTopBean.java
  18. 5 0
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtGoodsMapper.java
  19. 3 0
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtUserMapper.java
  20. 17 0
      fuint-repository/src/main/resources/mapper/MtGoodsMapper.xml
  21. 17 0
      fuint-repository/src/main/resources/mapper/MtUserMapper.xml

+ 69 - 0
fuint-application/src/main/java/com/fuint/common/dto/GoodsTopDto.java

@@ -0,0 +1,69 @@
+package com.fuint.common.dto;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 商品排行DTO
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+public class GoodsTopDto implements Serializable {
+
+    /**
+     * 商品ID
+     */
+    private Integer id;
+
+    /**
+     * 商品名称
+     */
+    private String name;
+
+    /**
+     * 商品条码
+     */
+    private String goodsNo;
+
+    /**
+     * 销售金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 销售数量
+     */
+    private Integer num;
+
+    public Integer getId(){
+        return id;
+    }
+    public void setId(Integer id){
+        this.id=id;
+    }
+    public String getName(){
+        return name;
+    }
+    public void setName(String name){
+        this.name=name;
+    }
+    public String getGoodsNo(){
+        return goodsNo;
+    }
+    public void setGoodsNo(String goodsNo){
+        this.goodsNo=goodsNo;
+    }
+    public Integer getNum(){
+        return num;
+    }
+    public void setNum(Integer num){
+        this.num=num;
+    }
+    public BigDecimal getAmount(){
+        return amount;
+    }
+    public void setAmount(BigDecimal amount){
+        this.amount=amount;
+    }
+}
+

+ 69 - 0
fuint-application/src/main/java/com/fuint/common/dto/MemberTopDto.java

@@ -0,0 +1,69 @@
+package com.fuint.common.dto;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 会员排行DTO
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+public class MemberTopDto implements Serializable {
+
+    /**
+     * 会员ID
+     */
+    private Integer id;
+
+    /**
+     * 会员名称
+     */
+    private String name;
+
+    /**
+     * 会员号
+     */
+    private String userNo;
+
+    /**
+     * 消费金额
+     */
+    private BigDecimal amount;
+
+    /**
+     * 购买数量
+     */
+    private Integer num;
+
+    public Integer getId(){
+        return id;
+    }
+    public void setId(Integer id){
+        this.id=id;
+    }
+    public String getName(){
+        return name;
+    }
+    public void setName(String name){
+        this.name=name;
+    }
+    public String getUserNo(){
+        return userNo;
+    }
+    public void setUserNo(String userNo){
+        this.userNo=userNo;
+    }
+    public Integer getNum(){
+        return num;
+    }
+    public void setNum(Integer num){
+        this.num=num;
+    }
+    public BigDecimal getAmount(){
+        return amount;
+    }
+    public void setAmount(BigDecimal amount){
+        this.amount=amount;
+    }
+}
+

+ 13 - 0
fuint-application/src/main/java/com/fuint/common/service/GoodsService.java

@@ -2,6 +2,7 @@ package com.fuint.common.service;
 
 import com.fuint.common.dto.GoodsDto;
 import com.fuint.common.dto.GoodsSpecValueDto;
+import com.fuint.common.dto.GoodsTopDto;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
@@ -9,6 +10,7 @@ import com.fuint.repository.model.MtGoods;
 import com.fuint.repository.model.MtGoodsSku;
 import com.fuint.repository.model.MtGoodsSpec;
 import java.lang.reflect.InvocationTargetException;
+import java.util.Date;
 import java.util.List;
 import java.util.Map;
 
@@ -118,4 +120,15 @@ public interface GoodsService {
      * @return
      */
     PaginationResponse<GoodsDto> selectGoodsList(Map<String, Object> params) throws BusinessCheckException;
+
+    /**
+     * 获取商品销售排行榜
+     *
+     * @param merchantId
+     * @param storeId
+     * @param startTime
+     * @param endTime
+     * @return
+     * */
+    List<GoodsTopDto> getGoodsSaleTopList(Integer merchantId, Integer storeId, Date startTime, Date endTime);
 }

+ 12 - 0
fuint-application/src/main/java/com/fuint/common/service/MemberService.java

@@ -2,6 +2,7 @@ package com.fuint.common.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
 import com.alibaba.fastjson.JSONObject;
+import com.fuint.common.dto.MemberTopDto;
 import com.fuint.common.dto.UserDto;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
@@ -158,4 +159,15 @@ public interface MemberService extends IService<MtUser> {
      * @throws BusinessCheckException
      */
     void resetMobile(String mobile, Integer userId) throws BusinessCheckException;
+
+    /**
+     * 获取会员消费排行榜
+     *
+     * @param merchantId
+     * @param storeId
+     * @param startTime
+     * @param endTime
+     * @return
+     * */
+    List<MemberTopDto> getMemberConsumeTopList(Integer merchantId, Integer storeId, Date startTime, Date endTime);
 }

+ 4 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/BalanceServiceImpl.java

@@ -148,6 +148,10 @@ public class BalanceServiceImpl extends ServiceImpl<MtBalanceMapper, MtBalance>
         if (mtUser.getStoreId() != null) {
             mtBalance.setStoreId(mtUser.getStoreId());
         }
+        if (!mtUser.getMerchantId().equals(mtBalance.getMerchantId())) {
+            throw new BusinessCheckException("没有操作权限");
+        }
+
         mtUser.setBalance(newAmount);
         mtUserMapper.updateById(mtUser);
 

+ 25 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/GoodsServiceImpl.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fuint.common.Constants;
 import com.fuint.common.dto.GoodsDto;
 import com.fuint.common.dto.GoodsSpecValueDto;
+import com.fuint.common.dto.GoodsTopDto;
 import com.fuint.common.enums.GoodsTypeEnum;
 import com.fuint.common.enums.StatusEnum;
 import com.fuint.common.enums.YesOrNoEnum;
@@ -18,6 +19,7 @@ import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
 import com.fuint.repository.bean.GoodsBean;
+import com.fuint.repository.bean.GoodsTopBean;
 import com.fuint.repository.mapper.MtGoodsMapper;
 import com.fuint.repository.mapper.MtGoodsSkuMapper;
 import com.fuint.repository.mapper.MtGoodsSpecMapper;
@@ -585,4 +587,27 @@ public class GoodsServiceImpl extends ServiceImpl<MtGoodsMapper, MtGoods> implem
 
         return paginationResponse;
     }
+
+    /**
+     * 获取商品销售排行榜
+     *
+     * @param merchantId
+     * @param storeId
+     * @param startTime
+     * @param endTime
+     * @return
+     * */
+    @Override
+    public List<GoodsTopDto> getGoodsSaleTopList(Integer merchantId, Integer storeId, Date startTime, Date endTime) {
+        List<GoodsTopBean> dataList = mtGoodsMapper.getGoodsSaleTopList(merchantId, storeId, startTime, endTime);
+        List<GoodsTopDto> goodsList = new ArrayList<>();
+        if (dataList != null && dataList.size() > 0) {
+            for (GoodsTopBean bean : dataList) {
+                 GoodsTopDto dto = new GoodsTopDto();
+                 BeanUtils.copyProperties(bean, dto);
+                 goodsList.add(dto);
+            }
+        }
+        return goodsList;
+    }
 }

+ 27 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/MemberServiceImpl.java

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fuint.common.dto.AccountInfo;
+import com.fuint.common.dto.MemberTopDto;
 import com.fuint.common.dto.UserDto;
 import com.fuint.common.enums.GenderEnum;
 import com.fuint.common.enums.MemberSourceEnum;
@@ -16,6 +17,7 @@ import com.fuint.framework.annoation.OperationServiceLog;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.pagination.PaginationRequest;
 import com.fuint.framework.pagination.PaginationResponse;
+import com.fuint.repository.bean.MemberTopBean;
 import com.fuint.repository.mapper.MtUserActionMapper;
 import com.fuint.repository.mapper.MtUserGradeMapper;
 import com.fuint.repository.mapper.MtUserMapper;
@@ -784,7 +786,7 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
      *
      * @param  mobile 手机号码
      * @param  userId 会员ID
-     * @throws BusinessCheckException
+     * @return
      */
     @Override
     public void resetMobile(String mobile, Integer userId) {
@@ -793,4 +795,28 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
         }
         mtUserMapper.resetMobile(mobile, userId);
     }
+
+    /**
+     * 获取会员消费排行榜
+     *
+     * @param merchantId
+     * @param storeId
+     * @param startTime
+     * @param endTime
+     * @return
+     * */
+    @Override
+    public List<MemberTopDto> getMemberConsumeTopList(Integer merchantId, Integer storeId, Date startTime, Date endTime) {
+       List<MemberTopBean> memberList = mtUserMapper.getMemberConsumeTopList(merchantId, storeId, startTime, endTime);
+       List<MemberTopDto> dataList = new ArrayList<>();
+       if (memberList != null && memberList.size() > 0) {
+           for (MemberTopBean bean : memberList) {
+                MemberTopDto dto = new MemberTopDto();
+                BeanUtils.copyProperties(bean, dto);
+                dataList.add(dto);
+           }
+       }
+
+       return dataList;
+    }
 }

+ 3 - 1
fuint-application/src/main/java/com/fuint/common/service/impl/PointServiceImpl.java

@@ -144,11 +144,13 @@ public class PointServiceImpl extends ServiceImpl<MtPointMapper, MtPoint> implem
         if (newAmount < 0) {
             return;
         }
+        if (!mtUser.getMerchantId().equals(mtPoint.getMerchantId())) {
+            throw new BusinessCheckException("没有操作权限");
+        }
         mtUser.setPoint(newAmount);
         if (mtUser.getStoreId() != null) {
             mtPoint.setStoreId(mtUser.getStoreId());
         }
-        mtPoint.setMerchantId(mtUser.getMerchantId());
         mtUserMapper.updateById(mtUser);
         mtPointMapper.insert(mtPoint);
 

+ 1 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/StaffServiceImpl.java

@@ -145,6 +145,7 @@ public class StaffServiceImpl extends ServiceImpl<MtStaffMapper, MtStaff> implem
             userInfo.setName(mtStaff.getRealName());
             userInfo.setDescription("系统自动注册店铺员工账号");
             userInfo.setStoreId(mtStaff.getStoreId());
+            userInfo.setMerchantId(mtStaff.getMerchantId());
             mtUser = memberService.addMember(userInfo);
             if (mtUser != null) {
                 mtStaff.setUserId(mtUser.getId());

+ 1 - 1
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendBalanceController.java

@@ -155,7 +155,7 @@ public class BackendBalanceController extends BaseController {
         } else {
             mtBalance.setAmount(new BigDecimal(amount));
         }
-
+        mtBalance.setMerchantId(accountInfo.getMerchantId());
         mtBalance.setDescription(remark);
         mtBalance.setUserId(userId);
         mtBalance.setOperator(operator);

+ 3 - 4
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendCouponController.java

@@ -352,8 +352,6 @@ public class BackendCouponController extends BaseController {
             }
         }
 
-        result.put("storeList", storeList);
-
         // 卡券适用商品
         List<MtCouponGoods> couponGoodsList = mtCouponGoodsMapper.getCouponGoods(id);
         String goodsIds = "";
@@ -369,8 +367,6 @@ public class BackendCouponController extends BaseController {
                 goodsList.add(goodsInfo);
             }
         }
-        result.put("goodsIds", goodsIds);
-        result.put("goodsList", goodsList);
 
         // 不可用日期
         List<DateDto> exceptTimeList = new ArrayList<>();
@@ -411,6 +407,9 @@ public class BackendCouponController extends BaseController {
         result.put("exceptTimeList", exceptTimeList);
         result.put("preStoreList", preStoreList);
         result.put("isEdit", true);
+        result.put("goodsIds", goodsIds);
+        result.put("goodsList", goodsList);
+        result.put("storeList", storeList);
 
         return getSuccessResult(result);
     }

+ 1 - 1
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendPointController.java

@@ -264,7 +264,7 @@ public class BackendPointController extends BaseController {
         } else {
             mtPoint.setAmount(Integer.parseInt(amount));
         }
-
+        mtPoint.setMerchantId(accountInfo.getMerchantId());
         mtPoint.setDescription(remark);
         mtPoint.setUserId(userId);
         mtPoint.setOperator(accountInfo.getAccountName());

+ 28 - 6
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendStatisticController.java

@@ -1,6 +1,9 @@
 package com.fuint.module.backendApi.controller;
 
 import com.fuint.common.dto.AccountInfo;
+import com.fuint.common.dto.GoodsTopDto;
+import com.fuint.common.dto.MemberTopDto;
+import com.fuint.common.service.GoodsService;
 import com.fuint.common.service.MemberService;
 import com.fuint.common.service.OrderService;
 import com.fuint.common.util.DateUtil;
@@ -8,16 +11,16 @@ import com.fuint.common.util.TokenUtil;
 import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.web.BaseController;
 import com.fuint.framework.web.ResponseObject;
+import com.fuint.utils.StringUtil;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
+import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.*;
 import javax.servlet.http.HttpServletRequest;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.text.ParseException;
-import java.util.Date;
-import java.util.HashMap;
-import java.util.Map;
+import java.util.*;
 
 /**
  * 数据统计控制器
@@ -36,6 +39,9 @@ public class BackendStatisticController extends BaseController {
     @Resource
     private OrderService orderService;
 
+    @Resource
+    private GoodsService goodsService;
+
     /**
      * 数据概况
      *
@@ -49,8 +55,8 @@ public class BackendStatisticController extends BaseController {
         String startTimeStr = param.get("startTime") == null ? "" : param.get("startTime").toString();
         String endTimeStr = param.get("endTime") == null ? "" : param.get("endTime").toString();
 
-        Date startTime = DateUtil.parseDate(startTimeStr);
-        Date endTime = DateUtil.parseDate(endTimeStr);
+        Date startTime = StringUtil.isNotEmpty(startTimeStr) ? DateUtil.parseDate(startTimeStr) : null;
+        Date endTime = StringUtil.isNotEmpty(endTimeStr) ? DateUtil.parseDate(endTimeStr) : null;
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
@@ -103,14 +109,30 @@ public class BackendStatisticController extends BaseController {
     @ApiOperation(value = "排行榜数据")
     @RequestMapping(value = "/top", method = RequestMethod.POST)
     @CrossOrigin
-    public ResponseObject top(HttpServletRequest request, @RequestBody Map<String, Object> param) {
+    public ResponseObject top(HttpServletRequest request, @RequestBody Map<String, Object> param) throws ParseException {
         String token = request.getHeader("Access-Token");
+        String startTimeStr = param.get("startTime") == null ? "" : param.get("startTime").toString();
+        String endTimeStr = param.get("endTime") == null ? "" : param.get("endTime").toString();
+
+        Date startTime = StringUtil.isNotEmpty(startTimeStr) ? DateUtil.parseDate(startTimeStr) : null;
+        Date endTime = StringUtil.isNotEmpty(endTimeStr) ? DateUtil.parseDate(endTimeStr) : null;
+
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
             return getFailureResult(1001, "请先登录");
         }
 
+        Integer merchantId = accountInfo.getMerchantId();
+        Integer storeId = accountInfo.getStoreId();
+
         Map<String, Object> result = new HashMap<>();
+
+        List<GoodsTopDto> goodsList = goodsService.getGoodsSaleTopList(merchantId, storeId, startTime, endTime);
+        List<MemberTopDto> memberList = memberService.getMemberConsumeTopList(merchantId, storeId, startTime, endTime);
+
+        result.put("goodsList", goodsList);
+        result.put("memberList", memberList);
+
         return getSuccessResult(result);
     }
 }

+ 1 - 1
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientPointsController.java

@@ -96,7 +96,7 @@ public class ClientPointsController extends BaseController {
 
         String mobile = param.get("mobile") == null ? "" : param.get("mobile").toString();
         String remark = param.get("remark") == null ? "" : param.get("remark").toString();
-        Integer amount = param.get("remark") == null ? 0 : Integer.parseInt(param.get("amount").toString());
+        Integer amount = param.get("amount") == null ? 0 : Integer.parseInt(param.get("amount").toString());
 
         try {
             boolean result = pointService.doGift(mtUser.getId(), mobile, amount, remark);

+ 1 - 0
fuint-application/src/main/java/com/fuint/module/clientApi/controller/ClientSignController.java

@@ -217,6 +217,7 @@ public class ClientSignController extends BaseController {
         MtUser mtUser = new MtUser();
         mtUser.setName(account);
         mtUser.setPassword(password);
+        mtUser.setMerchantId(merchantId);
         mtUser.setStoreId(storeId);
         mtUser.setSex(GenderEnum.MAN.getKey());
         mtUser.setMobile("");

+ 54 - 0
fuint-repository/src/main/java/com/fuint/repository/bean/GoodsTopBean.java

@@ -0,0 +1,54 @@
+package com.fuint.repository.bean;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 商品排行对象
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Getter
+@Setter
+@ApiModel(value = "商品排行对象", description = "商品排行对象")
+public class GoodsTopBean implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 商品ID
+     */
+    @ApiModelProperty("商品ID")
+    private Integer id;
+
+    /**
+     * 商品名称
+     */
+    @ApiModelProperty("商品名称")
+    private String name;
+
+    /**
+     * 商品条码
+     */
+    @ApiModelProperty("商品条码")
+    private String goodsNo;
+
+    /**
+     * 销售金额
+     */
+    @ApiModelProperty("销售金额")
+    private BigDecimal amount;
+
+    /**
+     * 销售数量
+     */
+    @ApiModelProperty("销售数量")
+    private Integer num;
+
+}

+ 52 - 0
fuint-repository/src/main/java/com/fuint/repository/bean/MemberTopBean.java

@@ -0,0 +1,52 @@
+package com.fuint.repository.bean;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Getter;
+import lombok.Setter;
+
+/**
+ * 会员排行对象
+ *
+ * Created by FSQ
+ * CopyRight https://www.fuint.cn
+ */
+@Getter
+@Setter
+@ApiModel(value = "会员排行对象", description = "会员排行对象")
+public class MemberTopBean implements Serializable {
+
+    private static final long serialVersionUID = 1L;
+
+    /**
+     * 会员ID
+     */
+    @ApiModelProperty("卡券ID")
+    private Integer id;
+
+    /**
+     * 会员名称
+     */
+    @ApiModelProperty("卡券ID")
+    private String name;
+
+    /**
+     * 会员号
+     */
+    @ApiModelProperty("卡券ID")
+    private String userNo;
+
+    /**
+     * 消费金额
+     */
+    @ApiModelProperty("卡券ID")
+    private BigDecimal amount;
+
+    /**
+     * 购买数量
+     */
+    private Integer num;
+
+}

+ 5 - 0
fuint-repository/src/main/java/com/fuint/repository/mapper/MtGoodsMapper.java

@@ -1,9 +1,12 @@
 package com.fuint.repository.mapper;
 
 import com.fuint.repository.bean.GoodsBean;
+import com.fuint.repository.bean.GoodsTopBean;
 import com.fuint.repository.model.MtGoods;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
+
+import java.util.Date;
 import java.util.List;
 
 /**
@@ -24,4 +27,6 @@ public interface MtGoodsMapper extends BaseMapper<MtGoods> {
 
     List<GoodsBean> selectGoodsList(@Param("merchantId") Integer merchantId, @Param("storeId") Integer storeId, @Param("cateId") Integer cateId, @Param("keyword") String keyword);
 
+    List<GoodsTopBean> getGoodsSaleTopList(@Param("merchantId") Integer merchantId, @Param("storeId") Integer storeId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
+
 }

+ 3 - 0
fuint-repository/src/main/java/com/fuint/repository/mapper/MtUserMapper.java

@@ -1,5 +1,6 @@
 package com.fuint.repository.mapper;
 
+import com.fuint.repository.bean.MemberTopBean;
 import com.fuint.repository.model.MtUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
@@ -33,4 +34,6 @@ public interface MtUserMapper extends BaseMapper<MtUser> {
     Long getUserCountByTime(@Param("merchantId") Integer merchantId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     Long getStoreUserCountByTime(@Param("storeId") Integer storeId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+
+    List<MemberTopBean> getMemberConsumeTopList(@Param("merchantId") Integer merchantId, @Param("storeId") Integer storeId, @Param("startTime") Date startTime, @Param("endTime") Date endTime);
 }

+ 17 - 0
fuint-repository/src/main/resources/mapper/MtGoodsMapper.xml

@@ -45,4 +45,21 @@
         </if>
         ORDER BY g.`SORT` ASC
     </select>
+
+    <select id="getGoodsSaleTopList" resultType="com.fuint.repository.bean.GoodsTopBean">
+        SELECT g.id AS ID,g.name AS NAME,g.GOODS_NO,SUM(o.`NUM`) AS num, SUM(o.price) as amount FROM `mt_goods` g,`mt_order_goods` o WHERE g.`ID` = o.`GOODS_ID`
+        <if test="merchantId != null and merchantId > 0">
+            AND g.MERCHANT_ID = #{merchantId}
+        </if>
+        <if test="storeId != null and storeId > 0">
+            AND g.STORE_ID = #{storeId}
+        </if>
+        <if test="startTime != null">
+            AND o.CREATE_TIME &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND o.CREATE_TIME &lt;= #{endTime}
+        </if>
+        GROUP BY g.`ID` ORDER BY SUM(o.`NUM`) DESC LIMIT 10
+    </select>
 </mapper>

+ 17 - 0
fuint-repository/src/main/resources/mapper/MtUserMapper.xml

@@ -61,4 +61,21 @@
         select count(*) from mt_user t where t.STORE_ID = #{storeId} and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS != 'D'
     </select>
 
+    <select id="getMemberConsumeTopList" resultType="com.fuint.repository.bean.MemberTopBean">
+        SELECT u.id AS ID,u.name AS NAME,u.`USER_NO`,SUM(o.`AMOUNT`) AS amount FROM `mt_user` u,`mt_order` o WHERE u.`ID` = o.`USER_ID` AND o.PAY_STATUS = 'B'
+        <if test="merchantId != null and merchantId > 0">
+            AND u.MERCHANT_ID = #{merchantId}
+        </if>
+        <if test="storeId != null and storeId > 0">
+            AND u.STORE_ID = #{storeId}
+        </if>
+        <if test="startTime != null">
+            AND o.CREATE_TIME &gt;= #{startTime}
+        </if>
+        <if test="endTime != null">
+            AND o.CREATE_TIME &lt;= #{endTime}
+        </if>
+        GROUP BY u.`ID` ORDER BY SUM(o.`AMOUNT`) DESC LIMIT 10
+    </select>
+
 </mapper>