订单报表
This commit is contained in:
parent
04def3cf65
commit
7d8f5f4aea
|
@ -0,0 +1,72 @@
|
||||||
|
package org.jeecg.modules.zh.view.order.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jeecg.common.api.vo.Result;
|
||||||
|
import org.jeecg.modules.zh.view.order.entity.OrderStatic;
|
||||||
|
import org.jeecg.modules.zh.view.order.service.OrderStaticService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 订单统计
|
||||||
|
* @author: jeecg-boot
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/zh/order")
|
||||||
|
@Slf4j
|
||||||
|
public class OrderStaticController {
|
||||||
|
@Autowired
|
||||||
|
private OrderStaticService service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取订单列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryOrderList", method = RequestMethod.GET)
|
||||||
|
public Result queryOrderList(OrderStatic orderInfo) {
|
||||||
|
List<OrderStatic> list = service.queryOrderList(orderInfo);
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单投递次数时间段统计
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/querySjdtdcsList", method = RequestMethod.GET)
|
||||||
|
public Result querySjdtdcsList(OrderStatic orderInfo) {
|
||||||
|
List<OrderStatic> list = service.querySjdtdcsList(orderInfo);
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单投递金额时间段统计
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/querySjdtdjeList", method = RequestMethod.GET)
|
||||||
|
public Result querySjdtdjeList(OrderStatic orderInfo) {
|
||||||
|
List<OrderStatic> list = service.querySjdtdjeList(orderInfo);
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取违规订单列表
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryWgOrderList", method = RequestMethod.GET)
|
||||||
|
public Result queryWgOrderList(OrderStatic orderInfo) {
|
||||||
|
List<OrderStatic> list = service.queryWgOrderList(orderInfo);
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单投递金额时间段统计
|
||||||
|
*/
|
||||||
|
@RequestMapping(value = "/queryWgddjetjList", method = RequestMethod.GET)
|
||||||
|
public Result queryWgddjetjList(OrderStatic orderInfo) {
|
||||||
|
List<OrderStatic> list = service.queryWgddjetjList(orderInfo);
|
||||||
|
return Result.ok(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,34 @@
|
||||||
|
package org.jeecg.modules.zh.view.order.entity;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class OrderStatic implements Serializable {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String phone;
|
||||||
|
private String imei;
|
||||||
|
private String shortHour;
|
||||||
|
private String shortDay;
|
||||||
|
private Integer cn;
|
||||||
|
private String type;
|
||||||
|
private String housingestateId;
|
||||||
|
private String housingestateName;
|
||||||
|
private String content;
|
||||||
|
private String beginTime;
|
||||||
|
private String endTime;
|
||||||
|
private String money;//金额
|
||||||
|
private String weight;//重量
|
||||||
|
private String addTime;//投递时间
|
||||||
|
private String invalid;//订单是否有效
|
||||||
|
private String startWeight;//订单开始重量
|
||||||
|
private String endWeight;//订单结束重量
|
||||||
|
private String updatedAt;//厂家更新时间
|
||||||
|
private String deductMoney;//扣除金额
|
||||||
|
private String cause;//原因
|
||||||
|
private Integer rowNumber;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,22 @@
|
||||||
|
package org.jeecg.modules.zh.view.order.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
import org.jeecg.modules.zh.view.order.entity.OrderStatic;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 订单统计
|
||||||
|
* @author: jeecg-boot
|
||||||
|
*/
|
||||||
|
public interface OrderStaticMapper extends BaseMapper<OrderStatic> {
|
||||||
|
|
||||||
|
List<OrderStatic> queryOrderList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> querySjdtdcsList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> querySjdtdjeList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> queryWgOrderList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> queryWgddjetjList(OrderStatic orderInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,150 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="org.jeecg.modules.zh.view.order.mapper.OrderStaticMapper">
|
||||||
|
|
||||||
|
<select id="queryOrderList" parameterType="org.jeecg.modules.zh.view.order.entity.OrderStatic" resultType="org.jeecg.modules.zh.view.order.entity.OrderStatic">
|
||||||
|
select
|
||||||
|
@row_num := @row_num + 1 AS rowNumber,
|
||||||
|
t.*
|
||||||
|
from (SELECT @row_num := 0) r,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
a.phone,
|
||||||
|
a.money,
|
||||||
|
a.weight,
|
||||||
|
a.add_time as addTime,
|
||||||
|
a.invalid,
|
||||||
|
a.start_weight as startWeight,
|
||||||
|
a.end_weight as endWeight,
|
||||||
|
a.updated_at as updatedAt,
|
||||||
|
a.deduct_money as deductMoney,
|
||||||
|
b.name as housingestateName,
|
||||||
|
c.content,
|
||||||
|
a.cause
|
||||||
|
from bl_order_info a
|
||||||
|
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
|
||||||
|
inner join bl_device_info c on a.imei = c.imei
|
||||||
|
<where>
|
||||||
|
<if test="phone!=null and phone!=''">
|
||||||
|
and a.phone = #{phone}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime !=''">
|
||||||
|
and a.add_time >= #{beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime !=''">
|
||||||
|
and a.add_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="invalid != null and invalid !=''">
|
||||||
|
and a.invalid = #{invalid}
|
||||||
|
</if>
|
||||||
|
<if test="housingestateId!=null and housingestateId!=''">
|
||||||
|
and a.housingestate_id = #{housingestateId}
|
||||||
|
</if>
|
||||||
|
<if test="imei!=null and imei!=''">
|
||||||
|
and a.imei = #{imei}
|
||||||
|
</if>
|
||||||
|
<if test="shortHour!=null and shortHour!=''">
|
||||||
|
and HOUR(a.add_time) = #{shortHour}
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
) t
|
||||||
|
order by t.addTime desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="querySjdtdcsList" parameterType="org.jeecg.modules.zh.view.order.entity.OrderStatic" resultType="org.jeecg.modules.zh.view.order.entity.OrderStatic">
|
||||||
|
select a.short_hour as shortHour,
|
||||||
|
ifnull(b.cn,0) as cn
|
||||||
|
from bl_hour_info a
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select HOUR(add_time) as short_hour,count(*) as cn
|
||||||
|
from bl_order_info
|
||||||
|
where add_time >= #{beginTime}
|
||||||
|
and add_time <= #{endTime}
|
||||||
|
<if test="housingestateId!=null and housingestateId!=''">
|
||||||
|
and housingestate_id = #{housingestateId}
|
||||||
|
</if>
|
||||||
|
group by HOUR(add_time)
|
||||||
|
) b on a.short_hour = b.short_hour
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="querySjdtdjeList" parameterType="org.jeecg.modules.zh.view.order.entity.OrderStatic" resultType="org.jeecg.modules.zh.view.order.entity.OrderStatic">
|
||||||
|
select
|
||||||
|
a.short_hour as shortHour,
|
||||||
|
ifnull(b.money,0) as money
|
||||||
|
from bl_hour_info a
|
||||||
|
left join
|
||||||
|
(
|
||||||
|
select HOUR(add_time) as short_hour,round(sum(money)-sum(deduct_money),2) as money
|
||||||
|
from bl_order_info
|
||||||
|
where add_time >= #{beginTime}
|
||||||
|
and add_time <= #{endTime}
|
||||||
|
<if test="housingestateId!=null and housingestateId!=''">
|
||||||
|
and housingestate_id = #{housingestateId}
|
||||||
|
</if>
|
||||||
|
group by HOUR(add_time)
|
||||||
|
) b on a.short_hour = b.short_hour
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryWgddjetjList" parameterType="org.jeecg.modules.zh.view.order.entity.OrderStatic" resultType="org.jeecg.modules.zh.view.order.entity.OrderStatic">
|
||||||
|
select
|
||||||
|
DATE_FORMAT(add_time,'%Y-%m-%d') as shortDay,
|
||||||
|
round(sum(ifnull(money,0) - ifnull(deduct_money,0)),2) as money,
|
||||||
|
round(sum(ifnull(deduct_money,0)) ,2)as deductMoney
|
||||||
|
from bl_order_info
|
||||||
|
where add_time >= #{beginTime}
|
||||||
|
and add_time <= #{endTime}
|
||||||
|
and invalid in ('1','2')
|
||||||
|
group by shortDay
|
||||||
|
order by shortDay
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="queryWgOrderList" parameterType="org.jeecg.modules.zh.view.order.entity.OrderStatic" resultType="org.jeecg.modules.zh.view.order.entity.OrderStatic">
|
||||||
|
select
|
||||||
|
@row_num := @row_num + 1 AS rowNumber,
|
||||||
|
t.*
|
||||||
|
from (SELECT @row_num := 0) r,
|
||||||
|
(
|
||||||
|
select
|
||||||
|
a.phone,
|
||||||
|
a.money,
|
||||||
|
a.weight,
|
||||||
|
a.add_time as addTime,
|
||||||
|
a.invalid,
|
||||||
|
a.start_weight as startWeight,
|
||||||
|
a.end_weight as endWeight,
|
||||||
|
a.updated_at as updatedAt,
|
||||||
|
a.deduct_money as deductMoney,
|
||||||
|
b.name as housingestateName,
|
||||||
|
c.content,
|
||||||
|
a.cause
|
||||||
|
from bl_order_info a
|
||||||
|
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
|
||||||
|
inner join bl_device_info c on a.imei = c.imei
|
||||||
|
where a.invalid in ('1','2')
|
||||||
|
<if test="phone!=null and phone!=''">
|
||||||
|
and a.phone = #{phone}
|
||||||
|
</if>
|
||||||
|
<if test="beginTime != null and beginTime !=''">
|
||||||
|
and a.add_time >= #{beginTime}
|
||||||
|
</if>
|
||||||
|
<if test="endTime != null and endTime !=''">
|
||||||
|
and a.add_time <= #{endTime}
|
||||||
|
</if>
|
||||||
|
<if test="invalid != null and invalid !=''">
|
||||||
|
and a.invalid = #{invalid}
|
||||||
|
</if>
|
||||||
|
<if test="housingestateId!=null and housingestateId!=''">
|
||||||
|
and a.housingestate_id = #{housingestateId}
|
||||||
|
</if>
|
||||||
|
<if test="imei!=null and imei!=''">
|
||||||
|
and a.imei = #{imei}
|
||||||
|
</if>
|
||||||
|
<if test="shortHour!=null and shortHour!=''">
|
||||||
|
and HOUR(a.add_time) = #{shortHour}
|
||||||
|
</if>
|
||||||
|
) t
|
||||||
|
order by t.addTime desc
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
|
@ -0,0 +1,21 @@
|
||||||
|
package org.jeecg.modules.zh.view.order.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import org.jeecg.modules.zh.view.order.entity.OrderStatic;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 订单统计
|
||||||
|
* @author: jeecg-boot
|
||||||
|
*/
|
||||||
|
public interface OrderStaticService extends IService<OrderStatic> {
|
||||||
|
|
||||||
|
List<OrderStatic> queryOrderList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> querySjdtdcsList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> querySjdtdjeList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> queryWgOrderList(OrderStatic orderInfo);
|
||||||
|
List<OrderStatic> queryWgddjetjList(OrderStatic orderInfo);
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,60 @@
|
||||||
|
package org.jeecg.modules.zh.view.order.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import org.jeecg.modules.zh.view.order.entity.OrderStatic;
|
||||||
|
import org.jeecg.modules.zh.view.order.mapper.OrderStaticMapper;
|
||||||
|
import org.jeecg.modules.zh.view.order.service.OrderStaticService;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 会员统计
|
||||||
|
* @author: jeecg-boot
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class OrderStaticServiceImpl extends ServiceImpl<OrderStaticMapper, OrderStatic> implements OrderStaticService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取订单列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderStatic> queryOrderList(OrderStatic orderInfo) {
|
||||||
|
return baseMapper.queryOrderList(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单投递次数时间段统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderStatic> querySjdtdcsList(OrderStatic orderInfo) {
|
||||||
|
return baseMapper.querySjdtdcsList(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单投递金额时间段统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderStatic> querySjdtdjeList(OrderStatic orderInfo) {
|
||||||
|
return baseMapper.querySjdtdjeList(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取违规订单列表
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderStatic> queryWgOrderList(OrderStatic orderInfo) {
|
||||||
|
return baseMapper.queryWgOrderList(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 违规订单金额统计
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<OrderStatic> queryWgddjetjList(OrderStatic orderInfo) {
|
||||||
|
return baseMapper.queryWgddjetjList(orderInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue