From 427f64605eff7c67a3213865861e324c50de7fb0 Mon Sep 17 00:00:00 2001 From: goupan <goupan@chinapopin.com> Date: 星期三, 17 四月 2024 17:30:22 +0800 Subject: [PATCH] 代码提交 --- common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/OrderMentalTestMapper.xml | 6 ++++++ common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/OrderMentalTestMapper.java | 2 +- common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/OrderMentalTestServiceImpl.java | 4 ++-- guns/src/main/java/cn/stylefeng/guns/modular/business/controller/StatMentalTestController.java | 22 ++++++++++++++++++++-- common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/IOrderMentalTestService.java | 2 +- 5 files changed, 30 insertions(+), 6 deletions(-) diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/OrderMentalTestMapper.java b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/OrderMentalTestMapper.java index 3f95f75..a4c7e09 100644 --- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/OrderMentalTestMapper.java +++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/OrderMentalTestMapper.java @@ -24,6 +24,6 @@ OrderMentalTestDetailDTO getInfoById(@Param("id") Long id); - List<Map<String, Object>> getStatOrderList(@Param("dateFormat") String dateFormat, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("workerId") Long workerId, @Param("statusList") List<Integer> statusList); + List<Map<String, Object>> getStatOrderList(@Param("dateFormat") String dateFormat, @Param("beginTime") String beginTime, @Param("endTime") String endTime, @Param("workerId") Long workerId, @Param("statusList") List<Integer> statusList, @Param("orderNoList") List<String> orderNoList); } diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/OrderMentalTestMapper.xml b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/OrderMentalTestMapper.xml index 0a70726..bff4905 100644 --- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/OrderMentalTestMapper.xml +++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/mapper/mapping/OrderMentalTestMapper.xml @@ -66,6 +66,12 @@ #{item} </foreach> </if> + <if test="orderNoList != null and orderNoList.size != 0"> + AND o.order_no IN + <foreach collection="orderNoList" item="item" open="(" separator="," close=")"> + #{item} + </foreach> + </if> <if test="workerId != null"> AND o.user_id = #{workerId} </if> diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/IOrderMentalTestService.java b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/IOrderMentalTestService.java index 7c6fe19..0c1963f 100644 --- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/IOrderMentalTestService.java +++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/IOrderMentalTestService.java @@ -65,6 +65,6 @@ /** * 统计订单数据 */ - List<Map<String, Object>> getStatOrderList(String dateFormat, String beginTime, String endTime, Long workerId, List<Integer> statusList); + List<Map<String, Object>> getStatOrderList(String dateFormat, String beginTime, String endTime, Long workerId, List<Integer> statusList, List<String> orderNoList); } diff --git a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/OrderMentalTestServiceImpl.java b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/OrderMentalTestServiceImpl.java index 49ec565..a8a452c 100644 --- a/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/OrderMentalTestServiceImpl.java +++ b/common-buiness/src/main/java/cn/stylefeng/guns/modular/business/service/impl/OrderMentalTestServiceImpl.java @@ -133,8 +133,8 @@ } @Override - public List<Map<String, Object>> getStatOrderList(String dateFormat, String beginTime, String endTime, Long workerId, List<Integer> statusList) { - return this.baseMapper.getStatOrderList(dateFormat, beginTime, endTime, workerId, statusList); + public List<Map<String, Object>> getStatOrderList(String dateFormat, String beginTime, String endTime, Long workerId, List<Integer> statusList, List<String> orderNoList) { + return this.baseMapper.getStatOrderList(dateFormat, beginTime, endTime, workerId, statusList, orderNoList); } } diff --git a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/StatMentalTestController.java b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/StatMentalTestController.java index e251412..1552687 100644 --- a/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/StatMentalTestController.java +++ b/guns/src/main/java/cn/stylefeng/guns/modular/business/controller/StatMentalTestController.java @@ -1,5 +1,6 @@ package cn.stylefeng.guns.modular.business.controller; +import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import cn.stylefeng.guns.modular.business.dto.StatMentalTestDTO; import cn.stylefeng.guns.modular.business.entity.OrderConsultOne; @@ -52,8 +53,24 @@ @ApiImplicitParam(name = "type", value = "类型:1日,2周,3月,4年", dataTypeClass = Integer.class, required = true), @ApiImplicitParam(name = "beginTime", value = "开始时间", dataTypeClass = String.class), @ApiImplicitParam(name = "endTime", value = "结束时间", dataTypeClass = String.class), + @ApiImplicitParam(name = "workerId", value = "咨询师ID", dataTypeClass = Long.class), }) - public ResponseData<StatMentalTestDTO> mentalTestData(Integer type, String beginTime, String endTime) { + public ResponseData<StatMentalTestDTO> mentalTestData(Integer type, String beginTime, String endTime, Long workerId) { + List<String> orderNoList = null; + if (workerId != null) { + orderNoList = orderConsultOneService.listObjs( + Wrappers.<OrderConsultOne>lambdaQuery() + .select(OrderConsultOne::getMentalTestOrderNo) + .eq(OrderConsultOne::getGoodsId, workerId) + .eq(OrderConsultOne::getStatusFlag, OrderStatusFlagEnum.PAY_SUCCESS.getCode()) + .eq(OrderConsultOne::getStatusFlag, OrderStatusFlagEnum.PAY_SUCCESS.getCode()), + o -> StrUtil.toString(o) + ); + if (CollUtil.isEmpty(orderNoList)) { + orderNoList = Arrays.asList("0"); + } + } + // 获取日期格式化SQL String dateFormatSql = StatDataUtil.getDateFormatSql(type); @@ -70,7 +87,7 @@ // 统计订单数据 List<Map<String, Object>> statOrderList = orderMentalTestService.getStatOrderList( - dateFormatSql, beginTime, endTime, null, statusFlagList + dateFormatSql, beginTime, endTime, null, statusFlagList, orderNoList ); Double moneySum = statOrderList.stream() .mapToDouble(item -> Double.parseDouble(item.get("data").toString())) @@ -82,6 +99,7 @@ Wrappers.<OrderMentalTest>lambdaQuery() .select(OrderMentalTest::getUserId) .in(OrderMentalTest::getStatusFlag, statusFlagList) + .in(CollUtil.isEmpty(orderNoList), OrderMentalTest::getOrderNo, orderNoList) .ge(StrUtil.isNotBlank(beginTime), OrderMentalTest::getCreateTime, beginTime) .le(StrUtil.isNotBlank(endTime), OrderMentalTest::getCreateTime, endTime) .groupBy(OrderMentalTest::getUserId) -- Gitblit v1.7.1