Compare commits
No commits in common. "9aea0db30160966f027cce3236167ddb2c86d4b9" and "04def3cf65496006efbcf85a27d97ebe9fa0289c" have entirely different histories.
9aea0db301
...
04def3cf65
|
@ -1,92 +0,0 @@
|
||||||
package org.jeecg.modules.zh.view.home.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.home.entity.ZhHome;
|
|
||||||
import org.jeecg.modules.zh.view.home.service.IZhHomeService;
|
|
||||||
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/home")
|
|
||||||
@Slf4j
|
|
||||||
public class ZhHomeController {
|
|
||||||
@Autowired
|
|
||||||
private IZhHomeService service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总览统计
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/totalInfo", method = RequestMethod.GET)
|
|
||||||
public Result totalInfo() {
|
|
||||||
ZhHome entity = service.totalInfo();
|
|
||||||
return Result.ok(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 今日统计
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/todayInfo", method = RequestMethod.GET)
|
|
||||||
public Result todayInfo() {
|
|
||||||
ZhHome entity = service.todayInfo();
|
|
||||||
return Result.ok(entity);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单类别统计
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/getOrderTypeCn", method = RequestMethod.GET)
|
|
||||||
public Result getOrderTypeCn() {
|
|
||||||
List<ZhHome> list = service.getOrderTypeCn();
|
|
||||||
return Result.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小区投递
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/getXqtd", method = RequestMethod.GET)
|
|
||||||
public Result getXqtd() {
|
|
||||||
List<ZhHome> list = service.getXqtd();
|
|
||||||
return Result.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备投递
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/getSbtd", method = RequestMethod.GET)
|
|
||||||
public Result getSbtd() {
|
|
||||||
List<ZhHome> list = service.getSbtd();
|
|
||||||
return Result.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员投递
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/getHytd", method = RequestMethod.GET)
|
|
||||||
public Result getHytd() {
|
|
||||||
List<ZhHome> list = service.getHytd();
|
|
||||||
return Result.ok(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实时投递
|
|
||||||
*/
|
|
||||||
@RequestMapping(value = "/getSstd", method = RequestMethod.GET)
|
|
||||||
public Result<IPage<ZhHome>> getSstd(ZhHome zhHome,
|
|
||||||
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
||||||
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize) {
|
|
||||||
Page<ZhHome> page = new Page<ZhHome>(pageNo, pageSize);
|
|
||||||
IPage<ZhHome> list = service.getSstd(page,zhHome);
|
|
||||||
return Result.OK(list);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,49 +0,0 @@
|
||||||
package org.jeecg.modules.zh.view.home.entity;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class ZhHome implements Serializable {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private String tdzlA;//总投递重量
|
|
||||||
private Integer tdcsA;//总投递次数
|
|
||||||
private String qyzlA;//总清运重量
|
|
||||||
private Integer hyrsA;//总会员人数
|
|
||||||
private Integer qysA;//总区域数
|
|
||||||
private Integer sbsA;//总设备数
|
|
||||||
private Integer zxsbsA;//在线设备数
|
|
||||||
private Integer lxsbsA;//离线设备数
|
|
||||||
|
|
||||||
private String tdzlT;//今日递重量
|
|
||||||
private Integer tdcsT;//今日递次数
|
|
||||||
private String qyzlT;//今日运重量
|
|
||||||
private Integer hyrsT;//今日新增会员人数
|
|
||||||
|
|
||||||
private String tdzlY;//昨日递重量
|
|
||||||
private Integer tdcsY;//昨日递次数
|
|
||||||
private String qyzlY;//昨日运重量
|
|
||||||
private Integer hyrsY;//昨日新增会员人数
|
|
||||||
|
|
||||||
private String tdzlR;//较昨日递重量比例
|
|
||||||
private String tdcsR;//较昨日递次数比例
|
|
||||||
private String qyzlR;//较昨日运重量比例
|
|
||||||
private String hyrsR;//较昨日新增会员人数比例
|
|
||||||
|
|
||||||
private String phone;
|
|
||||||
private String type;
|
|
||||||
private Integer cn;
|
|
||||||
private String weight;
|
|
||||||
private String housingestateId;
|
|
||||||
private String housingestateName;
|
|
||||||
private String imei;
|
|
||||||
private String content;
|
|
||||||
private Integer rowNumber;
|
|
||||||
private String addTime;
|
|
||||||
|
|
||||||
private String beginTime;
|
|
||||||
private String endTime;
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,33 +0,0 @@
|
||||||
package org.jeecg.modules.zh.view.home.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.home.entity.ZhHome;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 首页统计
|
|
||||||
* @author: jeecg-boot
|
|
||||||
*/
|
|
||||||
public interface ZhHomeMapper extends BaseMapper<ZhHome>{
|
|
||||||
|
|
||||||
ZhHome getTdA();
|
|
||||||
ZhHome getQyzlA();
|
|
||||||
ZhHome getHyrsA();
|
|
||||||
ZhHome getQysA();
|
|
||||||
ZhHome getSbsA();
|
|
||||||
|
|
||||||
ZhHome getTd(ZhHome zhHome);
|
|
||||||
ZhHome getQyzl(ZhHome zhHome);
|
|
||||||
ZhHome getHyrs(ZhHome zhHome);
|
|
||||||
|
|
||||||
List<ZhHome> getOrderTypeCn();
|
|
||||||
List<ZhHome> getXqtd();
|
|
||||||
List<ZhHome> getSbtd();
|
|
||||||
List<ZhHome> getHytd();
|
|
||||||
IPage<ZhHome> getSstd(Page<ZhHome> page, @Param("params")ZhHome zhHome);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,141 +0,0 @@
|
||||||
<?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.home.mapper.ZhHomeMapper">
|
|
||||||
|
|
||||||
<select id="getTdA" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(id) as tdcsA,
|
|
||||||
round(sum(weight)/1000,2) as tdzlA
|
|
||||||
from bl_order_info
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getQyzlA" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
round(sum(this_weight)/-1000,2) as qyzlA
|
|
||||||
from bl_device_clear_log
|
|
||||||
where status = '1'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getHyrsA" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(phone) as hyrsA
|
|
||||||
from bl_user_info
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getQysA" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(*) as qysA
|
|
||||||
from bl_housingestate_info
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getSbsA" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(*) as sbsA,
|
|
||||||
sum(case when is_online = 'true' then 1 else 0 end) as zxsbsA,
|
|
||||||
sum(case when is_online = 'false' then 1 else 0 end) as lxsbsA
|
|
||||||
from bl_device_info
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getTd" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(id) as tdcsT,
|
|
||||||
round(sum(weight)/1000,2) as tdzlT
|
|
||||||
from bl_order_info
|
|
||||||
where add_time >= #{beginTime}
|
|
||||||
and add_time <= #{endTime}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getQyzl" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
round(sum(this_weight)/-1000,2) as qyzlT
|
|
||||||
from bl_device_clear_log
|
|
||||||
where status = '1'
|
|
||||||
and start_time >= #{beginTime}
|
|
||||||
and start_time <= #{endTime}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getHyrs" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
count(phone) as hyrsT
|
|
||||||
from bl_user_info
|
|
||||||
where register_date >= #{beginTime}
|
|
||||||
and register_date <= #{endTime}
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getOrderTypeCn" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
(case invalid
|
|
||||||
when 0 then '正常'
|
|
||||||
when 1 then '违规'
|
|
||||||
when 2 then '部分违规'
|
|
||||||
when 3 then '待审核'
|
|
||||||
when 4 then '异常'
|
|
||||||
when 5 then '忽略'
|
|
||||||
end) as type,
|
|
||||||
count(*) as cn
|
|
||||||
from bl_order_info
|
|
||||||
group by type
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getXqtd" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
a.housingestate_id as housingestateId,
|
|
||||||
b.name as housingestateName,
|
|
||||||
round(sum(a.weight)/1000,2) as weight,
|
|
||||||
count(a.id) as cn
|
|
||||||
from bl_order_info a
|
|
||||||
inner join bl_housingestate_info b on a.housingestate_id = b.housingestate_id
|
|
||||||
group by a.housingestate_id,b.name
|
|
||||||
order by weight desc
|
|
||||||
limit 10
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getSbtd" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
a.housingestate_id as housingestateId,
|
|
||||||
b.name as housingestateName,
|
|
||||||
a.imei,
|
|
||||||
c.content,
|
|
||||||
round(sum(weight)/1000,2) as weight,
|
|
||||||
count(*) as cn
|
|
||||||
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
|
|
||||||
group by a.housingestate_id,b.name,a.imei,c.content
|
|
||||||
order by weight desc
|
|
||||||
limit 10
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getHytd" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
phone,
|
|
||||||
round(sum(a.weight),2) as weight,
|
|
||||||
count(a.id) as cn
|
|
||||||
from bl_order_info a
|
|
||||||
group by phone
|
|
||||||
order by weight desc
|
|
||||||
limit 10
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="getSstd" parameterType="org.jeecg.modules.zh.view.home.entity.ZhHome" resultType="org.jeecg.modules.zh.view.home.entity.ZhHome">
|
|
||||||
select
|
|
||||||
a.phone,
|
|
||||||
a.weight,
|
|
||||||
a.add_time as addTime,
|
|
||||||
b.name as housingestateName,
|
|
||||||
c.content
|
|
||||||
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="params.beginTime != null and params.beginTime !=''">
|
|
||||||
and a.add_time >= #{params.beginTime}
|
|
||||||
</if>
|
|
||||||
<if test="params.endTime != null and params.endTime !=''">
|
|
||||||
and a.add_time <= #{params.endTime}
|
|
||||||
</if>
|
|
||||||
</where>
|
|
||||||
order by a.add_time desc
|
|
||||||
</select>
|
|
||||||
|
|
||||||
</mapper>
|
|
|
@ -1,25 +0,0 @@
|
||||||
package org.jeecg.modules.zh.view.home.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.home.entity.ZhHome;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 首页统计
|
|
||||||
* @author: jeecg-boot
|
|
||||||
*/
|
|
||||||
public interface IZhHomeService extends IService<ZhHome> {
|
|
||||||
|
|
||||||
ZhHome totalInfo();
|
|
||||||
ZhHome todayInfo();
|
|
||||||
|
|
||||||
List<ZhHome> getOrderTypeCn();
|
|
||||||
|
|
||||||
List<ZhHome> getXqtd();
|
|
||||||
List<ZhHome> getSbtd();
|
|
||||||
List<ZhHome> getHytd();
|
|
||||||
IPage<ZhHome> getSstd(Page<ZhHome> page, ZhHome zhHome);
|
|
||||||
}
|
|
|
@ -1,200 +0,0 @@
|
||||||
package org.jeecg.modules.zh.view.home.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.common.util.DateUtils;
|
|
||||||
import org.jeecg.modules.zh.view.home.entity.ZhHome;
|
|
||||||
import org.jeecg.modules.zh.view.home.mapper.ZhHomeMapper;
|
|
||||||
import org.jeecg.modules.zh.view.home.service.IZhHomeService;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.math.RoundingMode;
|
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @Description: 首页统计
|
|
||||||
* @author: jeecg-boot
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class ZhHomeServiceImpl extends ServiceImpl<ZhHomeMapper, ZhHome> implements IZhHomeService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 总览统计
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ZhHome totalInfo() {
|
|
||||||
ZhHome zhHome = new ZhHome();
|
|
||||||
//获取总投递
|
|
||||||
ZhHome tdA = baseMapper.getTdA();
|
|
||||||
zhHome.setTdcsA(tdA.getTdcsA());
|
|
||||||
zhHome.setTdzlA(tdA.getTdzlA());
|
|
||||||
//获取总清运
|
|
||||||
ZhHome qyzlA = baseMapper.getQyzlA();
|
|
||||||
zhHome.setQyzlA(qyzlA.getQyzlA());
|
|
||||||
//获取总会员
|
|
||||||
ZhHome hyrsA = baseMapper.getHyrsA();
|
|
||||||
zhHome.setHyrsA(hyrsA.getHyrsA());
|
|
||||||
//获取总区域
|
|
||||||
ZhHome qysA = baseMapper.getQysA();
|
|
||||||
zhHome.setQysA(qysA.getQysA());
|
|
||||||
//获取总设备
|
|
||||||
ZhHome sbsA = baseMapper.getSbsA();
|
|
||||||
zhHome.setSbsA(sbsA.getSbsA());
|
|
||||||
zhHome.setZxsbsA(sbsA.getZxsbsA());
|
|
||||||
zhHome.setLxsbsA(sbsA.getZxsbsA());
|
|
||||||
return zhHome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 今日统计
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public ZhHome todayInfo() {
|
|
||||||
ZhHome zhHome = new ZhHome();
|
|
||||||
ZhHome zhHomeT = new ZhHome();
|
|
||||||
String today = DateUtils.formatDate();
|
|
||||||
zhHomeT.setBeginTime(today+" 00:00:00");
|
|
||||||
zhHomeT.setEndTime(today+" 23:59:59");
|
|
||||||
//获取今日投递
|
|
||||||
ZhHome tdT = baseMapper.getTd(zhHomeT);
|
|
||||||
if(tdT!=null){
|
|
||||||
zhHome.setTdcsT(tdT.getTdcsT());
|
|
||||||
zhHome.setTdzlT(tdT.getTdzlT());
|
|
||||||
}else{
|
|
||||||
zhHome.setTdcsT(0);
|
|
||||||
zhHome.setTdzlT("0");
|
|
||||||
}
|
|
||||||
//获取今日清运
|
|
||||||
ZhHome qyzlT = baseMapper.getQyzl(zhHomeT);
|
|
||||||
if(qyzlT!=null){
|
|
||||||
zhHome.setQyzlT(qyzlT.getQyzlT());
|
|
||||||
}else{
|
|
||||||
zhHome.setQyzlT("0");
|
|
||||||
}
|
|
||||||
//获取今日新增会员
|
|
||||||
ZhHome hyrsT = baseMapper.getHyrs(zhHomeT);
|
|
||||||
if(hyrsT!=null){
|
|
||||||
zhHome.setHyrsT(hyrsT.getHyrsT());
|
|
||||||
}else{
|
|
||||||
zhHome.setHyrsT(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
ZhHome zhHomeY = new ZhHome();
|
|
||||||
Calendar ca = Calendar.getInstance();
|
|
||||||
ca.add(Calendar.DAY_OF_MONTH,-1);
|
|
||||||
String yesterday = DateUtils.formatDate(ca);
|
|
||||||
zhHomeY.setBeginTime(yesterday+" 00:00:00");
|
|
||||||
zhHomeY.setEndTime(yesterday+" 23:59:59");
|
|
||||||
//获取昨日投递
|
|
||||||
ZhHome tdY = baseMapper.getTd(zhHomeY);
|
|
||||||
if(tdY!=null){
|
|
||||||
zhHome.setTdcsY(tdY.getTdcsT());
|
|
||||||
zhHome.setTdzlY(tdY.getTdzlT());
|
|
||||||
}else{
|
|
||||||
zhHome.setTdcsY(0);
|
|
||||||
zhHome.setTdzlY("0");
|
|
||||||
}
|
|
||||||
//获取昨日清运
|
|
||||||
ZhHome qyzlY = baseMapper.getQyzl(zhHomeY);
|
|
||||||
if(qyzlY!=null){
|
|
||||||
zhHome.setQyzlY(qyzlY.getQyzlT());
|
|
||||||
}else{
|
|
||||||
zhHome.setQyzlY("0");
|
|
||||||
}
|
|
||||||
//获取昨日会员新增
|
|
||||||
ZhHome hyrsY = baseMapper.getHyrs(zhHomeY);
|
|
||||||
if(hyrsY!=null){
|
|
||||||
zhHome.setHyrsY(hyrsY.getHyrsT());
|
|
||||||
}else{
|
|
||||||
zhHome.setHyrsY(0);
|
|
||||||
}
|
|
||||||
//获取投递次数比
|
|
||||||
if(!zhHome.getTdcsY().equals(0)){
|
|
||||||
BigDecimal btdcsT = new BigDecimal(zhHome.getTdcsT());
|
|
||||||
BigDecimal btdcsY = new BigDecimal(zhHome.getTdcsY());
|
|
||||||
BigDecimal tdcsR = btdcsT.subtract(btdcsY).multiply(new BigDecimal("100")).divide(btdcsY, 2, RoundingMode.HALF_UP);
|
|
||||||
zhHome.setTdcsR(tdcsR.toString());
|
|
||||||
}else{
|
|
||||||
zhHome.setTdcsR("0");
|
|
||||||
}
|
|
||||||
//获取投递重量比
|
|
||||||
if(!zhHome.getTdzlY().equals("0")){
|
|
||||||
BigDecimal btdzlT = new BigDecimal(zhHome.getTdzlT());
|
|
||||||
BigDecimal btdzlY = new BigDecimal(zhHome.getTdzlY());
|
|
||||||
BigDecimal tdzlR = btdzlT.subtract(btdzlY).multiply(new BigDecimal("100")).divide(btdzlY, 2, RoundingMode.HALF_UP);
|
|
||||||
zhHome.setTdzlR(tdzlR.toString());
|
|
||||||
}else{
|
|
||||||
zhHome.setTdzlR("0");
|
|
||||||
}
|
|
||||||
//获取清运比
|
|
||||||
if(!zhHome.getQyzlY().equals("0")){
|
|
||||||
BigDecimal bqyzlT = new BigDecimal(zhHome.getQyzlT());
|
|
||||||
BigDecimal bqyzlY = new BigDecimal(zhHome.getQyzlY());
|
|
||||||
BigDecimal bqyzlR = bqyzlT.subtract(bqyzlY).multiply(new BigDecimal("100")).divide(bqyzlY, 2, RoundingMode.HALF_UP);
|
|
||||||
zhHome.setQyzlR(bqyzlR.toString());
|
|
||||||
}else{
|
|
||||||
zhHome.setQyzlR("0");
|
|
||||||
}
|
|
||||||
//获取会员比
|
|
||||||
if(!zhHome.getHyrsY().equals(0)){
|
|
||||||
BigDecimal bhyrsT = new BigDecimal(zhHome.getHyrsT());
|
|
||||||
BigDecimal bhyrsY = new BigDecimal(zhHome.getHyrsY());
|
|
||||||
BigDecimal hyrsR = bhyrsT.subtract(bhyrsY).multiply(new BigDecimal("100")).divide(bhyrsY, 2, RoundingMode.HALF_UP);
|
|
||||||
zhHome.setHyrsR(hyrsR.toString());
|
|
||||||
}else{
|
|
||||||
zhHome.setHyrsR("0");
|
|
||||||
}
|
|
||||||
return zhHome;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 订单类别统计
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ZhHome> getOrderTypeCn(){
|
|
||||||
return baseMapper.getOrderTypeCn();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 小区投递
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ZhHome> getXqtd(){
|
|
||||||
return baseMapper.getXqtd();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 设备投递
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ZhHome> getSbtd(){
|
|
||||||
return baseMapper.getSbtd();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 会员投递
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<ZhHome> getHytd(){
|
|
||||||
return baseMapper.getHytd();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 实时投递
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public IPage<ZhHome> getSstd(Page<ZhHome> page, ZhHome zhHome){
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
||||||
Calendar ca = Calendar.getInstance();
|
|
||||||
String endTime = sdf.format(ca.getTime());
|
|
||||||
zhHome.setEndTime(endTime);
|
|
||||||
ca.add(Calendar.HOUR_OF_DAY,-1);
|
|
||||||
String beginTime = sdf.format(ca.getTime());
|
|
||||||
zhHome.setBeginTime(beginTime);
|
|
||||||
return baseMapper.getSstd(page,zhHome);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,72 +0,0 @@
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,34 +0,0 @@
|
||||||
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;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,22 +0,0 @@
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,150 +0,0 @@
|
||||||
<?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>
|
|
|
@ -1,21 +0,0 @@
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
|
@ -1,60 +0,0 @@
|
||||||
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