Commit aeee811d authored by lanbaoming's avatar lanbaoming

2024-04-30 报表修改

parent ab0de6c0
......@@ -424,8 +424,7 @@ public class CustomerAnalysisControl {
r.setSumvolumeTbV1(new BigDecimal(0));
r.setSumvolumeTbShow1("同期为0");
} else {
r.setSumvolumeTbV1(new BigDecimal(100).multiply(r.getSumvolumeTb1()));
r.setSumvolumeTbV1(new BigDecimal(1).multiply(r.getSumvolumeTb1()));
sTemp = getPercentage(
(r.getSumvolumeV1().subtract(r.getSumvolumeTbV1())),
r.getSumvolumeTbV1());
......
......@@ -191,7 +191,8 @@ public class CustomerReportControl {
int nT=1;
for (CustomerReportResp cr : lis) {
l.add("Top "+String.valueOf(nT) +"_"+cr.getName());
//top 加客户编号,客户名称
l.add("Top "+String.valueOf(nT)+"_" +cr.getNumber()+"_"+cr.getName());
//l.add("Top "+String.valueOf(nT));
nT++;
......
package cn.iocoder.yudao.module.delivery.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.delivery.entity.SalesReportReq;
import cn.iocoder.yudao.module.delivery.entity.SalesReportResp;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.delivery.entity.*;
import cn.iocoder.yudao.module.delivery.entity.bar.CustomerReportBar;
import cn.iocoder.yudao.module.delivery.entity.bar.series;
import cn.iocoder.yudao.module.delivery.entity.bar.yAxis;
import cn.iocoder.yudao.module.delivery.service.SalesReportService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.List;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
/**
......@@ -43,7 +47,7 @@ public class SalesReportControl {
*/
@PostMapping("/FirstCustomerCount")
public CommonResult<Integer> FirstCustomerCount(@RequestBody SalesReportReq Req) {
int nR=salesReportService.FirstCustomerCount(Req);
int nR = salesReportService.FirstCustomerCount(Req);
return success(nR);
}
......@@ -53,8 +57,8 @@ public class SalesReportControl {
*/
@PostMapping("/SalesReportCount")
public CommonResult<SalesReportResp> SalesReportCount(@RequestBody SalesReportReq Req) {
String s="";
SalesReportResp re=salesReportService.SalesReportCount(Req);
String s = "";
SalesReportResp re = salesReportService.SalesReportCount(Req);
return success(re);
}
......@@ -64,11 +68,87 @@ public class SalesReportControl {
*/
@PostMapping("/SalesReportList")
public CommonResult<Integer> SalesReportList(@RequestBody SalesReportReq Req) {
int nR=salesReportService.FirstCustomerCount(Req);
int nR = salesReportService.FirstCustomerCount(Req);
return success(nR);
}
/*
获取销售分析图表数据
*/
@GetMapping("/getEChartData")
public CommonResult<CustomerReportBar>
getEChartData(@Valid SalesAnalysisReq query) {
CustomerReportBar customerReportBar = new CustomerReportBar();
yAxis y = new yAxis();
y.setType("category");
y.setInverse(true);
List<String> l = new ArrayList<>();
l.add("1");
l.add("2");
l.add("3");
l.add("4");
l.add("5");
y.setData(l);
customerReportBar.setObjyAxis(y);
List<series> sl = new ArrayList<>();
//总V值
series s1 = new series();
s1.setName("2024");
s1.setType("bar");
s1.setBarGap("60%");
s1.setBarCategoryGap("60%");
List<String> s1L = new ArrayList<>();
s1L.add("12");
s1L.add("4");
s1L.add("7");
s1L.add("10");
s1L.add("20");
s1.setData(s1L);
sl.add(s1);
//海运
series s2 = new series();
s2.setName("2023");
s2.setType("bar");
s2.setBarGap("60%");
s2.setBarCategoryGap("60%");
List<String> s2L = new ArrayList<>();
s2L.add("10");
s2L.add("13");
s2L.add("6");
s2L.add("8");
s2L.add("9");
s2.setData(s2L);
sl.add(s2);
//空运
series s3 = new series();
s3.setName("2022");
s3.setType("bar");
s3.setBarGap("60%");
s3.setBarCategoryGap("60%");
List<String> s3L = new ArrayList<>();
s3L.add("10");
s3L.add("13");
s3L.add("19");
s3L.add("8");
s3L.add("19");
s3.setData(s3L);
sl.add(s3);
customerReportBar.setObSseries(sl);
// customerReportBar.setResultList(lis);
return success(customerReportBar);
}
}
......@@ -13,7 +13,6 @@ import lombok.ToString;
@ToString(callSuper = true)
public class SalesAnalysisReq extends PageParam {
private int start;
private int size;
......@@ -44,6 +43,20 @@ public class SalesAnalysisReq extends PageParam {
*/
private String tidanNo;
/*
发货人编号
*/
private String SearchType3;
private String fhNumber;
/*
收货人编号
*/
private String SearchType4;
private String shNumber;
/*
销售经理
*/
......@@ -59,6 +72,33 @@ public class SalesAnalysisReq extends PageParam {
*/
private String marks;
/*
订单状态
*/
private String status;
/*
始发仓
*/
private String startWarehouseId;
/*
目的国
*/
private String muDiGuo;
/*
目的城市
*/
private String muDiShi;
/*
目的仓
*/
private String dstwarehouseid;
/*
是否控货
*/
......@@ -75,4 +115,50 @@ public class SalesAnalysisReq extends PageParam {
*/
private String drawee;
/*
重泡货类型
*/
private String zpType;
/*
资源类型
*/
private String ResourceType;
/*
业绩类型
*/
private String YeJiType;
/*
时间筛选类型
*/
private String dateSearch1;
/*
开始时间
*/
private String sdate1;
/*
结束时间
*/
private String edate2;
/*
数据类型筛选
*/
private String dataSearch1;
/*
比较符号设置
*/
private String dataSearch2;
/*
数据值
*/
private String dataSearch3;
}
......@@ -60,7 +60,7 @@ public class SalesAnalysisResp {
/*
发货人编号
*/
private String cfNumber;
private String fhNumber;
private long cfCustomerId;
/*
......@@ -135,7 +135,16 @@ public class SalesAnalysisResp {
/*
入仓箱数
*/
private String sumquantity;
private int sumquantity;
/*
提货箱数
*/
private int picknum;
/*
根据入库箱数和提货箱数计算出的提货率
*/
private String showThl;
/*
入仓体积
......@@ -191,4 +200,11 @@ public class SalesAnalysisResp {
private String zpUnitShow;
/*
首次入仓时间
*/
private String firstInTime;
}
......@@ -69,6 +69,7 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
}
*/
List<CustomerAnalysisResp> list = customerAnalysisMapper.getListPage(req);
System.out.println("符合条件的客户总数:" + String.valueOf(total));
return new PageResult<>(list, total, mpPage.getSize(),
req.getPageNo(), (total + mpPage.getSize() - 1) / mpPage.getSize());
......
......@@ -10,4 +10,6 @@ public interface SalesAnalysisService {
PageResult<SalesAnalysisResp> getListPage(SalesAnalysisReq page);
List<SalesAnalysisExcelResp> getList(SalesAnalysisReq req);
}
......@@ -4,7 +4,7 @@
<select id="getListPage"
parameterType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
resultType="cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp">
WITH dataTJ as(
with dataTJ AS(
SELECT number,name,c.id,(
SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
......@@ -79,11 +79,16 @@
and searchDataType3!=null and searchDataType3!=''">
<choose>
<when test="searchDataType2 =='1'.toString()">
and ${searchDataType1} >= #{searchDataType3}
<!--大于等于的写法-->
and ${searchDataType1} <![CDATA[ >= ]]> #{searchDataType3}
</when>
<when test="searchDataType2 =='2'.toString()">
and ${searchDataType1} = #{searchDataType3}
</when>
<when test="searchDataType2 =='3'.toString()">
<!--小于等于的写法-->
and ${searchDataType1} <![CDATA[ <= ]]> #{searchDataType3}
</when>
</choose>
</if>
</where>
......@@ -147,12 +152,26 @@
</sql>
<select id="GetCount" resultType="java.lang.Long">
<!--
SELECT count(*)
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>-->
WITH dataTJ as(
SELECT c.id,
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sdate}' AND '${edate}') AS allsumvolume
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>
)
select count(*) from dataTJ
<include refid="WherePage2"/>
</select>
<select id="getList"
......
......@@ -11,7 +11,7 @@
if(c.transport_id=1,'海运拼柜','专线空运') as transportIdName,
order_type as ordertype,use_weight_unit as useweightunit,
use_volume_unit as usevolumeunit,
marks,w.start_warehouse_name as startwarehousename,
c.marks,w.start_warehouse_name as startwarehousename,
w.dst_warehouse_name as dstwarehousename,w.muDiGuo,w.muDiShi,
c.channel_id as channelid,channel.name_zh as channelidName,
c.create_time as createtime,sum_quantity as sumquantity,
......@@ -21,27 +21,31 @@
cf.number as fhNumber,sh.number as shNumber,
cf.id as cfCustomerId,sh.id as shCustomerId,
cf.resource_type as cfresourceType,sh.resource_type as shResource_type,
cf.is_new as cfYeJiType,sh.is_new as shYeJitype
cf.is_new as cfYeJiType,sh.is_new as shYeJitype,
(SELECT sum(ecw_order_pickup.pick_num) FROM ecw_order_pickup
WHERE ( ecw_order_pickup.order_id = c.order_no)) AS picknum,
(select in_time from ecw_order_warehouse_in where
order_id=c.order_id ORDER BY in_time asc LIMIT 1) as firstInTime
from ecw_order c
left join (SELECT ewl.id AS line_id,
ew_start.id AS start_warehouse_id,
ew_dest.id AS dst_warehouse_id,ew_start.title_zh AS start_title_zh,
ew_dest.title_zh AS dst_warehouse_name,
r_dest.title_zh as muDiGuo,r_sdest.title_zh as muDiShi,
r_dest.title_zh as muDiGuo, r_dest.id as muDiGuoID,
r_sdest.title_zh as muDiShi,r_sdest.id as muDiShiID,
ew_start.title_zh AS start_warehouse_name FROM ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON
ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.id
left join ecw_region r_dest on ew_dest.guojia=r_dest.id
LEFT JOIN ecw_region r_sdest on ew_dest.shi=r_sdest.id
) w ON w.line_id = c.line_id
left join ecw_channel channel on channel.channel_id =c.channel_id
left join ecw_channel channel on channel.channel_id =c.channel_id and channel.deleted=0
<!--订单发货人信息-->
left join ecw_order_consignor nor on nor.order_id = c.order_id
left join ecw_customer cf on cf.id=nor.customer_id
left join ecw_order_consignor nor on nor.order_id = c.order_id and nor.deleted=0
left join ecw_customer cf on cf.id=nor.customer_id and cf.deleted=0
<!--订单收货人信息-->
left join ecw_order_consignee nee on nee.order_id = c.order_id
left join ecw_customer sh on sh.id=nee.customer_id
left join ecw_order_consignee nee on nee.order_id = c.order_id and nee.deleted=0
left join ecw_customer sh on sh.id=nee.customer_id and sh.deleted=0
<include refid="WherePage"/>
ORDER BY c.create_time asc limit #{start}, #{size}
</select>
......@@ -49,28 +53,123 @@
<sql id="WherePage">
<where>
and c.deleted = 0
<if test="orderNo!=null and orderNo!=''">
<!--订单编号-->
and c.order_no= #{orderNo}
</if>
<if test="tidanNo!=null and tidanNo!=''">
<!--提单编号-->
and c.tidan_no= #{tidanNo}
</if>
<if test="fhNumber!=null and fhNumber!=''">
<!--发货人编号-->
and cf.number= #{fhNumber}
</if>
<if test="shNumber!=null and shNumber!=''">
<!--收货人编号-->
and sh.number= #{shNumber}
</if>
<if test="marks!=null and marks!=''">
<!--唛头-->
and c.marks= #{marks}
</if>
<if test="salesmanId!=null and salesmanId!=''">
<!--客户经理-->
and c.salesman_id= #{salesmanId}
</if>
<if test="status!=null and status!=''">
<!--订单状态-->
and c.status= #{status}
</if>
<if test="transportId!=null and transportId!=''">
<!--运输方式查询条件-->
and c.transport_id= #{transportId}
</if>
<if test="orderNo!=null and orderNo!=''">
<!--订单编号-->
and c.order_no= #{orderNo}
<if test="startWarehouseId!=null and startWarehouseId!=''">
<!--始发仓-->
and w.start_warehouse_id= #{startWarehouseId}
</if>
<if test="muDiGuo!=null and muDiGuo!=''">
<!--目的国-->
and w.muDiGuoID= #{muDiGuo}
</if>
<if test="muDiShi!=null and muDiShi!=''">
<!--目的城市-->
and w.muDiShiID= #{muDiShi}
</if>
<if test="dstwarehouseid!=null and dstwarehouseid!=''">
<!--目的仓-->
and w.dst_warehouse_id= #{dstwarehouseid}
</if>
<if test="isCargoControl!=null and isCargoControl!=''">
<!--是否控货-->
and c.is_cargo_control= #{isCargoControl}
</if>
<if test="shippingChannelId!=null and shippingChannelId!=''">
<!--渠道-->
and c.channel_id= #{shippingChannelId}
<if test="zpType!=null and zpType!=''">
<!--重泡货类型-->
and c.order_type= #{zpType}
</if>
<if test="drawee!=null and drawee!=''">
<!--付款方-->
and c.drawee= #{drawee}
</if>
<if test="shippingChannelId!=null and shippingChannelId!=''">
<!--渠道-->
and c.channel_id= #{shippingChannelId}
</if>
<if test="ResourceType!=null and ResourceType!=''">
<!--资源类型-->
and c.channel_id= #{ResourceType}
</if>
<if test="YeJiType!=null and YeJiType!=''">
<!--业绩类型-->
and c.channel_id= #{YeJiType}
</if>
<if test="dateSearch1!=null and dateSearch1!=''
and sdate1!=null and sdate1!=''
and edate2!=null and edate2!=''">
<!--订单创建时间-->
and c.create_time BETWEEN #{sdate1} AND #{edate2}
</if>
<if test="dataSearch3!=null and dataSearch3!=''">
<if test="dataSearch1!=null and dataSearch1!=''">
<if test="dataSearch2=null and dataSearch2!=''">
<!--数据筛选-->
<choose>
<when test="dataSearch1 =='1'.toString()">
<!--入仓箱数-->
</when>
<when test="dataSearch1 =='2'.toString()">
<!--入仓体积-->
</when>
<when test="dataSearch1 =='3'.toString()">
<!--入仓重量-->
</when>
<when test="dataSearch1 =='3'.toString()">
<!--重/泡标准-->
</when>
<when test="dataSearch1 =='3'.toString()">
<!--提货率-->
</when>
</choose>
</if>
</if>
</if>
</where>
</sql>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment