Sfoglia il codice sorgente

处理流量统计功能优化

yjwang 1 mese fa
parent
commit
adfee69c48

+ 8 - 0
fs-service/src/main/java/com/fs/hisStore/mapper/FsStorePaymentScrmMapper.java

@@ -10,6 +10,7 @@ import com.fs.hisStore.param.FsStoreScanPaymentStatParam;
 import com.fs.hisStore.param.FsStoreStatisticsParam;
 import com.fs.hisStore.vo.FsStorePaymentStatisticsVO;
 import com.fs.hisStore.vo.FsStorePaymentVO;
+import com.fs.hisStore.vo.FsStoreScanPaymentStatDetailsVo;
 import com.fs.hisStore.vo.FsStoreScanPaymentStatVo;
 import org.apache.ibatis.annotations.Param;
 import org.apache.ibatis.annotations.Select;
@@ -367,6 +368,13 @@ public interface FsStorePaymentScrmMapper
      * **/
     FsStoreScanPaymentStatVo getScanPaymentDayStat(@Param("dayParam")FsStoreScanPaymentStatParam dayParam);
 
+    /**
+     * 销售扫码流水日统计明细
+     * @param dayParam 查询条件
+     * @return 日统计数据
+     * **/
+    List<FsStoreScanPaymentStatDetailsVo> getScanPaymentDayStatDetails(@Param("dayParam")FsStoreScanPaymentStatParam dayParam);
+
     /**
      * 销售流水月统计
      * @param monthParam 查询条件

+ 10 - 1
fs-service/src/main/java/com/fs/hisStore/service/IFsStorePaymentScrmService.java

@@ -9,6 +9,8 @@ import com.fs.hisStore.domain.FsStorePaymentScrm;
 import com.fs.hisStore.param.*;
 import com.fs.hisStore.vo.FsStorePaymentStatisticsVO;
 import com.fs.hisStore.vo.FsStorePaymentVO;
+import com.fs.hisStore.vo.FsStoreScanPaymentStatDetailsVo;
+import com.fs.hisStore.vo.FsStoreScanPaymentStatVo;
 
 import javax.servlet.http.HttpServletRequest;
 
@@ -122,5 +124,12 @@ public interface IFsStorePaymentScrmService
      * @param param 查询语句
      * @return 扫码流水日统计
      * **/
-    R getScanPaymentStat(FsStoreScanPaymentStatParam param);
+    FsStoreScanPaymentStatVo getScanPaymentStat(FsStoreScanPaymentStatParam param);
+
+    /**
+     * 商户扫码统计分页接口
+     * @param param 查询语句
+     * @return 扫码流水日统计
+     * **/
+    List<FsStoreScanPaymentStatDetailsVo> getScanPaymentStatPage(FsStoreScanPaymentStatParam param);
 }

+ 35 - 6
fs-service/src/main/java/com/fs/hisStore/service/impl/FsStorePaymentScrmServiceImpl.java

@@ -17,6 +17,7 @@ import com.fs.common.annotation.DataScope;
 import com.fs.common.config.FSSysConfig;
 import com.fs.common.core.domain.R;
 import com.fs.common.core.redis.RedisCache;
+import com.fs.common.exception.ServiceException;
 import com.fs.common.utils.DateUtils;
 import com.fs.common.utils.StringUtils;
 import com.fs.company.domain.Company;
@@ -38,10 +39,10 @@ import com.fs.his.utils.ConfigUtil;
 import com.fs.hisStore.enums.StatTypeEnum;
 import com.fs.hisStore.enums.SysConfigEnum;
 import com.fs.hisStore.param.*;
+import com.fs.hisStore.vo.FsStoreScanPaymentStatDetailsVo;
 import com.fs.hisStore.vo.FsStoreScanPaymentStatVo;
 import com.fs.huifuPay.domain.HuiFuCreateOrder;
 import com.fs.huifuPay.domain.HuifuCreateOrderResult;
