yanghui
2022-11-26 f83dceab74da9bda2db807199190fc02168a48dc
#feat 统计接口修改
8个文件已修改
95 ■■■■ 已修改文件
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ShopFlowerApi.java 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopFlowerApi.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopFlowerOrderDAO.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopFlowerOrderService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java 39 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComShopFlowerOrderDAO.xml 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
springcloud_k8s_panzhihuazhihuishequ/applets_backstage/src/main/java/com/panzhihua/applets_backstage/api/CommunityConvenientApi.java
@@ -14,6 +14,7 @@
import com.panzhihua.common.model.vos.community.convenient.ConvenientElevatingPointVO;
import com.panzhihua.common.model.vos.community.convenient.ConvenientGoodsCategoryVO;
import com.panzhihua.common.utlis.MimeTypeUtils;
import io.swagger.annotations.*;
import org.apache.commons.io.FilenameUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.validation.annotation.Validated;
@@ -53,9 +54,6 @@
import com.panzhihua.common.validated.AddGroup;
import com.panzhihua.common.validated.PutGroup;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import static com.panzhihua.common.utlis.FileTypeUploadUtils.assertAllowed;
@@ -458,7 +456,10 @@
     */
    @GetMapping("/merchant/selectOrderLineChart")
    @ApiOperation(value = "统计时间区域的订单量 15天 30天 一年")
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type){
        return communityService.selectOrderLineChart(storeId,type);
    @ApiImplicitParams({@ApiImplicitParam(name = "storeId", value = "商家id"),
            @ApiImplicitParam(name = "type", value = "类型 1.近15天  2.近30天 3.今年"),
            @ApiImplicitParam(name = "tab", value = "tab 1.订单量  2.营业收入")})
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type,@RequestParam("tab")  Integer tab){
        return communityService.selectOrderLineChart(storeId,type,tab);
    }
}
springcloud_k8s_panzhihuazhihuishequ/common/src/main/java/com/panzhihua/common/service/community/CommunityService.java
@@ -11102,5 +11102,5 @@
     * @param type
     * @return
     */
    @GetMapping("/shopFlower/selectOrderLineChart") R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type);
    @GetMapping("/shopFlower/selectOrderLineChart") R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type,@RequestParam("tab")  Integer tab);
}
springcloud_k8s_panzhihuazhihuishequ/community_backstage/src/main/java/com/panzhihua/community_backstage/api/ShopFlowerApi.java
@@ -176,8 +176,11 @@
     */
    @GetMapping("selectOrderLineChart")
    @ApiOperation(value = "商家后台-统计时间区域的订单量 15天 30天 一年")
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type){
        return communityService.selectOrderLineChart(storeId,type);
    @ApiImplicitParams({@ApiImplicitParam(name = "storeId", value = "商家id"),
            @ApiImplicitParam(name = "type", value = "类型 1.近15天  2.近30天 3.今年"),
            @ApiImplicitParam(name = "tab", value = "tab 1.订单量  2.营业收入")})
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type,@RequestParam("tab")  Integer tab){
        return communityService.selectOrderLineChart(storeId,type,tab);
    }
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/api/ShopFlowerApi.java
@@ -533,8 +533,8 @@
     * @return
     */
    @GetMapping("selectOrderLineChart")
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type){
        return comShopFlowerOrderService.selectOrderLineChart(storeId,type);
    public  R selectOrderLineChart(@RequestParam("storeId") Long storeId,@RequestParam("type")  Integer type,@RequestParam("tab")  Integer tab){
        return comShopFlowerOrderService.selectOrderLineChart(storeId,type,tab);
    }
    /**
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/dao/ComShopFlowerOrderDAO.java
@@ -106,4 +106,20 @@
    List<ComShopOrderStoreIdCountVO> selectCountOrderMonthByStoreId(@Param("storeId") Long storeId);
    IPage<ComShopFlowerOrderStoreListVO> pageOrderByDeliveryNo(@Param("page") Page page, @Param("comOrderListDTO") PageComFlowerOrderListDTO comOrderListDTO);
    /**
     * 查询近n天的营收
     *
     * @param storeId
     * @return
     */
    List<ComShopOrderStoreIdNumVO> selectOrderSumPayDayByStoreId(@Param("storeId") Long storeId, @Param("days") Integer days);
    /**
     * 查询当年月份的营收
     *
     * @param storeId
     * @return
     */
    List<ComShopOrderStoreIdNumVO> selectOrderSumMonthByStoreId(@Param("storeId") Long storeId);
}
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/ComShopFlowerOrderService.java
@@ -171,9 +171,10 @@
     * 统计时间区域的订单量 15天 30天 一年
     * @param storeId
     * @param type
     * @param tab
     * @return
     */
    R selectOrderLineChart(Long storeId,Integer type);
    R selectOrderLineChart(Long storeId,Integer type,Integer tab);
    /**
     * 清点商品 确认送达详情
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/java/com/panzhihua/service_community/service/impl/ComShopFlowerOrderServiceImpl.java
@@ -1010,7 +1010,8 @@
        return R.ok(retMap);
    }
    public R selectOrderLineChart(Long storeId, Integer type) {
    public R selectOrderLineChart(Long storeId, Integer type,Integer tab) {
        if (tab == 1){
        if (1 == type) {
            //近15天的订单量
            int days = 15;
@@ -1031,6 +1032,30 @@
            }
            return R.ok(retMap);
        }
        }else if (2==tab){
            if (1 == type) {
                //近15天的营收
                int days = 15;
                return getSumByStoreIdAndDays(storeId, days);
            } else if (2 == type) {
                //近30天的营收
                int days = 30;
                return getSumByStoreIdAndDays(storeId, days);
            } else {
                //今年所有月份订单量
                List<ComShopOrderStoreIdNumVO> comShopOrderStoreIdCountVOS = this.baseMapper.selectOrderSumMonthByStoreId(storeId);
                Map<String, BigDecimal> retMap = comShopOrderStoreIdCountVOS.stream().collect(Collectors.toMap(ComShopOrderStoreIdNumVO::getCountName, ComShopOrderStoreIdNumVO::getCountNum));
                List<String> yearMonths = DateUtils.getYearMonths();
                for (String yearMonth : yearMonths) {
                    if (!retMap.containsKey(yearMonth)) {
                        retMap.put(yearMonth, BigDecimal.ZERO);
                    }
                }
                return R.ok(retMap);
            }
        }
        return R.ok();
    }
    private R getCountByStoreIdAndDays(Long storeId, int days) {
@@ -1045,6 +1070,18 @@
        return R.ok(retMap);
    }
    private R getSumByStoreIdAndDays(Long storeId, int days) {
        List<ComShopOrderStoreIdNumVO> comShopOrderStoreIdNumVOS = this.baseMapper.selectOrderSumPayDayByStoreId(storeId, days);
        Map<String, BigDecimal> retMap = comShopOrderStoreIdNumVOS.stream().collect(Collectors.toMap(ComShopOrderStoreIdNumVO::getCountName, ComShopOrderStoreIdNumVO::getCountNum));
        List<String> beforeDays = DateUtils.getBeforeDays(days);
        for (String beforeDay : beforeDays) {
            if (!retMap.containsKey(beforeDay)) {
                retMap.put(beforeDay, BigDecimal.ZERO);
            }
        }
        return R.ok(retMap);
    }
    @Override
    public R pageOrderByDeliveryNo(PageComFlowerOrderListDTO pageComFlowerOrderListDTO) {
        Page page = new Page(pageComFlowerOrderListDTO.getPageNum(), pageComFlowerOrderListDTO.getPageSize());
springcloud_k8s_panzhihuazhihuishequ/service_community/src/main/resources/mapper/ComShopFlowerOrderDAO.xml
@@ -303,5 +303,18 @@
        SELECT count(1) count_num, date_format(create_at,'%Y-%m') as count_name FROM com_shop_flower_order
        WHERE  date_format(create_at,'%Y-%m') &gt;= date_format(now(),'%Y-01')  and store_id = #{storeId} GROUP BY  count_name
    </select>
    <select id="selectOrderSumPayDayByStoreId"
            resultType="com.panzhihua.common.model.vos.shop.ComShopOrderStoreIdNumVO">
        SELECT IFNULL(sum(pay_amount),0) count_num, date_format(create_at,'%Y-%m-%d') as count_name FROM com_shop_flower_order
        WHERE  date_format(create_at,'%Y-%m-%d') &gt;= date_format(date_sub(now(), INTERVAL #{days} DAY),'%Y-%m-%d')
        and store_id = #{storeId} and `status` not in (6,7)
        GROUP BY  count_name
    </select>
    <select id="selectOrderSumMonthByStoreId"
            resultType="com.panzhihua.common.model.vos.shop.ComShopOrderStoreIdNumVO">
        SELECT IFNULL(sum(pay_amount),0) count_num, date_format(create_at,'%Y-%m') as count_name FROM com_shop_flower_order
        WHERE  date_format(create_at,'%Y-%m') &gt;= date_format(now(),'%Y-01')  and store_id = #{storeId}  and `status` not in (6,7) GROUP BY  count_name
    </select>
</mapper>