清运报表

This commit is contained in:
曹磊 2025-07-11 16:05:24 +08:00
parent 76c9d407b7
commit 04def3cf65
8 changed files with 422 additions and 3 deletions

View File

@ -178,6 +178,7 @@ public class DeviceClearLogServiceImpl extends JeecgServiceImpl<DeviceClearLogMa
String imei = json.getStr("dtu");//设备
String type = json.getStr("type");
String addTime = json.getStr("add_time");
addTime = addTime.replace(".000000Z","").replace("T"," ");
String startTime = json.getStr("start_time");
String finishedTime = json.getStr("finished_time");
String startWeight = json.getStr("start_weight");

View File

@ -1,10 +1,7 @@
package org.jeecg.modules.zh.view.hy.entity;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
public class Hy implements Serializable {

View File

@ -0,0 +1,100 @@
package org.jeecg.modules.zh.view.qy.controller;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.common.api.vo.Result;
import org.jeecg.common.system.base.controller.JeecgController;
import org.jeecg.modules.zh.view.qy.entity.Qy;
import org.jeecg.modules.zh.view.qy.service.IQyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @Description: 清运信息
* @Author: jeecg-boot
* @Date: 2025-07-07
* @Version: V1.0
*/
@Api(tags="清运信息")
@RestController
@RequestMapping("/zh/qy")
@Slf4j
public class QyController extends JeecgController<Qy, IQyService> {
@Autowired
private IQyService service;
/**
* 司机列表
*/
@RequestMapping(value = "/queryStaffList", method = RequestMethod.GET)
public Result queryStaffList(Qy qy) {
List<Qy> list = service.queryStaffList(qy);
return Result.ok(list);
}
/**
* 司机清运列表
*/
@RequestMapping(value = "/querySjQyList", method = RequestMethod.GET)
public Result querySjQyList(Qy qy) {
List<Qy> list = service.querySjQyList(qy);
return Result.ok(list);
}
/**
* 司机清运重量排行榜
*/
@RequestMapping(value = "/querySjQyZlList", method = RequestMethod.GET)
public Result querySjQyZlList(Qy qy,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<Qy> page = new Page<Qy>(pageNo, pageSize);
IPage<Qy> list = service.querySjQyZlList(page,qy);
return Result.ok(list);
}
/**
* 司机清运次数排行榜
*/
@RequestMapping(value = "/querySjQyCsList", method = RequestMethod.GET)
public Result querySjQyCsList(Qy qy,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<Qy> page = new Page<Qy>(pageNo, pageSize);
IPage<Qy> list = service.querySjQyCsList(page,qy);
return Result.ok(list);
}
/**
* 时间段清运次数统计
*/
@RequestMapping(value = "/querySjdQyCsList", method = RequestMethod.GET)
public Result querySjdQyCsList(Qy qy) {
List<Qy> list = service.querySjdQyCsList(qy);
return Result.ok(list);
}
/**
* 时间段清运重量统计
*/
@RequestMapping(value = "/querySjdQyZlList", method = RequestMethod.GET)
public Result querySjdQyZlList(Qy qy) {
List<Qy> list = service.querySjdQyZlList(qy);
return Result.ok(list);
}
/**
* 小区清运次数排行榜
*/
@RequestMapping(value = "/queryXqQyCsListlList", method = RequestMethod.GET)
public Result queryXqQyCsListlList(Qy qy,
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
Page<Qy> page = new Page<Qy>(pageNo, pageSize);
IPage<Qy> list = service.queryXqQyCsListlList(page,qy);
return Result.ok(list);
}
}

View File

@ -0,0 +1,30 @@
package org.jeecg.modules.zh.view.qy.entity;
import lombok.Data;
import java.io.Serializable;
@Data
public class Qy implements Serializable {
private static final long serialVersionUID = 1L;
private String staffPhone;
private String staffName;
private String housingId;
private String housingName;
private String housingType;
private String imei;
private String content;
private String dtu;
private String addTime;
private String startTime;
private String finishedTime;
private String startWeight;
private String endWeight;
private String thisWeight;
private String status;
private String beginTime;
private String endTime;
private Integer rowNumber;
private Integer cn;
private String shortHour;
}

View File

@ -0,0 +1,25 @@
package org.jeecg.modules.zh.view.qy.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.qy.entity.Qy;
import java.util.List;
/**
* @Description: 清运信息
* @Author: jeecg-boot
* @Date: 2025-07-07
* @Version: V1.0
*/
public interface QyMapper extends BaseMapper<Qy> {
List<Qy> queryStaffList(Qy qy);
List<Qy> querySjQyList(Qy qy);
IPage<Qy> querySjQyZlList(Page<Qy> page, @Param("qy")Qy qy);
IPage<Qy> querySjQyCsList(Page<Qy> page, @Param("qy")Qy qy);
List<Qy> querySjdQyCsList(Qy qy);
List<Qy> querySjdQyZlList(Qy qy);
IPage<Qy> queryXqQyCsListlList(Page<Qy> page, @Param("qy")Qy qy);
}

View File

@ -0,0 +1,166 @@
<?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.qy.mapper.QyMapper">
<select id="queryStaffList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select distinct
staff_phone as staffPhone,
staff_name as staffName
from bl_device_clear_log
<where>
<if test="beginTime != null and beginTime !=''">
and start_time >= #{beginTime}
</if>
<if test="endTime != null and endTime !=''">
and start_time &lt;= #{endTime}
</if>
</where>
order by staff_phone
</select>
<select id="querySjQyList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
a.staff_phone as staffPhone,
a.staff_name as staffName,
round(a.this_weight/-1,2) as thisWeight,
a.housing_id as housingId,
a.housing_name as housingName,
a.imei,
c.content,
a.dtu,
a.start_time as startTime,
a.finished_time as finishedTime,
a.status
from bl_device_clear_log a
inner join bl_device_info c on a.imei = c.imei
where a.status = '1'
and a.start_time >= #{beginTime}
and a.start_time &lt;= #{endTime}
<if test="staffPhone!=null and staffPhone!=''">
and a.staff_phone = #{staffPhone}
</if>
<if test="status!=null and status!=''">
and a.status = #{status}
</if>
<if test="housingId!=null and housingId!=''">
and a.housing_id = #{housingId}
</if>
<if test="shortHour!=null and shortHour!=''">
and HOUR(a.start_time) = #{shortHour}
</if>
<if test="imei!=null and imei!=''">
and a.imei = #{imei}
</if>
) t
order by t.housingId,t.imei,t.dtu,t.startTime
</select>
<select id="querySjQyZlList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
staff_phone as staffPhone,
staff_name as staffName,
round(sum(this_weight)/-1000,2) as thisWeight
from bl_device_clear_log
where status = '1'
and start_time >= #{qy.beginTime}
and start_time &lt;= #{qy.endTime}
<if test="qy.staffPhone!=null and qy.staffPhone!=''">
and staff_phone = #{qy.staffPhone}
</if>
group by staff_phone,staff_name
) t
order by t.thisWeight desc
</select>
<select id="querySjQyCsList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
staff_phone as staffPhone,
staff_name as staffName,
count(*) as cn
from bl_device_clear_log
where start_time >= #{qy.beginTime}
and start_time &lt;= #{qy.endTime}
<if test="qy.staffPhone!=null and qy.staffPhone!=''">
and staff_phone = #{qy.staffPhone}
</if>
group by staff_phone,staff_name
) t
order by t.cn desc
</select>
<select id="querySjdQyCsList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
a.short_hour as shortHour,
ifnull(b.cn,0) as cn
from bl_hour_info a
left join
(
select HOUR(start_time) as short_hour,count(*) as cn
from bl_device_clear_log
where start_time >= #{beginTime}
and start_time &lt;= #{endTime}
<if test="housingId!=null and housingId!=''">
and housing_id = #{housingId}
</if>
group by HOUR(start_time)
) b on a.short_hour = b.short_hour
</select>
<select id="querySjdQyZlList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
a.short_hour as shortHour,
ifnull(b.thisWeight,0) as thisWeight
from bl_hour_info a
left join
(
select HOUR(start_time) as short_hour,round(sum(this_weight)/-1000,2) as thisWeight
from bl_device_clear_log
where start_time >= #{beginTime}
and start_time &lt;= #{endTime}
<if test="housingId!=null and housingId!=''">
and housing_id = #{housingId}
</if>
group by HOUR(start_time)
) b on a.short_hour = b.short_hour
</select>
<select id="queryXqQyCsListlList" parameterType="org.jeecg.modules.zh.view.qy.entity.Qy" resultType="org.jeecg.modules.zh.view.qy.entity.Qy">
select
@row_num := @row_num + 1 AS rowNumber,
t.*
from (SELECT @row_num := 0) r,
(
select
a.housing_id as housingId,
a.housing_name as housingName,
a.imei,
c.content,
count(*) as cn
from bl_device_clear_log a
inner join bl_device_info c on a.imei = c.imei
where a.start_time >= #{qy.beginTime}
and a.start_time &lt;= #{qy.endTime}
<if test="qy.housingId!=null and qy.housingId!=''">
and a.housing_id = #{qy.housingId}
</if>
group by a.housing_id,a.housing_name,a.imei,c.content
) t
order by t.cn desc
</select>
</mapper>