-import com.fs.huifuPay.sdk.opps.core.utils.ObjectUtils;
 import com.fs.huifuPay.service.HuiFuService;
 import com.fs.pay.pay.dto.WxJspayDTO;
 import com.fs.hisStore.vo.FsStorePaymentStatisticsVO;
@@ -64,6 +65,7 @@ import com.github.binarywang.wxpay.exception.WxPayException;
 import com.github.binarywang.wxpay.service.TransferService;
 import com.github.binarywang.wxpay.service.WxPayService;
 import com.github.binarywang.wxpay.service.impl.WxPayServiceImpl;
+import com.github.pagehelper.PageInfo;
 import me.chanjar.weixin.common.error.WxErrorException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -896,10 +898,10 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
     }
 
     @Override
-    public R getScanPaymentStat(FsStoreScanPaymentStatParam param) {
+    public FsStoreScanPaymentStatVo getScanPaymentStat(FsStoreScanPaymentStatParam param) {
         //验证类型是否错误
         if (!StatTypeEnum.isValid(param.getStatType())) {
-            return R.error("操作失败,无效的统计类型!有效类型为:" + StatTypeEnum.getAllValidTypes());
+            throw new ServiceException("操作失败,无效的统计类型!有效类型为:" + StatTypeEnum.getAllValidTypes());
         }
 
         StatTypeEnum statTypeEnum = param.toStatTypeEnum();
@@ -910,20 +912,47 @@ public class FsStorePaymentScrmServiceImpl implements IFsStorePaymentScrmService
                 break;
             case MONTH://月
                 paymentStatVo = fsStorePaymentMapper.getScanPaymentMonthStat(param);
+
                 break;
             case YEAR://年
                 paymentStatVo = fsStorePaymentMapper.getScanPaymentYearStat(param);
                 break;
             case DATE://日期
                 if(StringUtils.isEmpty(param.getStartDate())){
-                    return R.error("操作失败,开始日期不能为空!");
+                    throw new ServiceException("操作失败,开始日期不能为空!");
                 }else if(StringUtils.isEmpty(param.getEndDate())){
-                    return R.error("操作失败,结日期不能为空!");
+                    throw new ServiceException("操作失败,结日期不能为空!");
                 }
                 paymentStatVo = fsStorePaymentMapper.getScanPaymentDateStat(param);
                 break;
         }
 
-        return R.ok("操作成功!").put("data", paymentStatVo);
+        return paymentStatVo;
+    }
+
+    @Override
+    public List<FsStoreScanPaymentStatDetailsVo> getScanPaymentStatPage(FsStoreScanPaymentStatParam param) {
+        StatTypeEnum statTypeEnum = param.toStatTypeEnum();
+        List<FsStoreScanPaymentStatDetailsVo> paymentStatDetailsVos = null;
+        switch (statTypeEnum) {
+            case DAY://日
+                paymentStatDetailsVos = fsStorePaymentMapper.getScanPaymentDayStatDetails(param);
+                break;
+            case MONTH://月
+
+                break;
+            case YEAR://年
+
+                break;
+            case DATE://日期
+                if(StringUtils.isEmpty(param.getStartDate())){
+                    throw new ServiceException("操作失败,开始日期不能为空!");
+                }else if(StringUtils.isEmpty(param.getEndDate())){
+                    throw new ServiceException("操作失败,结日期不能为空!");
+                }
+
+                break;
+        }
+        return paymentStatDetailsVos;
     }
 }

+ 18 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreScanPaymentStatDetailsVo.java

@@ -0,0 +1,18 @@
+package com.fs.hisStore.vo;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.math.BigDecimal;
+
+/**
+ * 扫码统计明细类
+ * **/
+@Data
+public class FsStoreScanPaymentStatDetailsVo implements Serializable {
+    //支付时间
+    private String payTime;
+
+    //支付金额
+    private BigDecimal payMoney;
+}

+ 9 - 0
fs-service/src/main/java/com/fs/hisStore/vo/FsStoreScanPaymentStatVo.java

