فهرست منبع

fixed 报表统计优化、日志查询优化

fushengqian 1 سال پیش
والد
کامیت
35fef20dbe
25فایلهای تغییر یافته به همراه121 افزوده شده و 73 حذف شده
  1. 6 0
      fuint-application/src/main/java/com/fuint/common/aspect/TActionLogAop.java
  2. 1 1
      fuint-application/src/main/java/com/fuint/common/service/ConfirmLogService.java
  3. 3 3
      fuint-application/src/main/java/com/fuint/common/service/MemberService.java
  4. 5 6
      fuint-application/src/main/java/com/fuint/common/service/OrderService.java
  5. 8 2
      fuint-application/src/main/java/com/fuint/common/service/impl/ActionLogServiceImpl.java
  6. 2 2
      fuint-application/src/main/java/com/fuint/common/service/impl/ConfirmLogServiceImpl.java
  7. 8 7
      fuint-application/src/main/java/com/fuint/common/service/impl/MemberServiceImpl.java
  8. 10 10
      fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java
  9. 5 0
      fuint-application/src/main/java/com/fuint/common/service/impl/UserGradeServiceImpl.java
  10. 2 2
      fuint-application/src/main/java/com/fuint/common/util/TokenUtil.java
  11. 6 0
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendActionLogController.java
  12. 13 11
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendHomeController.java
  13. 1 1
      fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendUserCouponController.java
  14. 5 5
      fuint-application/src/main/java/com/fuint/module/merchantApi/controller/MerchantController.java
  15. 1 1
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtConfirmLogMapper.java
  16. 5 6
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtOrderMapper.java
  17. 1 1
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtUserActionMapper.java
  18. 2 3
      fuint-repository/src/main/java/com/fuint/repository/mapper/MtUserMapper.java
  19. 0 1
      fuint-repository/src/main/java/com/fuint/repository/model/MtUserGrade.java
  20. 6 0
      fuint-repository/src/main/java/com/fuint/repository/model/TActionLog.java
  21. 8 2
      fuint-repository/src/main/resources/mapper/MtConfirmLogMapper.xml
  22. 12 0
      fuint-repository/src/main/resources/mapper/MtOrderMapper.xml
  23. 2 9
      fuint-repository/src/main/resources/mapper/MtSettingMapper.xml
  24. 3 0
      fuint-repository/src/main/resources/mapper/MtUserActionMapper.xml
  25. 6 0
      fuint-repository/src/main/resources/mapper/MtUserMapper.xml

+ 6 - 0
fuint-application/src/main/java/com/fuint/common/aspect/TActionLogAop.java