View File

@ -0,0 +1,25 @@
package org.jeecg.modules.zh.view.qy.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.qy.entity.Qy;
import java.util.List;
/**
* @Description: 清运信息
* @Author: jeecg-boot
* @Date: 2025-07-07
* @Version: V1.0
*/
public interface IQyService extends IService<Qy> {
List<Qy> queryStaffList(Qy qy);
List<Qy> querySjQyList(Qy qy);
IPage<Qy> querySjQyZlList(Page<Qy> page, Qy qy);
IPage<Qy> querySjQyCsList(Page<Qy> page, Qy qy);
List<Qy> querySjdQyCsList(Qy qy);
List<Qy> querySjdQyZlList(Qy qy);
IPage<Qy> queryXqQyCsListlList(Page<Qy> page, Qy qy);
}

View File

@ -0,0 +1,75 @@
package org.jeecg.modules.zh.view.qy.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.qy.entity.Qy;
import org.jeecg.modules.zh.view.qy.mapper.QyMapper;
import org.jeecg.modules.zh.view.qy.service.IQyService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @Description: 清运信息
* @Author: jeecg-boot
* @Date: 2025-07-07
* @Version: V1.0
*/
@Service
public class QyServiceImpl extends ServiceImpl<QyMapper, Qy> implements IQyService {
public List<Qy> queryStaffList(Qy qy){
return baseMapper.queryStaffList(qy);
}
/**
* 司机清运列表
*/
@Override
public List<Qy> querySjQyList(Qy qy) {
return baseMapper.querySjQyList(qy);
}
/**
* 司机清运重量排行榜
*/
@Override
public IPage<Qy> querySjQyZlList(Page<Qy> page, Qy qy) {
return baseMapper.querySjQyZlList(page,qy);
}
/**
* 司机清运次数排行榜
*/
@Override
public IPage<Qy> querySjQyCsList(Page<Qy> page, Qy qy) {
return baseMapper.querySjQyCsList(page,qy);
}
/**
* 时间段清运次数统计
*/
@Override
public List<Qy> querySjdQyCsList(Qy qy) {
return baseMapper.querySjdQyCsList(qy);
}
/**
* 时间段清运重量统计
*/
@Override
public List<Qy> querySjdQyZlList(Qy qy) {
return baseMapper.querySjdQyZlList(qy);
}
/**
* 小区清运次数排行榜
*/
@Override
public IPage<Qy> queryXqQyCsListlList(Page<Qy> page, Qy qy) {
return baseMapper.queryXqQyCsListlList(page,qy);
}
}