@@ -1,9 +1,13 @@
 package com.fs.hisStore.vo;
 
+import com.fs.common.core.page.TableDataInfo;
 import lombok.Data;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
+import java.util.List;
+
+import com.github.pagehelper.PageInfo;
 
 /**
  * 扫码流水统计类
@@ -24,4 +28,9 @@ public class FsStoreScanPaymentStatVo implements Serializable {
      * 总金额
      * **/
     private BigDecimal totalSales;
+
+    /**
+     * 分页数据
+     * **/
+    private TableDataInfo tableDataInfo;
 }

+ 2 - 2
fs-service/src/main/resources/application-config-druid-jnlzjk.yml

@@ -83,8 +83,8 @@ headerImg:
   imgUrl:
 
 ipad:
-  ipadUrl: http://ipad.cdwjyyh.com
-  aiApi: 1212121212
+  ipadUrl: http://ipadjnlzjk.ylrztop.com
+  aiApi: xxxx111
 
 wx_miniapp_temp:
   pay_order_temp_id:

+ 23 - 3
fs-service/src/main/resources/mapper/hisStore/FsStorePaymentScrmMapper.xml

@@ -204,13 +204,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
           AND `status` = 1
           AND pay_time > '2025-05-01 00:00:00'
           AND company_user_id = #{dayParam.companyUserId}
-          AND DATE_FORMAT(pay_time, '%Y-%m-%d')= DATE_FORMAT(NOW(), '%Y-%m-%d')
+        AND pay_time >= DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
+        AND pay_time &lt; DATE_FORMAT(
+        DATE_ADD(NOW(), INTERVAL 1 DAY),
+        '%Y-%m-%d 00:00:00'
+        )
         GROUP BY
             statPeriod
-        ORDER BY
-            statPeriod ASC
     </select>
 
+    <select id="getScanPaymentDayStatDetails" resultType="com.fs.hisStore.vo.FsStoreScanPaymentStatDetailsVo">
+        SELECT
+        pay_time,
+        pay_money
+        FROM
+        fs_store_payment_scrm
+        WHERE
+        business_type = 1
+        AND `status` = 1
+        AND company_user_id = '9587'
+        AND pay_time >= DATE_FORMAT(NOW(), '%Y-%m-%d 00:00:00')
+        AND pay_time &lt; DATE_FORMAT(
+        DATE_ADD(NOW(), INTERVAL 1 DAY),
+        '%Y-%m-%d 00:00:00'
+        ) ORDER BY pay_time DESC
+    </select>
+
+
     <select id="getScanPaymentMonthStat" resultType="com.fs.hisStore.vo.FsStoreScanPaymentStatVo">
         SELECT
             DATE_FORMAT(pay_time, '%Y-%m') AS statPeriod,

+ 10 - 1
fs-user-app/src/main/java/com/fs/app/controller/store/FsStoreScanPaymentStatController.java

@@ -2,8 +2,12 @@ package com.fs.app.controller.store;
 
 import com.fs.app.controller.AppBaseController;
 import com.fs.common.core.domain.R;
+import com.fs.common.core.page.TableDataInfo;
 import com.fs.hisStore.param.FsStoreScanPaymentStatParam;
 import com.fs.hisStore.service.IFsStorePaymentScrmService;
+import com.fs.hisStore.vo.FsStoreScanPaymentStatVo;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -24,6 +28,11 @@ public class FsStoreScanPaymentStatController extends AppBaseController {
     @ApiOperation("销售收款码金额统计")
     @PostMapping("/getScanPayStat")
     public R getScanPayStat(@Valid @RequestBody FsStoreScanPaymentStatParam param) {
-        return paymentService.getScanPaymentStat(param);
+        //统计
+        FsStoreScanPaymentStatVo scanPaymentStat = paymentService.getScanPaymentStat(param);
+        //分页
+        startPage();
+        scanPaymentStat.setTableDataInfo(getDataTable(paymentService.getScanPaymentStatPage(param)));
+        return R.ok().put("data",scanPaymentStat);
     }
 }