@@ -38,6 +38,8 @@ public class TActionLogAop {
     private ActionLogService tActionLogService;
 
     private String userName = ""; // 用户名
+    private Integer merchantId = 0; // 商户ID
+    private Integer storeId = 0; // 店铺ID
     private Long startTimeMillis = 0l; // 开始时间
     private Long endTimeMillis = 0l; // 结束时间
     private String clientIp = "";
@@ -84,6 +86,8 @@ public class TActionLogAop {
             if (StringUtils.isNotEmpty(token)) {
                 AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
                 userName = accountInfo.getAccountName();
+                merchantId = accountInfo.getMerchantId() == null ? 0 : accountInfo.getMerchantId();
+                storeId = accountInfo.getStoreId() == null ? 0 : accountInfo.getStoreId();
             }
             this.printOptLog();
         } catch (Exception e) {
@@ -110,6 +114,8 @@ public class TActionLogAop {
         hal.setUrl(url);
         hal.setTimeConsuming(new BigDecimal(endTimeMillis - startTimeMillis));
         hal.setUserAgent(userAgent);
+        hal.setMerchantId(merchantId);
+        hal.setStoreId(storeId);
         if (StringUtils.isNotEmpty(module) && userName != null && StringUtils.isNotEmpty(userName)) {
             this.tActionLogService.saveActionLog(hal);
         }

+ 1 - 1
fuint-application/src/main/java/com/fuint/common/service/ConfirmLogService.java

@@ -43,5 +43,5 @@ public interface ConfirmLogService extends IService<MtConfirmLog> {
     /**
      * 获取核销总数
      * */
-    Long getConfirmCount(Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
+    Long getConfirmCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
 }

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

@@ -137,17 +137,17 @@ public interface MemberService extends IService<MtUser> {
     /**
      * 获取会员数量
      * */
-    Long getUserCount(Integer storeId) throws BusinessCheckException;
+    Long getUserCount(Integer merchantId, Integer storeId) throws BusinessCheckException;
 
     /**
      * 获取会员数量
      * */
-    Long getUserCount(Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
+    Long getUserCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
 
     /**
      * 获取活跃会员数量
      * */
-    Long getActiveUserCount(Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
+    Long getActiveUserCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
 
     /**
      * 重置手机号

+ 5 - 6
fuint-application/src/main/java/com/fuint/common/service/OrderService.java

@@ -8,7 +8,6 @@ import com.fuint.framework.exception.BusinessCheckException;
 import com.fuint.framework.web.ResponseObject;
 import com.fuint.repository.model.MtCart;
 import com.fuint.repository.model.MtOrder;
-
 import java.math.BigDecimal;
 import java.util.Date;
 import java.util.List;
@@ -116,12 +115,12 @@ public interface OrderService extends IService<MtOrder> {
     /**
      * 获取订单总数
      * */
-    BigDecimal getOrderCount(Integer storeId) throws BusinessCheckException;
+    BigDecimal getOrderCount(Integer merchantId, Integer storeId) throws BusinessCheckException;
 
     /**
      * 获取订单数量
      * */
-    BigDecimal getOrderCount(Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
+    BigDecimal getOrderCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
 
     /**
      * 计算购物车
@@ -131,17 +130,17 @@ public interface OrderService extends IService<MtOrder> {
     /**
      * 获取支付金额
      * */
-    BigDecimal getPayMoney(Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
+    BigDecimal getPayMoney(Integer merchantId, Integer storeId, Date beginTime, Date endTime) throws BusinessCheckException;
 
     /**
      * 获取支付人数
      * */
-    Integer getPayUserCount(Integer storeId) throws BusinessCheckException;
+    Integer getPayUserCount(Integer merchantId, Integer storeId) throws BusinessCheckException;
 
     /**
      * 获取支付金额
      * */
-    BigDecimal getPayMoney(Integer storeId) throws BusinessCheckException;
+    BigDecimal getPayMoney(Integer merchantId, Integer storeId) throws BusinessCheckException;
 
     /**
      * 获取会员支付金额

+ 8 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/ActionLogServiceImpl.java

@@ -14,7 +14,6 @@ import org.apache.commons.lang.StringUtils;
 import org.springframework.data.domain.PageImpl;
 import org.springframework.data.domain.PageRequest;
 import org.springframework.stereotype.Service;
-
 import javax.annotation.Resource;
 import java.util.List;
 
@@ -37,7 +36,14 @@ public class ActionLogServiceImpl extends ServiceImpl<TActionLogMapper, TActionL
     public PaginationResponse<TActionLog> findLogsByPagination(PaginationRequest paginationRequest) {
         Page<TActionLog> pageHelper = PageHelper.startPage(paginationRequest.getCurrentPage(), paginationRequest.getPageSize());
         LambdaQueryWrapper<TActionLog> lambdaQueryWrapper = Wrappers.lambdaQuery();
-
+        String merchantId = paginationRequest.getSearchParams().get("merchantId") == null ? "" : paginationRequest.getSearchParams().get("merchantId").toString();
+        if (StringUtils.isNotBlank(merchantId)) {
+            lambdaQueryWrapper.eq(TActionLog::getMerchantId, merchantId);
+        }
+        String storeId = paginationRequest.getSearchParams().get("storeId") == null ? "" : paginationRequest.getSearchParams().get("storeId").toString();
+        if (StringUtils.isNotBlank(merchantId)) {
+            lambdaQueryWrapper.eq(TActionLog::getStoreId, storeId);
+        }
         String module = paginationRequest.getSearchParams().get("module") == null ? "" : paginationRequest.getSearchParams().get("module").toString();
         if (StringUtils.isNotBlank(module)) {
             lambdaQueryWrapper.like(TActionLog::getModule, module);

+ 2 - 2
fuint-application/src/main/java/com/fuint/common/service/impl/ConfirmLogServiceImpl.java

@@ -151,7 +151,7 @@ public class ConfirmLogServiceImpl extends ServiceImpl<MtConfirmLogMapper, MtCon
      * @return
      * */
     @Override
-    public Long getConfirmCount(Integer storeId, Date beginTime, Date endTime) {
-        return mtConfirmLogMapper.getConfirmLogCount(beginTime, endTime);
+    public Long getConfirmCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
+        return mtConfirmLogMapper.getConfirmLogCount(merchantId, storeId, beginTime, endTime);
     }
 }

+ 8 - 7
fuint-application/src/main/java/com/fuint/common/service/impl/MemberServiceImpl.java

@@ -281,7 +281,8 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
                 }
             }
             if (userDto.getGradeId() != null) {
-                MtUserGrade mtGrade = userGradeService.queryUserGradeById(Integer.parseInt(merchantId), Integer.parseInt(userDto.getGradeId()), user.getId());
+                Integer mchId = StringUtil.isNotEmpty(merchantId) ? Integer.parseInt(merchantId) : 0;
+                MtUserGrade mtGrade = userGradeService.queryUserGradeById(mchId, Integer.parseInt(userDto.getGradeId()), user.getId());
                 if (mtGrade != null) {
                     userDto.setGradeName(mtGrade.getName());
                 }
@@ -725,11 +726,11 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
      * 获取会员数量
      * */
     @Override
-    public Long getUserCount(Integer storeId) {
+    public Long getUserCount(Integer merchantId, Integer storeId) {
         if (storeId > 0) {
             return mtUserMapper.getStoreUserCount(storeId);
         } else {
-            return mtUserMapper.getUserCount();
+            return mtUserMapper.getUserCount(merchantId);
         }
     }
 
@@ -737,11 +738,11 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
      * 获取会员数量
      * */
     @Override
-    public Long getUserCount(Integer storeId, Date beginTime, Date endTime) {
+    public Long getUserCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
         if (storeId > 0) {
             return mtUserMapper.getStoreUserCountByTime(storeId, beginTime, endTime);
         } else {
-            return mtUserMapper.getUserCountByTime(beginTime, endTime);
+            return mtUserMapper.getUserCountByTime(merchantId, beginTime, endTime);
         }
     }
 
@@ -749,11 +750,11 @@ public class MemberServiceImpl extends ServiceImpl<MtUserMapper, MtUser> impleme
      * 获取会员数量
      * */
     @Override
-    public Long getActiveUserCount(Integer storeId, Date beginTime, Date endTime) {
+    public Long getActiveUserCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
         if (storeId > 0) {
             return mtUserActionMapper.getStoreActiveUserCount(storeId, beginTime, endTime);
         } else {
-            return mtUserActionMapper.getActiveUserCount(beginTime, endTime);
+            return mtUserActionMapper.getActiveUserCount(merchantId, beginTime, endTime);
         }
     }
 

+ 10 - 10
fuint-application/src/main/java/com/fuint/common/service/impl/OrderServiceImpl.java

@@ -1116,11 +1116,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * 获取订单数量
      * */
     @Override
-    public BigDecimal getOrderCount(Integer storeId) {
+    public BigDecimal getOrderCount(Integer merchantId, Integer storeId) {
         if (storeId > 0) {
             return mtOrderMapper.getStoreOrderCount(storeId);
         } else {
-            return mtOrderMapper.getOrderCount();
+            return mtOrderMapper.getOrderCount(merchantId);
         }
     }
 
@@ -1128,11 +1128,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * 获取订单数量
      * */
     @Override
-    public BigDecimal getOrderCount(Integer storeId, Date beginTime, Date endTime) {
+    public BigDecimal getOrderCount(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
         if (storeId > 0) {
             return mtOrderMapper.getStoreOrderCountByTime(storeId, beginTime, endTime);
         } else {
-            return mtOrderMapper.getOrderCountByTime(beginTime, endTime);
+            return mtOrderMapper.getOrderCountByTime(merchantId, beginTime, endTime);
         }
     }
 
@@ -1140,11 +1140,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * 获取支付金额
      * */
     @Override
-    public BigDecimal getPayMoney(Integer storeId, Date beginTime, Date endTime) {
+    public BigDecimal getPayMoney(Integer merchantId, Integer storeId, Date beginTime, Date endTime) {
         if (storeId > 0) {
             return mtOrderMapper.getStorePayMoneyByTime(storeId, beginTime, endTime);
         } else {
-            return mtOrderMapper.getPayMoneyByTime(beginTime, endTime);
+            return mtOrderMapper.getPayMoneyByTime(merchantId, beginTime, endTime);
         }
     }
 
@@ -1152,11 +1152,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * 获取支付人数
      * */
     @Override
-    public Integer getPayUserCount(Integer storeId) {
+    public Integer getPayUserCount(Integer merchantId, Integer storeId) {
         if (storeId > 0) {
             return mtOrderMapper.getStorePayUserCount(storeId);
         } else {
-            return mtOrderMapper.getPayUserCount();
+            return mtOrderMapper.getPayUserCount(merchantId);
         }
     }
 
@@ -1164,11 +1164,11 @@ public class OrderServiceImpl extends ServiceImpl<MtOrderMapper, MtOrder> implem
      * 获取支付总金额
      * */
     @Override
-    public BigDecimal getPayMoney(Integer storeId) {
+    public BigDecimal getPayMoney(Integer merchantId, Integer storeId) {
         if (storeId > 0) {
             return mtOrderMapper.getStorePayMoney(storeId);
         } else {
-            return mtOrderMapper.getPayMoney();
+            return mtOrderMapper.getPayMoney(merchantId);
         }
     }
 

+ 5 - 0
fuint-application/src/main/java/com/fuint/common/service/impl/UserGradeServiceImpl.java

@@ -193,6 +193,11 @@ public class UserGradeServiceImpl extends ServiceImpl<MtUserGradeMapper, MtUserG
         } else {
             initGrade = new MtUserGrade();
             initGrade.setId(0);
+            initGrade.setStatus(StatusEnum.ENABLED.getKey());
+            initGrade.setGrade(0);
+            initGrade.setMerchantId(0);
+            initGrade.setSpeedPoint(1f);
+            initGrade.setDiscount(0f);
         }
         return initGrade;
     }

+ 2 - 2
fuint-application/src/main/java/com/fuint/common/util/TokenUtil.java

@@ -42,8 +42,8 @@ public class TokenUtil {
         token.append(new SimpleDateFormat("yyyyMMddHHmmssSSS").format(new Date()) + "_");
         token.append(new Random().nextInt((999999 - 111111 + 1)) + 111111);
 
-        String result = MD5Util.getMD5(token.toString());
-        return result;
+        String tokenStr = MD5Util.getMD5(token.toString()).replace("+", "1").replaceAll("&", "8");
+        return tokenStr;
     }
 
     /**

+ 6 - 0
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendActionLogController.java

@@ -76,6 +76,12 @@ public class BackendActionLogController extends BaseController {
         if (StringUtil.isNotEmpty(ip)) {
             searchParams.put("ip", ip);
         }
+        if (accountInfo.getMerchantId() != null && accountInfo.getMerchantId() > 0) {
+            searchParams.put("merchantId", accountInfo.getMerchantId());
+        }
+        if (accountInfo.getStoreId() != null && accountInfo.getStoreId() > 0) {
+            searchParams.put("storeId", accountInfo.getStoreId());
+        }
 
         paginationRequest.setSearchParams(searchParams);
         paginationRequest.setSortColumn(new String[]{"actionTime desc"});

+ 13 - 11
fuint-application/src/main/java/com/fuint/module/backendApi/controller/BackendHomeController.java

@@ -62,28 +62,29 @@ public class BackendHomeController extends BaseController {
             return getFailureResult(1001, "请先登录");
         }
 
+        Integer merchantId = accountInfo.getMerchantId();
         Integer storeId = accountInfo.getStoreId();
 
         // 总会员数
-        Long totalUser = memberService.getUserCount(storeId);
+        Long totalUser = memberService.getUserCount(merchantId, storeId);
         // 今日新增会员数量
-        Long todayUser = memberService.getUserCount(storeId, beginTime, endTime);
+        Long todayUser = memberService.getUserCount(merchantId, storeId, beginTime, endTime);
 
         // 总订单数
-        BigDecimal totalOrder = orderService.getOrderCount(storeId);
+        BigDecimal totalOrder = orderService.getOrderCount(merchantId, storeId);
         // 今日订单数
-        BigDecimal todayOrder = orderService.getOrderCount(storeId, beginTime, endTime);
+        BigDecimal todayOrder = orderService.getOrderCount(merchantId, storeId, beginTime, endTime);
 
         // 今日交易金额
-        BigDecimal todayPay = orderService.getPayMoney(storeId, beginTime, endTime);
+        BigDecimal todayPay = orderService.getPayMoney(merchantId, storeId, beginTime, endTime);
         // 总交易金额
-        BigDecimal totalPay = orderService.getPayMoney(storeId);
+        BigDecimal totalPay = orderService.getPayMoney(merchantId, storeId);
 
         // 今日活跃会员数
-        Long todayActiveUser = memberService.getActiveUserCount(storeId, beginTime, endTime);
+        Long todayActiveUser = memberService.getActiveUserCount(merchantId, storeId, beginTime, endTime);
 
         // 总支付人数
-        Integer totalPayUser = orderService.getPayUserCount(storeId);
+        Integer totalPayUser = orderService.getPayUserCount(merchantId, storeId);
 
         Map<String, Object> result = new HashMap<>();
 
@@ -118,6 +119,7 @@ public class BackendHomeController extends BaseController {
         }
 
         TAccount account = accountService.getAccountInfoById(accountInfo.getId());
+        Integer merchantId = account.getMerchantId() == null ? 0 : account.getMerchantId();
         Integer storeId = account.getStoreId() == null ? 0 : account.getStoreId();
 
         ArrayList<String> days = TimeUtils.getDays(5);
@@ -130,7 +132,7 @@ public class BackendHomeController extends BaseController {
             for (int i = 0; i < 7; i++) {
                 Date beginTime = DateUtil.getDayBegin((6 - i));
                 Date endTime = DateUtil.getDayEnd((6 - i));
-                BigDecimal payMoney = orderService.getPayMoney(storeId, beginTime, endTime);
+                BigDecimal payMoney = orderService.getPayMoney(merchantId, storeId, beginTime, endTime);
                 orderPayData[i] = payMoney == null ? new BigDecimal("0") : payMoney;
             }
             BigDecimal data[][] = { orderPayData };
@@ -142,8 +144,8 @@ public class BackendHomeController extends BaseController {
             for (int i = 0; i < 7; i++) {
                 Date beginTime = DateUtil.getDayBegin((6 - i));
                 Date endTime = DateUtil.getDayEnd((6 - i));
-                orderCountData[i] = orderService.getOrderCount(storeId, beginTime, endTime);
-                Long userCount = memberService.getActiveUserCount(storeId, beginTime, endTime);
+                orderCountData[i] = orderService.getOrderCount(merchantId, storeId, beginTime, endTime);
+                Long userCount = memberService.getActiveUserCount(merchantId, storeId, beginTime, endTime);
                 userCountData[i] = new BigDecimal(userCount);
             }
             BigDecimal data[][] = { orderCountData, userCountData };

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

@@ -257,7 +257,7 @@ public class BackendUserCouponController extends BaseController {
 
         AccountInfo accountInfo = TokenUtil.getAccountInfoByToken(token);
         if (accountInfo == null) {
-            logger.error("导出会员卡券失败:token = ", token);
+            logger.error("导出会员卡券失败:token = {}", token);
             return;
         }
 

+ 5 - 5
fuint-application/src/main/java/com/fuint/module/merchantApi/controller/MerchantController.java

@@ -74,23 +74,23 @@ public class MerchantController extends BaseController {
         // 收款额
         Date beginTime = DateUtil.getDayBegin();
         Date endTime = DateUtil.getDayEnd();
-        BigDecimal payMoney = orderService.getPayMoney(staffInfo.getStoreId(), beginTime, endTime);
+        BigDecimal payMoney = orderService.getPayMoney(staffInfo.getMerchantId(), staffInfo.getStoreId(), beginTime, endTime);
         outParams.put("payMoney", payMoney);
 
         // 总会员数
-        Long userCount = memberService.getUserCount(staffInfo.getStoreId());
+        Long userCount = memberService.getUserCount(staffInfo.getMerchantId(), staffInfo.getStoreId());
         outParams.put("userCount", userCount);
 
         // 今日订单数
-        BigDecimal orderCount = orderService.getOrderCount(staffInfo.getStoreId(), beginTime, endTime);
+        BigDecimal orderCount = orderService.getOrderCount(staffInfo.getMerchantId(), staffInfo.getStoreId(), beginTime, endTime);
         outParams.put("orderCount", orderCount);
 
         // 核销券数
-        Long confirmCount = confirmLogService.getConfirmCount(staffInfo.getStoreId(), beginTime, endTime);
+        Long confirmCount = confirmLogService.getConfirmCount(staffInfo.getMerchantId(), staffInfo.getStoreId(), beginTime, endTime);
         outParams.put("couponCount", confirmCount);
 
         // 今日活跃会员数
-        Long todayUser = memberService.getActiveUserCount(staffInfo.getStoreId(), beginTime, endTime);
+        Long todayUser = memberService.getActiveUserCount(staffInfo.getMerchantId(), staffInfo.getStoreId(), beginTime, endTime);
         outParams.put("todayUser", todayUser);
 
         return getSuccessResult(outParams);

+ 1 - 1
fuint-repository/src/main/java/com/fuint/repository/mapper/MtConfirmLogMapper.java

@@ -16,7 +16,7 @@ public interface MtConfirmLogMapper extends BaseMapper<MtConfirmLog> {
 
     Long getConfirmNum(@Param("userCouponId") Integer userCouponId);
 
-    Long getConfirmLogCount(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+    Long getConfirmLogCount(@Param("userCouponId") Integer merchantId, @Param("userCouponId") Integer storeId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     List<MtConfirmLog> getOrderConfirmLogList(@Param("orderId") Integer orderId);
 

+ 5 - 6
fuint-repository/src/main/java/com/fuint/repository/mapper/MtOrderMapper.java

@@ -3,7 +3,6 @@ package com.fuint.repository.mapper;
 import com.fuint.repository.model.MtOrder;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
-
 import java.math.BigDecimal;
 import java.util.Date;
 
@@ -15,25 +14,25 @@ import java.util.Date;
  */
 public interface MtOrderMapper extends BaseMapper<MtOrder> {
 
-    BigDecimal getOrderCount();
+    BigDecimal getOrderCount(@Param("merchantId") Integer merchantId);
 
     BigDecimal getStoreOrderCount(@Param("storeId") Integer storeId);
 
-    BigDecimal getOrderCountByTime(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+    BigDecimal getOrderCountByTime(@Param("merchantId") Integer merchantId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     BigDecimal getStoreOrderCountByTime(@Param("storeId") Integer storeId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     MtOrder findByOrderSn(@Param("orderSn") String orderSn);
 
-    BigDecimal getPayMoney();
+    BigDecimal getPayMoney(@Param("merchantId") Integer merchantId);
 
-    BigDecimal getPayMoneyByTime(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+    BigDecimal getPayMoneyByTime(@Param("merchantId") Integer merchantId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     BigDecimal getStorePayMoneyByTime(@Param("storeId") Integer storeId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     BigDecimal getStorePayMoney(@Param("storeId") Integer storeId);
 
-    Integer getPayUserCount();
+    Integer getPayUserCount(@Param("merchantId") Integer merchantId);
 
     Integer getStorePayUserCount(@Param("storeId") Integer storeId);
 

+ 1 - 1
fuint-repository/src/main/java/com/fuint/repository/mapper/MtUserActionMapper.java

@@ -14,7 +14,7 @@ import java.util.Date;
  */
 public interface MtUserActionMapper extends BaseMapper<MtUserAction> {
 
-    Long getActiveUserCount(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+    Long getActiveUserCount(@Param("merchantId") Integer merchantId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 
     Long getStoreActiveUserCount(@Param("storeId") Integer storeId, @Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
 

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

@@ -3,7 +3,6 @@ package com.fuint.repository.mapper;
 import com.fuint.repository.model.MtUser;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Param;
-
 import java.util.Date;
 import java.util.List;
 
@@ -27,11 +26,11 @@ public interface MtUserMapper extends BaseMapper<MtUser> {
 
     void resetMobile(@Param("mobile") String mobile, @Param("userId") Integer userId);
 
-    Long getUserCount();
+    Long getUserCount(@Param("merchantId") Integer merchantId);
 
     Long getStoreUserCount(@Param("storeId") Integer storeId);
 
-    Long getUserCountByTime(@Param("beginTime") Date beginTime, @Param("endTime") Date endTime);
+    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);
 }

+ 0 - 1
fuint-repository/src/main/java/com/fuint/repository/model/MtUserGrade.java

@@ -61,5 +61,4 @@ public class MtUserGrade implements Serializable {
     @ApiModelProperty("状态")
     private String status;
 
-
 }

+ 6 - 0
fuint-repository/src/main/java/com/fuint/repository/model/TActionLog.java

@@ -29,6 +29,12 @@ public class TActionLog implements Serializable {
     @TableId(value = "id", type = IdType.AUTO)
     private Integer id;
 
+    @ApiModelProperty("商户ID")
+    private Integer merchantId;
+
+    @ApiModelProperty("所属店铺ID")
+    private Integer storeId;
+
     @ApiModelProperty("操作时间")
     private Date actionTime;
 

+ 8 - 2
fuint-repository/src/main/resources/mapper/MtConfirmLogMapper.xml

@@ -6,8 +6,14 @@
     </select>
 
     <select id="getConfirmLogCount" resultType="long">
-        SELECT COUNT(0) FROM mt_confirm_log
-        where CREATE_TIME &gt; #{beginTime} and CREATE_TIME &lt;= #{endTime} and status = 'A'
+        SELECT COUNT(0) FROM mt_confirm_log t
+        WHERE t.CREATE_TIME &gt; #{beginTime} and t.CREATE_TIME &lt;= #{endTime} and t.status = 'A'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
+        <if test="storeId != null and storeId > 0">
+            AND t.STORE_ID = #{storeId}
+        </if>
     </select>
 
     <select id="getOrderConfirmLogList" resultType="com.fuint.repository.model.MtConfirmLog">

+ 12 - 0
fuint-repository/src/main/resources/mapper/MtOrderMapper.xml

@@ -3,6 +3,9 @@
 <mapper namespace="com.fuint.repository.mapper.MtOrderMapper">
     <select id="getOrderCount" resultType="java.math.BigDecimal">
         select count(*) from mt_order t where t.STATUS != 'G'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStoreOrderCount" resultType="java.math.BigDecimal">
@@ -11,6 +14,9 @@
 
     <select id="getOrderCountByTime" resultType="java.math.BigDecimal">
         select count(0) from mt_order t where t.CREATE_TIME &gt;= #{beginTime} and t.CREATE_TIME &lt; #{endTime} and t.STATUS != 'G'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStoreOrderCountByTime" resultType="java.math.BigDecimal">
@@ -23,10 +29,16 @@
 
     <select id="getPayMoney" resultType="java.math.BigDecimal">
         SELECT sum(t.AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.STATUS != 'G'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getPayMoneyByTime" resultType="java.math.BigDecimal">
         SELECT sum(t.AMOUNT) as num FROM mt_order t where t.PAY_STATUS='B' and t.CREATE_TIME &lt; #{endTime} and t.CREATE_TIME &gt;= #{beginTime} and t.STATUS != 'G'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStorePayMoneyByTime" resultType="java.math.BigDecimal">

+ 2 - 9
fuint-repository/src/main/resources/mapper/MtSettingMapper.xml

@@ -2,17 +2,10 @@
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.fuint.repository.mapper.MtSettingMapper">
     <select id="querySettingByType" resultType="com.fuint.repository.model.MtSetting">
-        select * from mt_setting t where t.TYPE = #{type}
-        <if test="merchantId != null and merchantId > 0">
-            and (t.MERCHANT_ID = #{merchantId} or t.MERCHANT_ID = 0)
-        </if>
+        select * from mt_setting t where t.TYPE = #{type} and t.MERCHANT_ID = #{merchantId}
     </select>
 
     <select id="querySettingByName" resultType="com.fuint.repository.model.MtSetting">
-        select * from mt_setting t where t.NAME = #{name}
-        <if test="merchantId != null and merchantId > 0">
-            and (t.MERCHANT_ID = #{merchantId} or t.MERCHANT_ID = 0)
-        </if>
-        limit 1
+        select * from mt_setting t where t.NAME = #{name} and t.MERCHANT_ID = #{merchantId} limit 1
     </select>
 </mapper>

+ 3 - 0
fuint-repository/src/main/resources/mapper/MtUserActionMapper.xml

@@ -3,6 +3,9 @@
 <mapper namespace="com.fuint.repository.mapper.MtUserActionMapper">
     <select id="getActiveUserCount" resultType="java.lang.Long">
         SELECT count(DISTINCT t.USER_ID) as num FROM mt_user_action t where t.STATUS='A' and t.UPDATE_TIME &lt;= #{endTime} and t.UPDATE_TIME &gt;= #{beginTime}
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStoreActiveUserCount" resultType="java.lang.Long">

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

@@ -37,6 +37,9 @@
 
     <select id="getUserCount" resultType="java.lang.Long">
         select count(*) from mt_user t where t.STATUS != 'D'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStoreUserCount" resultType="java.lang.Long">
@@ -45,6 +48,9 @@
 
     <select id="getUserCountByTime" resultType="java.lang.Long">
         select count(*) from mt_user t where t.CREATE_TIME &gt;= #{beginTime} and t.CREATE_TIME &lt; #{endTime} and t.STATUS != 'D'
+        <if test="merchantId != null and merchantId > 0">
+            AND t.MERCHANT_ID = #{merchantId}
+        </if>
     </select>
 
     <select id="getStoreUserCountByTime" resultType="java.lang.Long">