Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
jiedao-api-boot-master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lanbaoming
jiedao-api-boot-master
Commits
6fc4a7ce
Commit
6fc4a7ce
authored
May 01, 2024
by
liuzeheng
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/dev' into dev
parents
9f702dca
27accc20
Changes
24
Show whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
1800 additions
and
780 deletions
+1800
-780
ReportCustomerAnalysisExcelExportEvent.java
.../event/export/ReportCustomerAnalysisExcelExportEvent.java
+52
-0
ReportSalesAnalysisExcelExportEvent.java
...ore/event/export/ReportSalesAnalysisExcelExportEvent.java
+52
-0
pom.xml
yudao-module-delivery/yudao-module-delivery-rest/pom.xml
+7
-0
CustomerAnalysisControl.java
...le/delivery/controller/admin/CustomerAnalysisControl.java
+39
-654
CustomerReportControl.java
...dule/delivery/controller/admin/CustomerReportControl.java
+5
-1
SalesAnalysisControl.java
...odule/delivery/controller/admin/SalesAnalysisControl.java
+98
-10
SalesReportControl.java
.../module/delivery/controller/admin/SalesReportControl.java
+90
-10
CustomerAnalysisReq.java
...der/yudao/module/delivery/entity/CustomerAnalysisReq.java
+20
-5
CustomerAnalysisResp.java
...er/yudao/module/delivery/entity/CustomerAnalysisResp.java
+5
-3
SalesAnalysisReq.java
...ocoder/yudao/module/delivery/entity/SalesAnalysisReq.java
+110
-6
SalesAnalysisResp.java
...coder/yudao/module/delivery/entity/SalesAnalysisResp.java
+87
-6
CustomerAnalysisExcelExportListener.java
...elivery/listener/CustomerAnalysisExcelExportListener.java
+116
-0
SalesAnalysisExcelExportListener.java
...e/delivery/listener/SalesAnalysisExcelExportListener.java
+102
-0
CustomerAnalysisMapper.java
.../yudao/module/delivery/mapper/CustomerAnalysisMapper.java
+1
-1
CustomerAnalysisService.java
...udao/module/delivery/service/CustomerAnalysisService.java
+11
-1
CustomerAnalysisImpl.java
...ao/module/delivery/service/Impl/CustomerAnalysisImpl.java
+638
-2
SalesAnalysisService.java
...r/yudao/module/delivery/service/SalesAnalysisService.java
+2
-0
ReportTask.java
...ava/cn/iocoder/yudao/module/delivery/task/ReportTask.java
+41
-0
CustomerAnalysisMapper.xml
...rest/src/main/resources/mapper/CustomerAnalysisMapper.xml
+126
-67
CustomerReportMapper.xml
...y-rest/src/main/resources/mapper/CustomerReportMapper.xml
+1
-1
SalesAnalysisMapper.xml
...ry-rest/src/main/resources/mapper/SalesAnalysisMapper.xml
+140
-13
MakeBillOfLadingServiceImpl.java
...service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
+1
-0
DownloadTypeEnum.java
.../yudao/module/system/enums/download/DownloadTypeEnum.java
+10
-0
DownloadLogServiceImpl.java
...le/system/service/downloadLog/DownloadLogServiceImpl.java
+46
-0
No files found.
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/export/ReportCustomerAnalysisExcelExportEvent.java
0 → 100644
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
export
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/*
lanbm 2024-05-01 add
销售分析报表导出excel
*/
@Data
public
class
ReportCustomerAnalysisExcelExportEvent
{
/**
* 操作用户
*/
private
Long
userId
;
/**
* 端口
*/
private
Integer
userType
;
/**
* 请求参数
*/
private
String
requestParams
;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private
Integer
lang
=
0
;
/**
* 文件名称
*/
private
String
fileName
;
/**
* 文件路径
*/
private
String
path
;
/**
* 下载地址
*/
private
String
url
;
/**
* 执行结果
*/
private
String
result
;
@ApiModelProperty
(
value
=
"文件ID"
)
private
Long
fileId
;
}
yudao-framework/yudao-spring-boot-starter-config/src/main/java/cn/iocoder/yudao/framework/apollo/core/event/export/ReportSalesAnalysisExcelExportEvent.java
0 → 100644
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
framework
.
apollo
.
core
.
event
.
export
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/*
客户分析报表导出 lanbm 2024-05-01 add
*/
@Data
public
class
ReportSalesAnalysisExcelExportEvent
{
/**
* 操作用户
*/
private
Long
userId
;
/**
* 端口
*/
private
Integer
userType
;
/**
* 请求参数
*/
private
String
requestParams
;
/**
* 国际化语言值,默认0中文, 具体取值I18nMessage.getLang()
*/
private
Integer
lang
=
0
;
/**
* 文件名称
*/
private
String
fileName
;
/**
* 文件路径
*/
private
String
path
;
/**
* 下载地址
*/
private
String
url
;
/**
* 执行结果
*/
private
String
result
;
@ApiModelProperty
(
value
=
"文件ID"
)
private
Long
fileId
;
}
yudao-module-delivery/yudao-module-delivery-rest/pom.xml
View file @
6fc4a7ce
...
@@ -33,5 +33,12 @@
...
@@ -33,5 +33,12 @@
<artifactId>
yudao-module-system-impl
</artifactId>
<artifactId>
yudao-module-system-impl
</artifactId>
<version>
${revision}
</version>
<version>
${revision}
</version>
</dependency>
</dependency>
<dependency>
<groupId>
cn.iocoder.boot
</groupId>
<artifactId>
yudao-module-infra-impl
</artifactId>
<version>
1.6.1-snapshot
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</dependencies>
</project>
</project>
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/CustomerAnalysisControl.java
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
controller
.
admin
;
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
controller
.
admin
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ReportCustomerAnalysisExcelExportEvent
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
import
cn.iocoder.yudao.framework.common.exception.ErrorCode
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.util.json.JsonUtils
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.framework.redis.helper.RedisHelper
;
import
cn.iocoder.yudao.framework.redis.helper.RedisHelper
;
...
@@ -17,13 +20,18 @@ import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService2;
...
@@ -17,13 +20,18 @@ import cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService2;
import
cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService
;
import
cn.iocoder.yudao.module.delivery.service.EcwReportPermissionService
;
import
cn.iocoder.yudao.module.delivery.service.view_order_businesstimeService
;
import
cn.iocoder.yudao.module.delivery.service.view_order_businesstimeService
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
cn.iocoder.yudao.module.system.api.file.FileMakeApi
;
import
cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO
;
import
cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
com.fasterxml.jackson.databind.ObjectMapper
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.ApplicationContext
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
...
@@ -78,123 +86,11 @@ public class CustomerAnalysisControl {
...
@@ -78,123 +86,11 @@ public class CustomerAnalysisControl {
@Autowired
@Autowired
private
DictDataApi
dictDataApi
;
private
DictDataApi
dictDataApi
;
/*
@Resource
计算百分比
private
FileMakeApi
fileMakeApi
;
lanbm 2024-04-10 add
*/
private
String
getPercentage
(
BigDecimal
part
,
BigDecimal
total
)
{
BigDecimal
percentage
=
part
.
divide
(
total
,
5
,
BigDecimal
.
ROUND_HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
));
// 输出百分比
String
sR
=
format
(
percentage
)
+
"%"
;
return
sR
;
}
/*
格式化BigDecimal为字符串,保留两位小数
lanbm 2024-04-10 add
*/
private
String
format
(
BigDecimal
value
)
{
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
numberFormat
.
setMinimumFractionDigits
(
2
);
numberFormat
.
setMaximumFractionDigits
(
2
);
return
numberFormat
.
format
(
value
.
doubleValue
());
}
private
String
getCurDate
()
{
Date
date
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
currentDate
=
sdf
.
format
(
date
);
return
currentDate
;
}
private
int
getCurYear
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
return
year
;
}
/*
获取数据查询条件
*/
private
CustomerAnalysisReq
getDataWhere
(
CustomerAnalysisReq
query
)
{
if
(
query
.
getSearchDataType1
()
!=
null
&&
query
.
getSearchDataType2
()
!=
null
&&
query
.
getSearchDataType3
()
!=
null
)
{
}
return
query
;
}
/*
对查询逻辑做处理 lanbm 2024-04-16 add
*/
private
CustomerAnalysisReq
getReq
(
CustomerAnalysisReq
Req
)
{
//计算月份差
long
lc
=
monthDiff
(
Req
.
getSdate
(),
Req
.
getEdate
());
if
(
lc
==
0
)
{
lc
=
1
;
}
Req
.
setNMonth
(
Integer
.
parseInt
(
String
.
valueOf
(
lc
)));
int
y
=
getCurYear
();
if
(
Req
.
getSdate
()
==
null
)
{
Req
.
setCurYear
(
String
.
valueOf
(
y
));
Req
.
setSdate
(
String
.
valueOf
(
y
)
+
"-01-01"
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
Req
.
setDuibiYear
(
String
.
valueOf
(
y
-
1
));
}
else
{
Req
.
setSduibidate
(
Req
.
getDuibiYear
()
+
"-01-01"
);
}
}
else
{
//2024-03-01
String
sT
=
Req
.
getSdate
();
String
s
=
sT
.
substring
(
4
,
10
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
int
nTemp
=
Integer
.
parseInt
(
sT
.
substring
(
0
,
4
))
-
1
;
Req
.
setSduibidate
(
String
.
valueOf
(
nTemp
)
+
s
);
}
else
{
Req
.
setSduibidate
(
Req
.
getDuibiYear
()
+
s
);
}
Req
.
setCurYear
(
sT
.
substring
(
0
,
4
));
}
if
(
Req
.
getEdate
()
==
null
)
{
Req
.
setEdate
(
getCurDate
());
String
s
=
Req
.
getEdate
().
substring
(
5
,
7
);
int
ld
=
getLastDay
(
Integer
.
parseInt
(
Req
.
getDuibiYear
()),
Integer
.
parseInt
(
s
));
Req
.
setEduibidate
(
Req
.
getDuibiYear
()
+
"-"
+
s
+
"-"
+
String
.
valueOf
(
ld
));
}
else
{
String
sE
=
Req
.
getEdate
();
String
sY
=
sE
.
substring
(
0
,
4
);
//int ld = getLastDay(Integer.parseInt(sY), Integer.parseInt(s));
//2024-03-01
String
s1
=
sE
.
substring
(
4
,
10
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
int
nTemp
=
Integer
.
parseInt
(
sY
)
-
1
;
Req
.
setEduibidate
(
String
.
valueOf
(
nTemp
)
+
s1
);
}
else
{
Req
.
setEduibidate
(
Req
.
getDuibiYear
()
+
s1
);
}
}
return
Req
;
}
/*
@Resource
获取某年某月的最后一天 lanbm 2024-04-16 add
private
ApplicationContext
applicationContext
;
*/
private
int
getLastDay
(
int
year
,
int
month
)
{
YearMonth
yearMonth
=
YearMonth
.
of
(
year
,
month
);
int
lastDay
=
yearMonth
.
lengthOfMonth
();
return
lastDay
;
}
/*
/*
...
@@ -219,7 +115,8 @@ public class CustomerAnalysisControl {
...
@@ -219,7 +115,8 @@ public class CustomerAnalysisControl {
LambdaQueryWrapper
<
EcwReportPermission
>
lambdaQueryWrapper
=
LambdaQueryWrapper
<
EcwReportPermission
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
();
new
LambdaQueryWrapper
();
lambdaQueryWrapper
.
eq
(
EcwReportPermission:
:
getUserId
,
loginUserId
);
lambdaQueryWrapper
.
eq
(
EcwReportPermission:
:
getUserId
,
loginUserId
);
List
<
EcwReportPermission
>
objList
=
ecwReportPermissionService
.
list
(
lambdaQueryWrapper
);
List
<
EcwReportPermission
>
objList
=
ecwReportPermissionService
.
list
(
lambdaQueryWrapper
);
if
(
objList
==
null
||
objList
.
size
()
==
0
)
{
if
(
objList
==
null
||
objList
.
size
()
==
0
)
{
ErrorCode
eCode
=
new
ErrorCode
(
2024041504
,
ErrorCode
eCode
=
new
ErrorCode
(
2024041504
,
"当前用户未分配报表权限,请联系系统管理员处理。"
);
"当前用户未分配报表权限,请联系系统管理员处理。"
);
...
@@ -230,563 +127,51 @@ public class CustomerAnalysisControl {
...
@@ -230,563 +127,51 @@ public class CustomerAnalysisControl {
CustomerAnalysisReq
query
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
CustomerAnalysisReq
query
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
CustomerAnalysisReq
.
class
);
CustomerAnalysisReq
.
class
);
query
=
getReq
(
query
);
query
=
getDataWhere
(
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
PageResult
<
CustomerAnalysisResp
>
pageResult
=
GetDataResult
(
query
);
return
success
(
pageResult
);
}
private
PageResult
<
CustomerAnalysisResp
>
GetDataResult
(
CustomerAnalysisReq
query
)
throws
JsonProcessingException
{
//把model转 JSON字符串 lanbm
//String jsonStr = JsonUtils.toJsonString(query);
//JsonUtils.SaveLog(jsonStr);
System
.
out
.
println
(
"客户分析查询条件为:"
+
query
);
List
<
DictDataRespDTO
>
dicCustomer_type
=
dictDataApi
.
getDictDatas
(
"customer_type"
);
Map
<
String
,
String
>
mapDic
=
new
HashMap
<>();
for
(
DictDataRespDTO
d
:
dicCustomer_type
)
{
mapDic
.
put
(
d
.
getValue
(),
d
.
getLabel
());
}
PageResult
<
CustomerAnalysisResp
>
pageResult
=
PageResult
<
CustomerAnalysisResp
>
pageResult
=
customerAnalysisService
.
getListPage
(
query
);
customerAnalysisService
.
GetDataResult
(
query
);
String
sTemp
=
""
;
int
nPm
=
query
.
getStart
()
+
1
;
for
(
CustomerAnalysisResp
r
:
pageResult
.
getList
())
{
r
.
setPx
(
nPm
);
nPm
++;
//客户类型转换
String
sType
=
r
.
getType
();
if
(
sType
==
null
)
{
r
.
setCustomerrole
(
""
);
}
else
{
r
.
setCustomerrole
(
mapDic
.
get
(
sType
));
}
if
(
r
.
getAllsumvolume
()
==
null
||
r
.
getAllsumvolume
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
//计算月均
r
=
calMonthAvg
(
query
,
r
,
true
);
//计算总值
r
=
calAll
(
r
,
true
);
//计算海运数据
r
=
cal1
(
query
,
r
,
true
);
//计算空运数据
r
=
cal3
(
query
,
r
,
true
);
//计算重货数据
r
=
calZH
(
r
,
true
);
//计算泡货数据
r
=
calPH
(
r
,
true
);
//计算控货数据
r
=
calKH
(
r
,
true
);
}
else
{
//计算月均
r
=
calMonthAvg
(
query
,
r
,
false
);
//计算总值
r
=
calAll
(
r
,
false
);
//计算海运数据
r
=
cal1
(
query
,
r
,
false
);
//计算空运数据
r
=
cal3
(
query
,
r
,
false
);
//重货
r
=
calZH
(
r
,
false
);
//计算泡货占比
r
=
calPH
(
r
,
false
);
//计算控货占比
r
=
calKH
(
r
,
false
);
}
r
=
calPick
(
r
,
false
);
}
return
pageResult
;
}
private
CustomerAnalysisResp
calMonthAvg
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
r
.
setMonthAvg
(
"0"
);
}
else
{
r
.
setMonthAvg
(
r
.
getAllsumvolume
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
}
//计算同比
if
(
r
.
getAllsumvolumeTb
()
==
null
||
r
.
getAllsumvolumeTb
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setMonthAvgTbShow
(
"同期值为0"
);
}
else
{
sTemp
=
getPercentage
(
(
r
.
getAllsumvolume
().
subtract
(
r
.
getAllsumvolumeTb
())),
r
.
getAllsumvolumeTb
());
r
.
setMonthAvgTbShow
(
sTemp
);
}
return
r
;
}
/*
总值计算
*/
private
CustomerAnalysisResp
calAll
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getAllsumvolumeTb
()
==
null
||
r
.
getAllsumvolumeTb
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolumeTbShow
(
"同期V值为0"
);
}
else
{
//(本期-同期)/同期
sTemp
=
getPercentage
(
(
r
.
getAllsumvolume
().
subtract
(
r
.
getAllsumvolumeTb
())),
r
.
getAllsumvolumeTb
());
r
.
setAllsumvolumeTbShow
(
sTemp
);
}
return
r
;
}
/*
计算提货数据
*/
private
CustomerAnalysisResp
calPick
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
r
.
getChargequantity
()
==
0
)
{
r
.
setThL
(
"总箱数为0"
);
}
else
{
r
.
setThL
(
getIntPercentage
(
r
.
getPickquantity
(),
r
.
getChargequantity
()));
}
return
r
;
}
/*
处理海运数据
*/
private
CustomerAnalysisResp
cal1
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getSumvolume1
()
==
null
||
r
.
getSumvolume1
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//海运V值
r
.
setSumvolumeV1
(
new
BigDecimal
(
0
));
//海运体积数
r
.
setSumvolume1
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setSeaZb
(
"总值为0"
);
//海运月均
r
.
setSeaMonthAvg
(
"总值为0"
);
}
else
{
//海运占比
r
.
setSeaZb
(
"0"
);
//海运月均
r
.
setSeaMonthAvg
(
"0"
);
}
}
else
{
//设置海运V值
r
.
setSumvolumeV1
(
r
.
getSumvolume1
());
if
(
bZzNull
==
true
)
{
r
.
setSeaZb
(
"总值为0"
);
}
else
{
r
.
setSeaZb
(
getPercentage
(
r
.
getSumvolumeV1
(),
r
.
getAllsumvolume
()));
}
//月均V值 是体积
r
.
setSeaMonthAvg
(
r
.
getSumvolume1
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
}
if
(
r
.
getSumvolumeTb1
()
==
null
||
r
.
getSumvolumeTb1
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumvolumeTbV1
(
new
BigDecimal
(
0
));
r
.
setSumvolumeTbShow1
(
"同期为0"
);
}
else
{
r
.
setSumvolumeTbV1
(
new
BigDecimal
(
100
).
multiply
(
r
.
getSumvolumeTb1
()));
sTemp
=
getPercentage
(
(
r
.
getSumvolumeV1
().
subtract
(
r
.
getSumvolumeTbV1
())),
r
.
getSumvolumeTbV1
());
r
.
setSumvolumeTbShow1
(
sTemp
);
}
return
r
;
}
/*
处理空运数据
*/
private
CustomerAnalysisResp
cal3
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
//当期值
if
(
r
.
getSumweight3
()
==
null
||
r
.
getSumweight3
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumweightV3
(
new
BigDecimal
(
0
));
r
.
setSumweight3
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setAirZb
(
"总值为0"
);
r
.
setAirMothAvg
(
"总值为0"
);
}
else
{
r
.
setAirZb
(
"0"
);
r
.
setAirMothAvg
(
"0"
);
}
}
else
{
r
.
setSumweightV3
(
r
.
getSumweight3
().
multiply
(
new
BigDecimal
(
100
)));
if
(
bZzNull
==
true
)
{
r
.
setAirZb
(
"总值为0"
);
}
else
{
r
.
setAirZb
(
getPercentage
(
r
.
getSumweightV3
(),
r
.
getAllsumvolume
()));
}
//月均是 重量
r
.
setAirMothAvg
(
r
.
getSumweight3
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
}
//同期值
if
(
r
.
getSumweightTb3
()
==
null
||
r
.
getSumweightTb3
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumweightTb3
(
new
BigDecimal
(
0
));
r
.
setSumweightTbV3
(
new
BigDecimal
(
0
));
r
.
setSumweightTbShow3
(
"同期值为0"
);
}
else
{
r
.
setSumweightTbV3
(
r
.
getSumweightTb3
().
multiply
(
new
BigDecimal
(
100
)));
sTemp
=
getPercentage
(
(
r
.
getSumweightV3
().
subtract
(
r
.
getSumweightTbV3
())),
r
.
getSumweightTbV3
());
r
.
setSumweightTbShow3
(
sTemp
);
}
return
r
;
}
/*
计算重货数据
*/
private
CustomerAnalysisResp
calZH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//总值为0的情况
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
//重货 占比
if
(
r
.
getWeightSumV
()
==
null
||
r
.
getWeightSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setWeightSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setWeithtSumZb
(
"总值为0"
);
}
else
{
r
.
setWeithtSumZb
(
"0"
);
}
}
else
{
r
.
setWeithtSumZb
(
getPercentage
(
r
.
getWeightSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
/*
计算泡货数据
*/
private
CustomerAnalysisResp
calPH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//泡货 占比
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getPhSumV
()
==
null
||
r
.
getPhSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setPhSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setPhSumZb
(
"总值为0"
);
}
else
{
r
.
setPhSumZb
(
"0"
);
}
}
else
{
r
.
setPhSumZb
(
getPercentage
(
r
.
getPhSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
/*
计算控货数据
*/
private
CustomerAnalysisResp
calKH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//控货 占比
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getKhSumV
()
==
null
||
r
.
getKhSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setKhSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setKhSumZb
(
"总值为0"
);
}
else
{
r
.
setKhSumZb
(
"0"
);
}
}
else
{
r
.
setKhSumZb
(
getPercentage
(
r
.
getKhSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
private
String
getIntPercentage
(
int
number
,
int
divisor
)
{
// 计算百分比
double
percentage
=
number
/
(
double
)
divisor
;
// 格式化输出百分比
String
formatted
=
String
.
format
(
"%.2f%%"
,
percentage
);
return
formatted
;
}
private
int
monthDiff
(
String
dateString1
,
String
dateString2
)
{
// 将字符串转换为 LocalDate 对象
LocalDate
date1
=
LocalDate
.
parse
(
dateString1
);
LocalDate
date2
=
LocalDate
.
parse
(
dateString2
);
// 获软时间1的年份和月份
int
year1
=
date1
.
getYear
();
int
month1
=
date1
.
getMonthValue
();
// 获取时间2的年份和月份
int
year2
=
date2
.
getYear
();
int
month2
=
date2
.
getMonthValue
();
// 计算时间1的总月数
int
totalMonths1
=
year1
*
12
+
month1
;
// 计算时间2的总月数
int
totalMonths2
=
year2
*
12
+
month2
;
// 计算总月数差
int
monthsDiff
=
totalMonths2
-
totalMonths1
;
return
monthsDiff
;
}
private
List
<
CustomerAnalysisResp
>
GetPageResult
(
List
<
CustomerAnalysisResp
>
list
,
int
pageNum
,
int
pageSize
)
{
/*
// 正序
Collections.sort(list, (a, b) -> {
return a.排序字段 - b.排序字段;
});
// 倒序
Collections.sort(list, (a, b) -> {
return b.排序字段 - a.排序字段;
});*/
// 总数
int
total
=
list
.
size
();
// 分页数据
List
<
CustomerAnalysisResp
>
subList
=
list
.
stream
().
skip
((
pageNum
-
1
)
*
pageSize
).
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
return
subList
;
return
success
(
pageResult
);
}
}
@GetMapping
(
"/exportExcel"
)
@GetMapping
(
"/exportExcel"
)
@ApiOperation
(
"导出客户分析数据"
)
@ApiOperation
(
"导出客户分析数据"
)
@OperateLog
(
type
=
EXPORT
)
@OperateLog
(
type
=
EXPORT
)
public
void
export
(
HttpServletResponse
response
,
@Valid
CustomerAnalysisReq
query
)
throws
IOException
{
public
void
export
(
HttpServletResponse
response
,
@Valid
CustomerAnalysisReq
query
)
throws
IOException
{
query
=
getReq
(
query
);
query
=
customerAnalysisService
.
getReq
(
query
);
query
=
getDataWhere
(
query
);
query
=
customerAnalysisService
.
getDataWhere
(
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
PageResult
<
CustomerAnalysisResp
>
pageResult
=
GetDataResult
(
query
);
List
<
CustomerAnalysisResp
>
list
=
List
<
CustomerAnalysisResp
>
list
=
pageResult
.
getList
(
);
customerAnalysisService
.
GetDataListResult
(
query
);
List
<
CustomerAnalysisExcelResp
>
listExel
=
List
<
CustomerAnalysisExcelResp
>
listExel
=
CustomerAnalysis
.
INSTANCE
.
convertList
(
list
);
CustomerAnalysis
.
INSTANCE
.
convertList
(
list
);
// 导出 Excel
// 导出 Excel
ExcelUtils
.
write
(
response
,
"客户分析报表.xls"
,
"客户分析报表"
,
ExcelUtils
.
write
(
response
,
"客户分析报表.xls"
,
"客户分析报表"
,
CustomerAnalysisExcelResp
.
class
,
listExel
);
CustomerAnalysisExcelResp
.
class
,
listExel
);
}
}
@GetMapping
(
"/exportExcel2"
)
@PostMapping
(
"/getListPageWithRedis"
)
@ApiOperation
(
"导出客户分析数据"
)
public
CommonResult
<
PageResult
<
CustomerAnalysisResp
>>
@OperateLog
(
type
=
EXPORT
)
getListPageWithRedis
(
@RequestBody
Map
map
)
throws
JsonProcessingException
{
public
CommonResult
<
Boolean
>
export2
(
HttpServletResponse
response
,
//ecw_customer 的部门字段都为空 department 都为空,所以要关联客户经理所在的部门来查询
@Valid
CustomerAnalysisReq
query
)
throws
IOException
{
//ecw_order_item order_item_type 订单类型:1 普货 2 重货 3 泡货
query
=
customerAnalysisService
.
getReq
(
query
);
//ecw_order order_type 订单类型:1 普货 2 重货 3 泡货
query
=
customerAnalysisService
.
getDataWhere
(
query
);
// is_cargo_control 是否控货 1 控货,0不控货
//同比增长速度=(本期发展水平-同期发展水平)/同期发展水平×100%
//客户角色数据字典
//客户表和数据字典表中的编码方式不一样,做关联查询有异常,为了不改变表的编码方式,在后台做转换
//获取当前用户ID
//先判断用户有什么报表权限
Long
loginUserId
=
SecurityFrameworkUtils
.
getLoginUserId
();
LambdaQueryWrapper
<
EcwReportPermission
>
lambdaQueryWrapper
=
new
LambdaQueryWrapper
();
lambdaQueryWrapper
.
eq
(
EcwReportPermission:
:
getUserId
,
loginUserId
);
List
<
EcwReportPermission
>
objList
=
ecwReportPermissionService
.
list
(
lambdaQueryWrapper
);
if
(
objList
==
null
||
objList
.
size
()
==
0
)
{
ErrorCode
eCode
=
new
ErrorCode
(
2024041504
,
"当前用户未分配报表权限,请联系系统管理员处理。"
);
return
error
(
eCode
);
}
System
.
out
.
println
(
map
);
CustomerAnalysisReq
query
=
JSON
.
parseObject
(
JSON
.
toJSONString
(
map
),
CustomerAnalysisReq
.
class
);
query
=
getReq
(
query
);
query
=
getDataWhere
(
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
//把model转 JSON字符串 lanbm
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
//String jsonStr = JsonUtils.toJsonString(query);
reqDTO
.
setType
(
DownloadTypeEnum
.
REPORT_CSSTOMER_ANALYSIS
.
getType
());
//JsonUtils.SaveLog(jsonStr);
reqDTO
.
setName
(
"客户分析报表"
);
reqDTO
.
setFileSuffix
(
"xlsx"
);
System
.
out
.
println
(
"客户分析查询条件为:"
+
query
);
reqDTO
.
setTemporaryFile
(
true
);
reqDTO
.
setUserType
(
2
);
List
<
DictDataRespDTO
>
dicCustomer_type
=
reqDTO
.
setLang
(
I18nMessage
.
getLang
());
dictDataApi
.
getDictDatas
(
"customer_type"
);
reqDTO
.
setRequestParams
(
JSONObject
.
toJSONString
(
query
));
Map
<
String
,
String
>
mapDic
=
new
HashMap
<>();
fileMakeApi
.
sendFileMake
(
reqDTO
);
for
(
DictDataRespDTO
d
:
dicCustomer_type
return
CommonResult
.
success
(
true
);
)
{
mapDic
.
put
(
d
.
getValue
(),
d
.
getLabel
());
}
ObjectMapper
objectMapper
=
new
ObjectMapper
();
String
sList
=
redisHelper
.
get
(
"view_order_businesstime"
);
if
(
sList
==
null
||
sList
.
length
()
==
0
)
{
listBData
=
vieworderbusinesstimeService
.
getOrderBusinessData
();
String
json
=
objectMapper
.
writeValueAsString
(
listBData
);
redisHelper
.
set
(
"view_order_businesstime"
,
json
);
}
else
{
if
(
listBData
==
null
)
{
listBData
=
JSON
.
parseArray
(
sList
,
view_order_businesstime
.
class
);
}
}
}
String
sList2
=
redisHelper
.
get
(
"CustomerAnalysisResp"
);
if
(
sList2
==
null
||
sList2
.
length
()
==
0
)
{
objListResult
=
customerAnalysisService2
.
getList
(
query
);
String
json
=
objectMapper
.
writeValueAsString
(
objListResult
);
redisHelper
.
set
(
"CustomerAnalysisResp"
,
json
);
}
else
{
objListResult
=
JSON
.
parseArray
(
sList2
,
CustomerAnalysisResp
.
class
);
}
if
(
query
.
getCountry
()
!=
null
&&
query
.
getCountry
().
length
()
>
0
)
{
int
cC
=
Integer
.
parseInt
(
query
.
getCountry
());
objListResult
=
objListResult
.
stream
().
filter
(
c
->
c
.
getCountryID
()
==
cC
).
collect
(
Collectors
.
toList
());
}
String
sTemp
=
""
;
int
nPm
=
1
;
for
(
CustomerAnalysisResp
r
:
objListResult
)
{
r
.
setPx
(
nPm
);
nPm
++;
//客户类型转换
String
sType
=
r
.
getType
();
if
(
sType
==
null
)
{
r
.
setCustomerrole
(
""
);
}
else
{
r
.
setCustomerrole
(
mapDic
.
get
(
sType
));
}
String
sID
=
r
.
getId
();
List
<
view_order_businesstime
>
lAll
=
listBData
.
stream
().
filter
(
c
->
c
.
getCustomerid
()
==
sID
).
collect
(
Collectors
.
toList
());
BigDecimal
sumV
=
lAll
.
stream
().
map
(
view_order_businesstime:
:
getVz
).
reduce
(
BigDecimal
.
ZERO
,
BigDecimal:
:
add
);
r
.
setAllsumvolume
(
sumV
);
if
(
r
.
getAllsumvolume
()
==
null
||
r
.
getAllsumvolume
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
//计算月均
r
=
calMonthAvg
(
query
,
r
,
true
);
//计算总值
r
=
calAll
(
r
,
true
);
//计算海运数据
r
=
cal1
(
query
,
r
,
true
);
//计算空运数据
r
=
cal3
(
query
,
r
,
true
);
//计算重货数据
r
=
calZH
(
r
,
true
);
//计算泡货数据
r
=
calPH
(
r
,
true
);
//计算控货数据
r
=
calKH
(
r
,
true
);
}
else
{
//计算月均
r
=
calMonthAvg
(
query
,
r
,
false
);
//计算总值
r
=
calAll
(
r
,
false
);
//计算海运数据
r
=
cal1
(
query
,
r
,
false
);
//计算空运数据
r
=
cal3
(
query
,
r
,
false
);
//重货
r
=
calZH
(
r
,
false
);
//计算泡货占比
r
=
calPH
(
r
,
false
);
//计算控货占比
r
=
calKH
(
r
,
false
);
}
r
=
calPick
(
r
,
false
);
}
IPage
<
CustomerAnalysisResp
>
mpPage
=
MyBatisUtils
.
buildPage
(
query
);
long
total
=
objListResult
.
size
();
System
.
out
.
println
(
"符合条件的客户总数:"
+
String
.
valueOf
(
total
));
List
<
CustomerAnalysisResp
>
list
=
GetPageResult
(
objListResult
,
query
.
getPageNo
(),
query
.
getPageSize
());
PageResult
<
CustomerAnalysisResp
>
pageResult
=
new
PageResult
<>(
list
,
total
,
mpPage
.
getSize
(),
query
.
getPageNo
(),
(
total
+
mpPage
.
getSize
()
-
1
)
/
mpPage
.
getSize
());
return
success
(
pageResult
);
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/CustomerReportControl.java
View file @
6fc4a7ce
...
@@ -189,8 +189,12 @@ public class CustomerReportControl {
...
@@ -189,8 +189,12 @@ public class CustomerReportControl {
List
<
String
>
l
=
new
ArrayList
<>();
List
<
String
>
l
=
new
ArrayList
<>();
int
nT
=
1
;
for
(
CustomerReportResp
cr
:
lis
)
{
for
(
CustomerReportResp
cr
:
lis
)
{
l
.
add
(
cr
.
getName
());
//top 加客户编号,客户名称
l
.
add
(
"Top "
+
String
.
valueOf
(
nT
)+
"_"
+
cr
.
getNumber
()+
"_"
+
cr
.
getName
());
//l.add("Top "+String.valueOf(nT));
nT
++;
cr
.
setDuibiYear
(
Req
.
getDuibiYear
());
cr
.
setDuibiYear
(
Req
.
getDuibiYear
());
}
}
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/SalesAnalysisControl.java
View file @
6fc4a7ce
...
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
...
@@ -5,6 +5,7 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq
;
...
@@ -13,10 +14,15 @@ import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
...
@@ -13,10 +14,15 @@ import cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq;
import
cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp
;
import
cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp
;
import
cn.iocoder.yudao.module.delivery.service.SalesAnalysisService
;
import
cn.iocoder.yudao.module.delivery.service.SalesAnalysisService
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
cn.iocoder.yudao.module.system.api.file.FileMakeApi
;
import
cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO
;
import
cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
javax.annotation.Resource
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.servlet.http.HttpServletResponse
;
import
javax.validation.Valid
;
import
javax.validation.Valid
;
import
java.io.IOException
;
import
java.io.IOException
;
...
@@ -46,14 +52,69 @@ public class SalesAnalysisControl {
...
@@ -46,14 +52,69 @@ public class SalesAnalysisControl {
@Autowired
@Autowired
private
DictDataApi
dictDataApi
;
private
DictDataApi
dictDataApi
;
@Resource
private
FileMakeApi
fileMakeApi
;
/*
根据原始信息计算逻辑展示信息 lanbm 2024-04-29 add
*/
private
SalesAnalysisResp
calBis
(
SalesAnalysisResp
r
)
{
String
sTemp
=
""
;
//付款方
if
(
r
.
getDrawee
().
equals
(
"1"
))
{
if
(
r
.
getCfResourceType
().
equals
(
"1"
))
{
r
.
setShowResourceType
(
"开发客户"
);
}
else
if
(
r
.
getCfResourceType
().
equals
(
"2"
))
{
r
.
setShowResourceType
(
"公司客户"
);
}
if
(
r
.
getCfYeJiType
().
equals
(
"0"
))
{
r
.
setShowYeJiType
(
"老客户"
);
}
else
if
(
r
.
getCfYeJiType
().
equals
(
"1"
))
{
r
.
setShowYeJiType
(
"新客户"
);
}
sTemp
=
"发货方"
;
}
else
if
(
r
.
getDrawee
().
equals
(
"2"
))
{
if
(
r
.
getShResourceType
().
equals
(
"1"
))
{
r
.
setShowResourceType
(
"开发客户"
);
}
else
if
(
r
.
getShResourceType
().
equals
(
"2"
))
{
r
.
setShowResourceType
(
"公司客户"
);
}
if
(
r
.
getShYeJitype
().
equals
(
"0"
))
{
r
.
setShowYeJiType
(
"老客户"
);
}
else
if
(
r
.
getShYeJitype
().
equals
(
"1"
))
{
r
.
setShowYeJiType
(
"新客户"
);
}
sTemp
=
"收货方"
;
}
else
if
(
r
.
getDrawee
().
equals
(
"3"
))
{
if
(
r
.
getCfResourceType
().
equals
(
"1"
))
{
r
.
setShowResourceType
(
"开发客户"
);
}
else
if
(
r
.
getCfResourceType
().
equals
(
"2"
))
{
r
.
setShowResourceType
(
"公司客户"
);
}
if
(
r
.
getCfYeJiType
().
equals
(
"0"
))
{
r
.
setShowYeJiType
(
"老客户"
);
}
else
if
(
r
.
getCfYeJiType
().
equals
(
"1"
))
{
r
.
setShowYeJiType
(
"新客户"
);
}
sTemp
=
"自定义"
;
}
r
.
setDraweeName
(
sTemp
);
return
r
;
}
/*
/*
客户分析列表 lanbm 2024-04-02 add
客户分析列表 lanbm 2024-04-02 add
*/
*/
@GetMapping
(
"/getListPage"
)
@GetMapping
(
"/getListPage"
)
public
CommonResult
<
PageResult
<
SalesAnalysisResp
>>
getListPage
(
@Valid
SalesAnalysisReq
query
)
{
public
CommonResult
<
PageResult
<
SalesAnalysisResp
>>
getListPage
(
@Valid
SalesAnalysisReq
query
)
{
System
.
out
.
println
(
"订单分析查询条件:"
+
query
);
System
.
out
.
println
(
"订单分析查询条件:"
+
query
);
/*
/*
SalesAnalysisReq query = JSON.parseObject(JSON.toJSONString(map),
SalesAnalysisReq query = JSON.parseObject(JSON.toJSONString(map),
SalesAnalysisReq.class);
SalesAnalysisReq.class);
...
@@ -73,6 +134,7 @@ public class SalesAnalysisControl {
...
@@ -73,6 +134,7 @@ public class SalesAnalysisControl {
salesAnalysisService
.
getListPage
(
query
);
salesAnalysisService
.
getListPage
(
query
);
int
nPm
=
query
.
getStart
()
+
1
;
int
nPm
=
query
.
getStart
()
+
1
;
String
sTemp
=
""
;
for
(
SalesAnalysisResp
r
:
pageResult
.
getList
()
for
(
SalesAnalysisResp
r
:
pageResult
.
getList
()
)
{
)
{
r
.
setPx
(
nPm
);
r
.
setPx
(
nPm
);
...
@@ -81,14 +143,27 @@ public class SalesAnalysisControl {
...
@@ -81,14 +143,27 @@ public class SalesAnalysisControl {
//订单状态
//订单状态
r
.
setStatusName
(
map_order_status
.
get
(
r
.
getStatus
()));
r
.
setStatusName
(
map_order_status
.
get
(
r
.
getStatus
()));
if
(
r
.
getTransportId
()
==
"1"
)
String
sType
=
""
;
r
.
setTransportIdName
(
"海运拼柜"
);
if
(
r
.
getOrdertype
()
==
2
)
{
else
if
(
r
.
getTransportId
()
==
"3"
)
//是重货,非泡货
r
.
setTransportIdName
(
"专线空运"
);
sType
=
"是/否"
;
}
else
if
(
r
.
getOrdertype
()
==
3
)
{
sType
=
"否/是"
;
}
else
if
(
r
.
getOrdertype
()
==
1
)
{
sType
=
"普货"
;
}
}
r
.
setOrdertypeShow
(
sType
);
//业务数据逻辑运算
r
=
calBis
(
r
);
if
(
r
.
getUseweightunit
()
==
null
)
r
.
setUseweightunit
(
"无"
);
if
(
r
.
getUsevolumeunit
()
==
null
)
r
.
setUsevolumeunit
(
"无"
);
r
.
setZpUnitShow
(
r
.
getUseweightunit
()
+
"/"
+
r
.
getUsevolumeunit
());
}
return
success
(
pageResult
);
return
success
(
pageResult
);
}
}
...
@@ -98,13 +173,26 @@ public class SalesAnalysisControl {
...
@@ -98,13 +173,26 @@ public class SalesAnalysisControl {
@GetMapping
(
"/exportExcel"
)
@GetMapping
(
"/exportExcel"
)
@ApiOperation
(
"导出销售分析数据"
)
@ApiOperation
(
"导出销售分析数据"
)
@OperateLog
(
type
=
EXPORT
)
@OperateLog
(
type
=
EXPORT
)
public
void
export
(
HttpServletResponse
response
,
public
CommonResult
<
Boolean
>
export
(
HttpServletResponse
response
,
@Valid
SalesAnalysisReq
Req
)
@Valid
SalesAnalysisReq
Req
)
throws
IOException
{
throws
IOException
{
System
.
out
.
println
(
"订单分析查询数据导出查询条件:"
+
Req
);
System
.
out
.
println
(
"订单分析查询数据导出查询条件:"
+
Req
);
FileMakeReqDTO
reqDTO
=
new
FileMakeReqDTO
();
reqDTO
.
setType
(
DownloadTypeEnum
.
REPORT_SALES_ANALYSIS
.
getType
());
reqDTO
.
setName
(
"销售分析数据"
);
reqDTO
.
setFileSuffix
(
"xlsx"
);
reqDTO
.
setTemporaryFile
(
true
);
reqDTO
.
setUserType
(
2
);
reqDTO
.
setLang
(
I18nMessage
.
getLang
());
reqDTO
.
setRequestParams
(
JSONObject
.
toJSONString
(
Req
));
fileMakeApi
.
sendFileMake
(
reqDTO
);
return
CommonResult
.
success
(
true
);
/*
List<SalesAnalysisExcelResp> list = salesAnalysisService.getList(Req);
List<SalesAnalysisExcelResp> list = salesAnalysisService.getList(Req);
ExcelUtils.write(response, "销售分析数据.xls", "销售分析数据",
ExcelUtils.write(response, "销售分析数据.xls", "销售分析数据",
SalesAnalysisExcelResp
.
class
,
list
);
SalesAnalysisExcelResp.class, list);
*/
}
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/SalesReportControl.java
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
controller
.
admin
;
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
controller
.
admin
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.module.delivery.entity.SalesReportReq
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.module.delivery.entity.SalesReportResp
;
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
cn.iocoder.yudao.module.delivery.service.SalesReportService
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
javax.validation.Valid
;
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
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
common
.
pojo
.
CommonResult
.
success
;
/**
/**
...
@@ -43,7 +47,7 @@ public class SalesReportControl {
...
@@ -43,7 +47,7 @@ public class SalesReportControl {
*/
*/
@PostMapping
(
"/FirstCustomerCount"
)
@PostMapping
(
"/FirstCustomerCount"
)
public
CommonResult
<
Integer
>
FirstCustomerCount
(
@RequestBody
SalesReportReq
Req
)
{
public
CommonResult
<
Integer
>
FirstCustomerCount
(
@RequestBody
SalesReportReq
Req
)
{
int
nR
=
salesReportService
.
FirstCustomerCount
(
Req
);
int
nR
=
salesReportService
.
FirstCustomerCount
(
Req
);
return
success
(
nR
);
return
success
(
nR
);
}
}
...
@@ -53,8 +57,8 @@ public class SalesReportControl {
...
@@ -53,8 +57,8 @@ public class SalesReportControl {
*/
*/
@PostMapping
(
"/SalesReportCount"
)
@PostMapping
(
"/SalesReportCount"
)
public
CommonResult
<
SalesReportResp
>
SalesReportCount
(
@RequestBody
SalesReportReq
Req
)
{
public
CommonResult
<
SalesReportResp
>
SalesReportCount
(
@RequestBody
SalesReportReq
Req
)
{
String
s
=
""
;
String
s
=
""
;
SalesReportResp
re
=
salesReportService
.
SalesReportCount
(
Req
);
SalesReportResp
re
=
salesReportService
.
SalesReportCount
(
Req
);
return
success
(
re
);
return
success
(
re
);
}
}
...
@@ -64,11 +68,87 @@ public class SalesReportControl {
...
@@ -64,11 +68,87 @@ public class SalesReportControl {
*/
*/
@PostMapping
(
"/SalesReportList"
)
@PostMapping
(
"/SalesReportList"
)
public
CommonResult
<
Integer
>
SalesReportList
(
@RequestBody
SalesReportReq
Req
)
{
public
CommonResult
<
Integer
>
SalesReportList
(
@RequestBody
SalesReportReq
Req
)
{
int
nR
=
salesReportService
.
FirstCustomerCount
(
Req
);
int
nR
=
salesReportService
.
FirstCustomerCount
(
Req
);
return
success
(
nR
);
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
);
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/entity/CustomerAnalysisReq.java
View file @
6fc4a7ce
...
@@ -5,6 +5,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
...
@@ -5,6 +5,8 @@ import io.swagger.v3.oas.annotations.media.Schema;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.ToString
;
import
lombok.ToString
;
import
java.math.BigDecimal
;
/*
/*
客户分析报表
客户分析报表
逻辑数据大部分集中在表 ecw_customer
逻辑数据大部分集中在表 ecw_customer
...
@@ -29,10 +31,6 @@ public class CustomerAnalysisReq extends PageParam {
...
@@ -29,10 +31,6 @@ public class CustomerAnalysisReq extends PageParam {
private
String
name
;
private
String
name
;
private
String
searchtype
;
private
String
searchtype
;
/*
是否新客户
*/
private
int
isnew
;
/*
/*
客户国家
客户国家
...
@@ -71,6 +69,11 @@ public class CustomerAnalysisReq extends PageParam {
...
@@ -71,6 +69,11 @@ public class CustomerAnalysisReq extends PageParam {
*/
*/
private
int
first
;
private
int
first
;
/*
业绩类型
*/
private
int
cusYjType
;
/*
/*
客户角色
客户角色
*/
*/
...
@@ -81,17 +84,29 @@ public class CustomerAnalysisReq extends PageParam {
...
@@ -81,17 +84,29 @@ public class CustomerAnalysisReq extends PageParam {
数据筛选类型
数据筛选类型
*/
*/
private
String
searchDataType1
;
private
String
searchDataType1
;
private
BigDecimal
searchData1
;
//总V值查询
private
String
searchDataType2
;
private
String
searchDataType2
;
private
BigDecimal
searchData2
;
//海运拼柜
private
String
searchDataType3
;
private
String
searchDataType3
;
private
BigDecimal
searchData3
;
//专线空运
/*
/*
客户
时间筛选条件
客户
创建时间
*/
*/
private
String
searchDataType4
;
private
String
searchDataType4
;
private
String
sdate4
;
private
String
sdate4
;
private
String
edate4
;
private
String
edate4
;
/*
首次成交时间
*/
private
String
sdate5
;
private
String
edate5
;
/*
/*
时间筛选类型
时间筛选类型
首次成交日期,客户创建日期
首次成交日期,客户创建日期
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/entity/CustomerAnalysisResp.java
View file @
6fc4a7ce
...
@@ -87,7 +87,6 @@ public class CustomerAnalysisResp {
...
@@ -87,7 +87,6 @@ public class CustomerAnalysisResp {
*/
*/
private
String
sumvolumeTbShow1
;
private
String
sumvolumeTbShow1
;
/*
/*
专线空运
专线空运
*/
*/
...
@@ -120,22 +119,25 @@ public class CustomerAnalysisResp {
...
@@ -120,22 +119,25 @@ public class CustomerAnalysisResp {
海运月均方数
海运月均方数
*/
*/
private
String
seaMonthAvg
;
private
String
seaMonthAvg
;
private
BigDecimal
seaMonthAvgZ
;
/*
/*
海运月均方数同比
海运月均方数同比
*/
*/
private
String
seaMonthAvgTb
;
private
String
seaMonthAvgTb
;
private
BigDecimal
seaMonthAvgTbZ
;
/*
/*
空运月均重量
空运月均重量
*/
*/
private
String
airMothAvg
;
private
String
airMothAvg
;
private
BigDecimal
airMothAvgZ
;
//数值
/*
/*
空运月均同比
空运月均同比
*/
*/
private
String
airMothAvgTb
;
private
String
airMothAvgTb
;
//显示字符串
private
BigDecimal
airMothAvgTbZ
;
//数值
/*
/*
重货总V值
重货总V值
*/
*/
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/entity/SalesAnalysisReq.java
View file @
6fc4a7ce
...
@@ -13,7 +13,6 @@ import lombok.ToString;
...
@@ -13,7 +13,6 @@ import lombok.ToString;
@ToString
(
callSuper
=
true
)
@ToString
(
callSuper
=
true
)
public
class
SalesAnalysisReq
extends
PageParam
{
public
class
SalesAnalysisReq
extends
PageParam
{
private
int
start
;
private
int
start
;
private
int
size
;
private
int
size
;
...
@@ -23,6 +22,7 @@ public class SalesAnalysisReq extends PageParam {
...
@@ -23,6 +22,7 @@ public class SalesAnalysisReq extends PageParam {
*/
*/
private
int
transportId
;
private
int
transportId
;
/*
/*
订单编号查询类型
订单编号查询类型
*/
*/
...
@@ -33,11 +33,30 @@ public class SalesAnalysisReq extends PageParam {
...
@@ -33,11 +33,30 @@ public class SalesAnalysisReq extends PageParam {
private
String
orderNo
;
private
String
orderNo
;
/*
提单的查询类别
*/
private
String
SearchType2
;
/*
/*
提单编号
提单编号
*/
*/
private
String
tidanNo
;
private
String
tidanNo
;
/*
发货人编号
*/
private
String
SearchType3
;
private
String
fhNumber
;
/*
收货人编号
*/
private
String
SearchType4
;
private
String
shNumber
;
/*
/*
销售经理
销售经理
*/
*/
...
@@ -53,8 +72,93 @@ public class SalesAnalysisReq extends PageParam {
...
@@ -53,8 +72,93 @@ public class SalesAnalysisReq extends PageParam {
*/
*/
private
String
marks
;
private
String
marks
;
/*
订单状态
*/
private
String
status
;
/*
始发仓
*/
private
String
startWarehouseId
;
/*
目的国
*/
private
String
muDiGuo
;
/*
目的城市
*/
private
String
muDiShi
;
/*
目的仓
*/
private
String
dstwarehouseid
;
/*
/*
是否控货
是否控货
*/
*/
private
int
isCargoControl
;
private
int
isCargoControl
;
/*
渠道
*/
private
String
shippingChannelId
;
/*
付款方
付款人:1 发货人 2 收货人 3 自定义
*/
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
;
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/entity/SalesAnalysisResp.java
View file @
6fc4a7ce
...
@@ -21,6 +21,10 @@ public class SalesAnalysisResp {
...
@@ -21,6 +21,10 @@ public class SalesAnalysisResp {
*/
*/
private
int
px
;
private
int
px
;
/*
订单ID
*/
private
String
orderId
;
/*
/*
订单编号
订单编号
...
@@ -53,6 +57,32 @@ public class SalesAnalysisResp {
...
@@ -53,6 +57,32 @@ public class SalesAnalysisResp {
*/
*/
private
String
orderConsigneeCusId
;
private
String
orderConsigneeCusId
;
/*
发货人编号
*/
private
String
fhNumber
;
private
long
cfCustomerId
;
/*
收货人编号
*/
private
String
shNumber
;
private
long
shCustomerId
;
/*
资源类型 lanbm 2024-04-29 add
*/
private
String
cfResourceType
;
//发货人资源类型
private
String
shResourceType
;
//收货人资源类型
private
String
showResourceType
;
//显示资源类型,根据付款方来做逻辑判断
/*
业绩类型 新客户,老客户 lanbm 2024-04-29 add
*/
private
String
cfYeJiType
;
//收货人业绩类型
private
String
shYeJitype
;
//发货人业绩类型
private
String
showYeJiType
;
/*
/*
客户经理
客户经理
*/
*/
...
@@ -79,10 +109,12 @@ public class SalesAnalysisResp {
...
@@ -79,10 +109,12 @@ public class SalesAnalysisResp {
/*
/*
目的国
目的国
*/
*/
private
String
muDiGuo
;
/*
/*
目的城市
目的城市
*/
*/
private
String
muDiShi
;
/*
/*
目的仓
目的仓
...
@@ -103,7 +135,16 @@ public class SalesAnalysisResp {
...
@@ -103,7 +135,16 @@ public class SalesAnalysisResp {
/*
/*
入仓箱数
入仓箱数
*/
*/
private
String
sumquantity
;
private
int
sumquantity
;
/*
提货箱数
*/
private
int
picknum
;
/*
根据入库箱数和提货箱数计算出的提货率
*/
private
String
showThl
;
/*
/*
入仓体积
入仓体积
...
@@ -121,9 +162,49 @@ public class SalesAnalysisResp {
...
@@ -121,9 +162,49 @@ public class SalesAnalysisResp {
*/
*/
private
String
iscargocontrol
;
private
String
iscargocontrol
;
/*
订单类型:1 普货 2 重货 3 泡货
*/
private
int
ordertype
;
private
String
ordertypeShow
;
/*
/*
创建时间
创建时间
*/
*/
private
String
createtime
;
private
String
createtime
;
/*
业绩产生时间
*/
private
String
businesstime
;
/*
付款方
付款人:1 发货人 2 收货人 3 自定义
*/
private
String
drawee
;
/*
付款方显示字段
*/
private
String
draweeName
;
/*
计算使用的重货标准基数
*/
private
String
useweightunit
;
/*
计算使用的泡货标准基数
*/
private
String
usevolumeunit
;
private
String
zpUnitShow
;
/*
首次入仓时间
*/
private
String
firstInTime
;
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/CustomerAnalysisExcelExportListener.java
0 → 100644
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ReportCustomerAnalysisExcelExportEvent
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ReportSalesAnalysisExcelExportEvent
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.module.delivery.convert.CustomerAnalysis
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp
;
import
cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService
;
import
cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO
;
import
cn.iocoder.yudao.module.infra.service.file.FileService
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
@Component
(
"CustomerAnalysisExcelExportListener"
)
@AllArgsConstructor
@Slf4j
public
class
CustomerAnalysisExcelExportListener
{
private
UeProperties
ueProperties
;
private
FileService
fileService
;
@Autowired
private
CustomerAnalysisService
customerAnalysisService
;
/**
* 客户分析导出监听 lanbm 2024-05-01 add
*
* @param event 编号记录
*/
@EventListener
(
ReportCustomerAnalysisExcelExportEvent
.
class
)
public
void
CustomerAnalysisExcelExportPushEvent
(
ReportCustomerAnalysisExcelExportEvent
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
System
.
out
.
println
(
"开始数据导出"
);
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/CustomerAnalysis/excel/"
);
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
())
{
fileDir
.
mkdirs
();
}
CustomerAnalysisReq
query
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
CustomerAnalysisReq
.
class
);
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"客户分析报表.xlsx"
);
List
<
CustomerAnalysisResp
>
list
=
customerAnalysisService
.
getList
(
query
);
List
<
CustomerAnalysisExcelResp
>
listExel
=
CustomerAnalysis
.
INSTANCE
.
convertList
(
list
);
String
path
=
ExcelUtils
.
write
(
dir
,
fileName
,
"客户分析报表"
,
CustomerAnalysisExcelResp
.
class
,
listExel
);
// 获取到临时文件
File
file
=
new
File
(
path
);
// 创建FileInputStream对象
FileInputStream
fileInputStream
=
new
FileInputStream
(
file
);
// 读取文件内容
byte
[]
fileBytes
=
new
byte
[(
int
)
file
.
length
()];
fileInputStream
.
read
(
fileBytes
);
// 关闭文件流
fileInputStream
.
close
();
// 将文件上传到资源服务器
FileDO
fileDO
=
fileService
.
createFile
(
dir
,
fileName
,
fileBytes
);
event
.
setPath
(
fileDO
.
getPath
());
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
}
}
else
{
event
.
setResult
(
"param fail"
);
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/listener/SalesAnalysisExcelExportListener.java
0 → 100644
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
listener
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.apollo.core.event.export.ReportSalesAnalysisExcelExportEvent
;
import
cn.iocoder.yudao.framework.excel.util.ExcelUtils
;
import
cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq
;
import
cn.iocoder.yudao.module.delivery.entity.SalesAnalysisExcelResp
;
import
cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq
;
import
cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp
;
import
cn.iocoder.yudao.module.delivery.service.SalesAnalysisService
;
import
cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO
;
import
cn.iocoder.yudao.module.infra.service.file.FileService
;
import
cn.iocoder.yudao.module.system.framework.ue.UeProperties
;
import
com.alibaba.fastjson.JSONObject
;
import
lombok.AllArgsConstructor
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.event.EventListener
;
import
org.springframework.stereotype.Component
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.time.LocalDateTime
;
import
java.time.format.DateTimeFormatter
;
import
java.util.List
;
import
static
cn
.
iocoder
.
yudao
.
framework
.
excel
.
constant
.
ExportConstant
.
DATA_FORMAT
;
@Component
(
"SalesAnalysisExcelExportListener"
)
@AllArgsConstructor
@Slf4j
public
class
SalesAnalysisExcelExportListener
{
private
UeProperties
ueProperties
;
private
FileService
fileService
;
@Autowired
private
SalesAnalysisService
salesAnalysisService
;
/**
* 销售分析导出监听 lanbm 2024-05-01 add
* 参考网址
*https://www.cnblogs.com/h-java/p/9951547.html
* @param event 编号记录
*/
@EventListener
(
ReportSalesAnalysisExcelExportEvent
.
class
)
public
void
SalesAnalysisExcelExportPushEvent
(
ReportSalesAnalysisExcelExportEvent
event
)
{
if
(
StringUtils
.
isNotBlank
(
event
.
getRequestParams
()))
{
try
{
DateTimeFormatter
formatter
=
DateTimeFormatter
.
ofPattern
(
DATA_FORMAT
);
String
nowTime
=
formatter
.
format
(
LocalDateTime
.
now
());
String
dir
=
ueProperties
.
getTempDir
().
concat
(
"/SalesAnalysis/excel/"
);
File
fileDir
=
new
File
(
dir
);
if
(!
fileDir
.
exists
())
{
fileDir
.
mkdirs
();
}
String
fileName
=
event
.
getUserId
().
toString
().
concat
(
StrUtil
.
DASHED
).
concat
(
event
.
getUserType
().
toString
()).
concat
(
StrUtil
.
DASHED
).
concat
(
nowTime
).
concat
(
"销售分析数据.xlsx"
);
SalesAnalysisReq
query
=
JSONObject
.
parseObject
(
event
.
getRequestParams
(),
SalesAnalysisReq
.
class
);
List
<
SalesAnalysisExcelResp
>
list
=
salesAnalysisService
.
getList
(
query
);
String
path
=
ExcelUtils
.
write
(
dir
,
fileName
,
"销售分析数据"
,
SalesAnalysisExcelResp
.
class
,
list
);
// 获取到临时文件
File
file
=
new
File
(
path
);
// 创建FileInputStream对象
FileInputStream
fileInputStream
=
new
FileInputStream
(
file
);
// 读取文件内容
byte
[]
fileBytes
=
new
byte
[(
int
)
file
.
length
()];
fileInputStream
.
read
(
fileBytes
);
// 关闭文件流
fileInputStream
.
close
();
// 将文件上传到资源服务器
FileDO
fileDO
=
fileService
.
createFile
(
dir
,
fileName
,
fileBytes
);
event
.
setPath
(
fileDO
.
getPath
());
event
.
setFileName
(
fileDO
.
getPath
());
event
.
setUrl
(
fileDO
.
getUrl
());
event
.
setFileId
(
fileDO
.
getId
());
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
event
.
setResult
(
e
.
getMessage
());
}
}
else
{
event
.
setResult
(
"param fail"
);
}
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/mapper/CustomerAnalysisMapper.java
View file @
6fc4a7ce
...
@@ -33,6 +33,6 @@ public interface CustomerAnalysisMapper {
...
@@ -33,6 +33,6 @@ public interface CustomerAnalysisMapper {
*/
*/
Long
GetCount
(
CustomerAnalysisReq
req
);
Long
GetCount
(
CustomerAnalysisReq
req
);
List
<
CustomerAnalysis
Excel
Resp
>
getList
(
CustomerAnalysisReq
req
);
List
<
CustomerAnalysisResp
>
getList
(
CustomerAnalysisReq
req
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/service/CustomerAnalysisService.java
View file @
6fc4a7ce
...
@@ -17,7 +17,17 @@ public interface CustomerAnalysisService {
...
@@ -17,7 +17,17 @@ public interface CustomerAnalysisService {
throws
JsonProcessingException
;
throws
JsonProcessingException
;
List
<
CustomerAnalysisExcelResp
>
getList
(
CustomerAnalysisReq
req
);
List
<
CustomerAnalysisResp
>
getList
(
CustomerAnalysisReq
req
);
PageResult
<
CustomerAnalysisResp
>
GetDataResult
(
CustomerAnalysisReq
query
)
throws
JsonProcessingException
;
List
<
CustomerAnalysisResp
>
GetDataListResult
(
CustomerAnalysisReq
query
)
throws
JsonProcessingException
;
CustomerAnalysisReq
getReq
(
CustomerAnalysisReq
Req
);
CustomerAnalysisReq
getDataWhere
(
CustomerAnalysisReq
query
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/service/Impl/CustomerAnalysisImpl.java
View file @
6fc4a7ce
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.delivery.service.Impl;
...
@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.delivery.service.Impl;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.CommonResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.common.pojo.PageResult
;
import
cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.i18n.core.I18nMessage
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
import
cn.iocoder.yudao.framework.mybatis.core.vo.PageVO
;
...
@@ -13,6 +14,7 @@ import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
...
@@ -13,6 +14,7 @@ import cn.iocoder.yudao.module.delivery.entity.CustomerReportReq;
import
cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper
;
import
cn.iocoder.yudao.module.delivery.mapper.CustomerAnalysisMapper
;
import
cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService
;
import
cn.iocoder.yudao.module.delivery.service.CustomerAnalysisService
;
import
cn.iocoder.yudao.module.delivery.service.CustomerReportService
;
import
cn.iocoder.yudao.module.delivery.service.CustomerReportService
;
import
cn.iocoder.yudao.module.system.api.dict.DictDataApi
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSON
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
...
@@ -22,7 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -22,7 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.List
;
import
java.math.BigDecimal
;
import
java.text.NumberFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.YearMonth
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
/*
/*
...
@@ -35,10 +42,13 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
...
@@ -35,10 +42,13 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
@Autowired
@Autowired
private
CustomerAnalysisMapper
customerAnalysisMapper
;
private
CustomerAnalysisMapper
customerAnalysisMapper
;
@Autowired
private
DictDataApi
dictDataApi
;
@Resource
@Resource
private
RedisHelper
redisHelper
;
private
RedisHelper
redisHelper
;
public
List
<
CustomerAnalysis
Excel
Resp
>
getList
(
CustomerAnalysisReq
req
)
{
public
List
<
CustomerAnalysisResp
>
getList
(
CustomerAnalysisReq
req
)
{
return
customerAnalysisMapper
.
getList
(
req
);
return
customerAnalysisMapper
.
getList
(
req
);
}
}
...
@@ -69,6 +79,7 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
...
@@ -69,6 +79,7 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
}
}
*/
*/
List
<
CustomerAnalysisResp
>
list
=
customerAnalysisMapper
.
getListPage
(
req
);
List
<
CustomerAnalysisResp
>
list
=
customerAnalysisMapper
.
getListPage
(
req
);
System
.
out
.
println
(
"符合条件的客户总数:"
+
String
.
valueOf
(
total
));
return
new
PageResult
<>(
list
,
total
,
mpPage
.
getSize
(),
return
new
PageResult
<>(
list
,
total
,
mpPage
.
getSize
(),
req
.
getPageNo
(),
(
total
+
mpPage
.
getSize
()
-
1
)
/
mpPage
.
getSize
());
req
.
getPageNo
(),
(
total
+
mpPage
.
getSize
()
-
1
)
/
mpPage
.
getSize
());
...
@@ -97,6 +108,631 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
...
@@ -97,6 +108,631 @@ public class CustomerAnalysisImpl implements CustomerAnalysisService {
}
}
/*
计算百分比
lanbm 2024-04-10 add
*/
private
String
getPercentage
(
BigDecimal
part
,
BigDecimal
total
)
{
BigDecimal
percentage
=
part
.
divide
(
total
,
5
,
BigDecimal
.
ROUND_HALF_UP
).
multiply
(
new
BigDecimal
(
"100"
));
// 输出百分比
String
sR
=
format
(
percentage
)
+
"%"
;
return
sR
;
}
/*
格式化BigDecimal为字符串,保留两位小数
lanbm 2024-04-10 add
*/
private
String
format
(
BigDecimal
value
)
{
NumberFormat
numberFormat
=
NumberFormat
.
getInstance
();
numberFormat
.
setMinimumFractionDigits
(
2
);
numberFormat
.
setMaximumFractionDigits
(
2
);
return
numberFormat
.
format
(
value
.
doubleValue
());
}
private
String
getCurDate
()
{
Date
date
=
new
Date
();
SimpleDateFormat
sdf
=
new
SimpleDateFormat
(
"yyyy-MM-dd"
);
String
currentDate
=
sdf
.
format
(
date
);
return
currentDate
;
}
private
int
getCurYear
()
{
Calendar
calendar
=
Calendar
.
getInstance
();
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
return
year
;
}
/*
获取数据查询条件
*/
public
CustomerAnalysisReq
getDataWhere
(
CustomerAnalysisReq
query
)
{
if
(
query
.
getSearchDataType1
()
!=
null
&&
query
.
getSearchDataType2
()
!=
null
&&
query
.
getSearchDataType3
()
!=
null
)
{
}
return
query
;
}
/*
对查询逻辑做处理 lanbm 2024-04-16 add
*/
public
CustomerAnalysisReq
getReq
(
CustomerAnalysisReq
Req
)
{
//计算月份差
long
lc
=
monthDiff
(
Req
.
getSdate
(),
Req
.
getEdate
());
if
(
lc
==
0
)
{
lc
=
1
;
}
Req
.
setNMonth
(
Integer
.
parseInt
(
String
.
valueOf
(
lc
)));
int
y
=
getCurYear
();
if
(
Req
.
getSdate
()
==
null
)
{
Req
.
setCurYear
(
String
.
valueOf
(
y
));
Req
.
setSdate
(
String
.
valueOf
(
y
)
+
"-01-01"
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
Req
.
setDuibiYear
(
String
.
valueOf
(
y
-
1
));
}
else
{
Req
.
setSduibidate
(
Req
.
getDuibiYear
()
+
"-01-01"
);
}
}
else
{
//2024-03-01
String
sT
=
Req
.
getSdate
();
String
s
=
sT
.
substring
(
4
,
10
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
int
nTemp
=
Integer
.
parseInt
(
sT
.
substring
(
0
,
4
))
-
1
;
Req
.
setSduibidate
(
String
.
valueOf
(
nTemp
)
+
s
);
}
else
{
Req
.
setSduibidate
(
Req
.
getDuibiYear
()
+
s
);
}
Req
.
setCurYear
(
sT
.
substring
(
0
,
4
));
}
if
(
Req
.
getEdate
()
==
null
)
{
Req
.
setEdate
(
getCurDate
());
String
s
=
Req
.
getEdate
().
substring
(
5
,
7
);
int
ld
=
getLastDay
(
Integer
.
parseInt
(
Req
.
getDuibiYear
()),
Integer
.
parseInt
(
s
));
Req
.
setEduibidate
(
Req
.
getDuibiYear
()
+
"-"
+
s
+
"-"
+
String
.
valueOf
(
ld
));
}
else
{
String
sE
=
Req
.
getEdate
();
String
sY
=
sE
.
substring
(
0
,
4
);
//int ld = getLastDay(Integer.parseInt(sY), Integer.parseInt(s));
//2024-03-01
String
s1
=
sE
.
substring
(
4
,
10
);
if
(
Req
.
getDuibiYear
()
==
null
)
{
int
nTemp
=
Integer
.
parseInt
(
sY
)
-
1
;
Req
.
setEduibidate
(
String
.
valueOf
(
nTemp
)
+
s1
);
}
else
{
Req
.
setEduibidate
(
Req
.
getDuibiYear
()
+
s1
);
}
}
/*
if (Req.getSearchData3() != null) {
Req.setSearchData3(Req.getSearchData3().divide(new BigDecimal(100)));
}*/
return
Req
;
}
/*
获取某年某月的最后一天 lanbm 2024-04-16 add
*/
private
int
getLastDay
(
int
year
,
int
month
)
{
YearMonth
yearMonth
=
YearMonth
.
of
(
year
,
month
);
int
lastDay
=
yearMonth
.
lengthOfMonth
();
return
lastDay
;
}
public
PageResult
<
CustomerAnalysisResp
>
GetDataResult
(
CustomerAnalysisReq
query
)
throws
JsonProcessingException
{
query
=
getReq
(
query
);
query
=
getDataWhere
(
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
//把model转 JSON字符串 lanbm
//String jsonStr = JsonUtils.toJsonString(query);
//JsonUtils.SaveLog(jsonStr);
List
<
DictDataRespDTO
>
dicCustomer_type
=
dictDataApi
.
getDictDatas
(
"customer_type"
);
Map
<
String
,
String
>
mapDic
=
new
HashMap
<>();
for
(
DictDataRespDTO
d
:
dicCustomer_type
)
{
mapDic
.
put
(
d
.
getValue
(),
d
.
getLabel
());
}
PageResult
<
CustomerAnalysisResp
>
pageResult
=
getListPage
(
query
);
String
sTemp
=
""
;
int
nPm
=
query
.
getStart
()
+
1
;
for
(
CustomerAnalysisResp
r
:
pageResult
.
getList
())
{
r
.
setPx
(
nPm
);
nPm
++;
//客户类型转换
String
sType
=
r
.
getType
();
if
(
sType
==
null
)
{
r
.
setCustomerrole
(
""
);
}
else
{
r
.
setCustomerrole
(
mapDic
.
get
(
sType
));
}
if
(
r
.
getAllsumvolume
()
==
null
||
r
.
getAllsumvolume
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
//计算月均
r
=
calMonthAvg
(
query
,
r
,
true
);
//计算总值
r
=
calAll
(
r
,
true
);
//计算海运数据
r
=
cal1
(
query
,
r
,
true
);
//计算空运数据
r
=
cal3
(
query
,
r
,
true
);
//计算重货数据
r
=
calZH
(
r
,
true
);
//计算泡货数据
r
=
calPH
(
r
,
true
);
//计算控货数据
r
=
calKH
(
r
,
true
);
}
else
{
//计算月均
r
=
calMonthAvg
(
query
,
r
,
false
);
//计算总值
r
=
calAll
(
r
,
false
);
//计算海运数据
r
=
cal1
(
query
,
r
,
false
);
//计算空运数据
r
=
cal3
(
query
,
r
,
false
);
//重货
r
=
calZH
(
r
,
false
);
//计算泡货占比
r
=
calPH
(
r
,
false
);
//计算控货占比
r
=
calKH
(
r
,
false
);
}
r
=
calPick
(
r
,
false
);
}
return
pageResult
;
}
public
List
<
CustomerAnalysisResp
>
GetDataListResult
(
CustomerAnalysisReq
query
)
throws
JsonProcessingException
{
query
=
getReq
(
query
);
query
=
getDataWhere
(
query
);
System
.
out
.
println
(
"处理后的查询条件:"
+
query
);
//把model转 JSON字符串 lanbm
//String jsonStr = JsonUtils.toJsonString(query);
//JsonUtils.SaveLog(jsonStr);
List
<
DictDataRespDTO
>
dicCustomer_type
=
dictDataApi
.
getDictDatas
(
"customer_type"
);
Map
<
String
,
String
>
mapDic
=
new
HashMap
<>();
for
(
DictDataRespDTO
d
:
dicCustomer_type
)
{
mapDic
.
put
(
d
.
getValue
(),
d
.
getLabel
());
}
List
<
CustomerAnalysisResp
>
list
=
getList
(
query
);
String
sTemp
=
""
;
int
nPm
=
query
.
getStart
()
+
1
;
for
(
CustomerAnalysisResp
r
:
list
)
{
r
.
setPx
(
nPm
);
nPm
++;
//客户类型转换
String
sType
=
r
.
getType
();
if
(
sType
==
null
)
{
r
.
setCustomerrole
(
""
);
}
else
{
r
.
setCustomerrole
(
mapDic
.
get
(
sType
));
}
if
(
r
.
getAllsumvolume
()
==
null
||
r
.
getAllsumvolume
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
//计算月均
r
=
calMonthAvg
(
query
,
r
,
true
);
//计算总值
r
=
calAll
(
r
,
true
);
//计算海运数据
r
=
cal1
(
query
,
r
,
true
);
//计算空运数据
r
=
cal3
(
query
,
r
,
true
);
//计算重货数据
r
=
calZH
(
r
,
true
);
//计算泡货数据
r
=
calPH
(
r
,
true
);
//计算控货数据
r
=
calKH
(
r
,
true
);
}
else
{
//计算月均
r
=
calMonthAvg
(
query
,
r
,
false
);
//计算总值
r
=
calAll
(
r
,
false
);
//计算海运数据
r
=
cal1
(
query
,
r
,
false
);
//计算空运数据
r
=
cal3
(
query
,
r
,
false
);
//重货
r
=
calZH
(
r
,
false
);
//计算泡货占比
r
=
calPH
(
r
,
false
);
//计算控货占比
r
=
calKH
(
r
,
false
);
}
r
=
calPick
(
r
,
false
);
}
return
list
;
}
private
CustomerAnalysisResp
calMonthAvg
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
r
.
setMonthAvg
(
"0"
);
}
else
{
r
.
setMonthAvg
(
r
.
getAllsumvolume
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
).
toString
());
}
//计算同比
if
(
r
.
getAllsumvolumeTb
()
==
null
||
r
.
getAllsumvolumeTb
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setMonthAvgTbShow
(
"同期值为0"
);
}
else
{
sTemp
=
getPercentage
(
(
r
.
getAllsumvolume
().
subtract
(
r
.
getAllsumvolumeTb
())),
r
.
getAllsumvolumeTb
());
r
.
setMonthAvgTbShow
(
sTemp
);
}
return
r
;
}
/*
总值计算
*/
private
CustomerAnalysisResp
calAll
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getAllsumvolumeTb
()
==
null
||
r
.
getAllsumvolumeTb
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAllsumvolumeTbShow
(
"同期V值为0"
);
}
else
{
//(本期-同期)/同期
sTemp
=
getPercentage
(
(
r
.
getAllsumvolume
().
subtract
(
r
.
getAllsumvolumeTb
())),
r
.
getAllsumvolumeTb
());
r
.
setAllsumvolumeTbShow
(
sTemp
);
}
return
r
;
}
/*
计算提货数据
*/
private
CustomerAnalysisResp
calPick
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
r
.
getChargequantity
()
==
0
)
{
r
.
setThL
(
"总箱数为0"
);
}
else
{
r
.
setThL
(
getIntPercentage
(
r
.
getPickquantity
(),
r
.
getChargequantity
()));
}
return
r
;
}
/*
处理海运数据
*/
private
CustomerAnalysisResp
cal1
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getSumvolume1
()
==
null
||
r
.
getSumvolume1
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//海运V值
r
.
setSumvolumeV1
(
new
BigDecimal
(
0
));
//海运体积数
r
.
setSumvolume1
(
new
BigDecimal
(
0
));
r
.
setSeaMonthAvgZ
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setSeaZb
(
"总值为0"
);
//海运月均
r
.
setSeaMonthAvg
(
"总值为0"
);
}
else
{
//海运占比
r
.
setSeaZb
(
"0"
);
//海运月均
r
.
setSeaMonthAvg
(
"0"
);
}
}
else
{
//设置海运V值
r
.
setSumvolumeV1
(
r
.
getSumvolume1
());
if
(
bZzNull
==
true
)
{
r
.
setSeaZb
(
"总值为0"
);
}
else
{
r
.
setSeaZb
(
getPercentage
(
r
.
getSumvolumeV1
(),
r
.
getAllsumvolume
()));
}
//月均V值 是体积
r
.
setSeaMonthAvgZ
(
r
.
getSumvolume1
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
));
r
.
setSeaMonthAvg
(
r
.
getSeaMonthAvgZ
().
toString
());
}
if
(
r
.
getSumvolumeTb1
()
==
null
||
r
.
getSumvolumeTb1
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumvolumeTbV1
(
new
BigDecimal
(
0
));
r
.
setSumvolumeTbShow1
(
"同期为0"
);
r
.
setSeaMonthAvgTbZ
(
new
BigDecimal
(
0
));
}
else
{
r
.
setSumvolumeTbV1
(
new
BigDecimal
(
1
).
multiply
(
r
.
getSumvolumeTb1
()));
sTemp
=
getPercentage
(
(
r
.
getSumvolumeV1
().
subtract
(
r
.
getSumvolumeTbV1
())),
r
.
getSumvolumeTbV1
());
r
.
setSumvolumeTbShow1
(
sTemp
);
r
.
setSeaMonthAvgTbZ
(
r
.
getSumvolumeTb1
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
//计算海运月均同比
if
(
r
.
getSeaMonthAvgTbZ
()
==
null
||
r
.
getSeaMonthAvgTbZ
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSeaMonthAvgTb
(
"同期为0"
);
}
else
{
sTemp
=
getPercentage
(
(
r
.
getSeaMonthAvgZ
().
subtract
(
r
.
getSeaMonthAvgTbZ
())),
r
.
getSeaMonthAvgTbZ
());
r
.
setSeaMonthAvgTb
(
sTemp
);
}
return
r
;
}
/*
处理空运数据
*/
private
CustomerAnalysisResp
cal3
(
CustomerAnalysisReq
query
,
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
String
sTemp
=
""
;
if
(
bZzNull
==
true
)
{
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
//当期值
if
(
r
.
getSumweightV3
()
==
null
||
r
.
getSumweightV3
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumweightV3
(
new
BigDecimal
(
0
));
r
.
setSumweight3
(
new
BigDecimal
(
0
));
r
.
setAirMothAvgZ
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setAirZb
(
"总值为0"
);
r
.
setAirMothAvg
(
"总值为0"
);
}
else
{
r
.
setAirZb
(
"0"
);
r
.
setAirMothAvg
(
"0"
);
}
}
else
{
//SQL语句算出的是V值,要把V值转换位KG数
r
.
setSumweight3
(
r
.
getSumweightV3
().
multiply
(
new
BigDecimal
(
100
)));
if
(
bZzNull
==
true
)
{
r
.
setAirZb
(
"总值为0"
);
}
else
{
//空运占比
r
.
setAirZb
(
getPercentage
(
r
.
getSumweightV3
(),
r
.
getAllsumvolume
()));
}
//月均是 重量
r
.
setAirMothAvgZ
(
r
.
getSumweight3
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
));
r
.
setAirMothAvg
(
r
.
getAirMothAvgZ
().
toString
());
}
//同期值
if
(
r
.
getSumweightTbV3
()
==
null
||
r
.
getSumweightTbV3
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setSumweightTb3
(
new
BigDecimal
(
0
));
r
.
setSumweightTbV3
(
new
BigDecimal
(
0
));
r
.
setSumweightTbShow3
(
"同期值为0"
);
r
.
setAirMothAvgTbZ
(
new
BigDecimal
(
0
));
}
else
{
//SQL语句算出的是V值,要把V值转换位KG数
r
.
setSumweightTb3
(
r
.
getSumweightTbV3
().
multiply
(
new
BigDecimal
(
100
)));
sTemp
=
getPercentage
(
(
r
.
getSumweightV3
().
subtract
(
r
.
getSumweightTbV3
())),
r
.
getSumweightTbV3
());
r
.
setSumweightTbShow3
(
sTemp
);
r
.
setAirMothAvgTbZ
(
r
.
getSumweightTb3
().
divide
(
new
BigDecimal
(
query
.
getNMonth
()),
2
,
BigDecimal
.
ROUND_HALF_UP
));
}
//计算空运月均同比
if
(
r
.
getAirMothAvgTbZ
()
==
null
||
r
.
getAirMothAvgTbZ
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setAirMothAvgTb
(
"同期为0"
);
}
else
{
sTemp
=
getPercentage
(
(
r
.
getAirMothAvgZ
().
subtract
(
r
.
getAirMothAvgTbZ
())),
r
.
getAirMothAvgTbZ
());
r
.
setAirMothAvgTb
(
sTemp
);
}
return
r
;
}
/*
计算重货数据
*/
private
CustomerAnalysisResp
calZH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//总值为0的情况
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
//重货 占比
if
(
r
.
getWeightSumV
()
==
null
||
r
.
getWeightSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setWeightSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setWeithtSumZb
(
"总值为0"
);
}
else
{
r
.
setWeithtSumZb
(
"0"
);
}
}
else
{
r
.
setWeithtSumZb
(
getPercentage
(
r
.
getWeightSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
/*
计算泡货数据
*/
private
CustomerAnalysisResp
calPH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//泡货 占比
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getPhSumV
()
==
null
||
r
.
getPhSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setPhSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setPhSumZb
(
"总值为0"
);
}
else
{
r
.
setPhSumZb
(
"0"
);
}
}
else
{
r
.
setPhSumZb
(
getPercentage
(
r
.
getPhSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
/*
计算控货数据
*/
private
CustomerAnalysisResp
calKH
(
CustomerAnalysisResp
r
,
boolean
bZzNull
)
{
if
(
bZzNull
==
true
)
{
//控货 占比
r
.
setAllsumvolume
(
new
BigDecimal
(
0
));
}
if
(
r
.
getKhSumV
()
==
null
||
r
.
getKhSumV
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
r
.
setKhSumV
(
new
BigDecimal
(
0
));
if
(
bZzNull
==
true
)
{
r
.
setKhSumZb
(
"总值为0"
);
}
else
{
r
.
setKhSumZb
(
"0"
);
}
}
else
{
r
.
setKhSumZb
(
getPercentage
(
r
.
getKhSumV
(),
r
.
getAllsumvolume
()));
}
return
r
;
}
private
String
getIntPercentage
(
int
number
,
int
divisor
)
{
// 计算百分比
double
percentage
=
number
/
(
double
)
divisor
;
// 格式化输出百分比
String
formatted
=
String
.
format
(
"%.2f%%"
,
percentage
);
return
formatted
;
}
private
int
monthDiff
(
String
dateString1
,
String
dateString2
)
{
// 将字符串转换为 LocalDate 对象
LocalDate
date1
=
LocalDate
.
parse
(
dateString1
);
LocalDate
date2
=
LocalDate
.
parse
(
dateString2
);
// 获软时间1的年份和月份
int
year1
=
date1
.
getYear
();
int
month1
=
date1
.
getMonthValue
();
// 获取时间2的年份和月份
int
year2
=
date2
.
getYear
();
int
month2
=
date2
.
getMonthValue
();
// 计算时间1的总月数
int
totalMonths1
=
year1
*
12
+
month1
;
// 计算时间2的总月数
int
totalMonths2
=
year2
*
12
+
month2
;
// 计算总月数差
int
monthsDiff
=
totalMonths2
-
totalMonths1
;
return
monthsDiff
;
}
private
List
<
CustomerAnalysisResp
>
GetPageResult2
(
List
<
CustomerAnalysisResp
>
list
,
int
pageNum
,
int
pageSize
)
{
/*
// 正序
Collections.sort(list, (a, b) -> {
return a.排序字段 - b.排序字段;
});
// 倒序
Collections.sort(list, (a, b) -> {
return b.排序字段 - a.排序字段;
});*/
// 总数
int
total
=
list
.
size
();
// 分页数据
List
<
CustomerAnalysisResp
>
subList
=
list
.
stream
().
skip
((
pageNum
-
1
)
*
pageSize
).
limit
(
pageSize
).
collect
(
Collectors
.
toList
());
return
subList
;
}
/*
/*
lanbm 2024-04-26 add
lanbm 2024-04-26 add
*/
*/
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/service/SalesAnalysisService.java
View file @
6fc4a7ce
...
@@ -10,4 +10,6 @@ public interface SalesAnalysisService {
...
@@ -10,4 +10,6 @@ public interface SalesAnalysisService {
PageResult
<
SalesAnalysisResp
>
getListPage
(
SalesAnalysisReq
page
);
PageResult
<
SalesAnalysisResp
>
getListPage
(
SalesAnalysisReq
page
);
List
<
SalesAnalysisExcelResp
>
getList
(
SalesAnalysisReq
req
);
List
<
SalesAnalysisExcelResp
>
getList
(
SalesAnalysisReq
req
);
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/task/ReportTask.java
0 → 100644
View file @
6fc4a7ce
package
cn
.
iocoder
.
yudao
.
module
.
delivery
.
task
;
import
cn.hutool.core.util.StrUtil
;
import
cn.iocoder.yudao.framework.quartz.core.handler.JobHandler
;
import
cn.iocoder.yudao.framework.tenant.core.job.TenantJob
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.stereotype.Component
;
import
javax.annotation.Resource
;
/*
lanbm 2024-04-30 测试定时任务
*/
@Component
@TenantJob
@Slf4j
public
class
ReportTask
implements
JobHandler
{
@Override
public
String
execute
(
String
param
)
throws
Exception
{
int
var1
=
30
;
int
var2
=
3
;
int
var3
=
6
;
if
(
StringUtils
.
isNotBlank
(
param
)){
String
[]
vars
=
param
.
split
(
StrUtil
.
COMMA
);
if
(
vars
.
length
>
0
){
var1
=
Integer
.
parseInt
(
vars
[
0
]);
}
if
(
vars
.
length
>
1
){
var2
=
Integer
.
parseInt
(
vars
[
1
]);
}
if
(
vars
.
length
>
2
){
var3
=
Integer
.
parseInt
(
vars
[
2
]);
}
}
System
.
out
.
println
(
"定时任务参数:"
+
param
);
return
""
;
}
}
yudao-module-delivery/yudao-module-delivery-rest/src/main/resources/mapper/CustomerAnalysisMapper.xml
View file @
6fc4a7ce
...
@@ -4,7 +4,7 @@
...
@@ -4,7 +4,7 @@
<select
id=
"getListPage"
<select
id=
"getListPage"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
resultType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp"
>
resultType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp"
>
WITH dataTJ as
(
with dataTJ AS
(
SELECT number,name,c.id,(
SELECT number,name,c.id,(
SELECT nickname from system_user where id=c.customer_service
SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
) as salesman,c.customer_service as salesmanid,
...
@@ -16,15 +16,15 @@
...
@@ -16,15 +16,15 @@
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sduibidate}' AND '${eduibidate}') as allsumvolumeTb,
'${sduibidate}' AND '${eduibidate}') as allsumvolumeTb,
<!--海运-->
<!--海运-->
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
transport_id=1 and
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') AS sumvolume1,
business_time BETWEEN '${sdate}' AND '${edate}'
and transport_id=1
) AS sumvolume1,
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
transport_id=1 and
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}') as sumvolumeTb1,
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
and transport_id=1
) as sumvolumeTb1,
<!--空运-->
<!--空运-->
(select round(sum(charge_weight)
,2) from view_order_businesstime where customer_id = c.id and transport_id=3
and
(select round(sum(charge_weight)
/100,2) from view_order_businesstime where customer_id = c.id
and
business_time BETWEEN '${sdate}' AND '${edate}'
) AS sumweight
3,
business_time BETWEEN '${sdate}' AND '${edate}'
and transport_id=3) AS sumweightV
3,
(select round(sum(charge_weight)
,2) from view_order_businesstime where customer_id = c.id and transport_id=3
and
(select round(sum(charge_weight)
/100,2) from view_order_businesstime where customer_id = c.id
and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
) as sumweightTb
3,
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
and transport_id=3) as sumweightTbV
3,
'4' as monthAvg,
'4' as monthAvg,
'5' as monthAvgTb,
'5' as monthAvgTb,
'6' as seaMonthAvg,
'6' as seaMonthAvg,
...
@@ -32,16 +32,16 @@
...
@@ -32,16 +32,16 @@
'8' as airMothAvg,
'8' as airMothAvg,
'9' as airMothAvgTb,
'9' as airMothAvgTb,
<!--重货 计算占比,不计算同步-->
<!--重货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
order_type=2 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as weightSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and order_type=2
) as weightSumV,
<!--泡货 计算占比,不计算同步-->
<!--泡货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
order_type=3 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as phSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and order_type=3
) as phSumV,
<!--控货 计算占比,不计算同步-->
<!--控货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
is_cargo_control=1 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as khSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and is_cargo_control=1
) as khSumV,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(if(c.is_new = 1,c.update_time,''))as firstDate,
(if(c.is_new = 1,c.update_time,''))
as firstDate,
<!--提货率 已提货箱数除总入库总箱数-->
<!--提货率 已提货箱数除总入库总箱数-->
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
...
@@ -64,34 +64,73 @@
...
@@ -64,34 +64,73 @@
<sql
id=
"WherePage2"
>
<sql
id=
"WherePage2"
>
<where>
<where>
<if
test=
"searchDataType4!=null and searchDataType4!=''"
>
<if
test=
"sdate5!=null and sdate5!=''"
>
<if
test=
"sdate4!=null and sdate4!=''
<!--首次成交时间-->
and edate4!=null and edate4!=''"
>
<if
test=
"edate5!=null and edate5!=''"
>
and firstDate BETWEEN #{sdate5} AND #{edate5}
</if>
</if>
<if
test=
"searchDataType1!=null and searchDataType1!=''"
>
<if
test=
"searchData1!=null and searchData1!=''"
>
<!--总值查询-->
<choose>
<choose>
<when
test=
"searchDataType4 =='1'.toString()"
>
<when
test=
"searchDataType1 =='1'.toString()"
>
and firstDate BETWEEN #{sdate4} AND #{edate4}
<!--大于等于的写法-->
and allsumvolume
<![CDATA[ >= ]]>
#{searchData1}
</when>
<when
test=
"searchDataType1 =='2'.toString()"
>
and allsumvolume= #{searchData1}
</when>
<when
test=
"searchDataType1 =='3'.toString()"
>
<!--小于等于的写法-->
and allsumvolume
<![CDATA[ <= ]]>
#{searchData1}
</when>
</when>
</choose>
</choose>
</if>
</if>
</if>
</if>
<if
test=
"searchDataType1!=null and searchDataType1!=''
and searchDataType2!=null and searchDataType2!=''
<if
test=
"searchDataType2!=null and searchDataType2!=''"
>
and searchDataType3!=null and searchDataType3!=''"
>
<if
test=
"searchData2!=null and searchData2!=''"
>
<!--海运拼柜-->
<choose>
<choose>
<when
test=
"searchDataType2 =='1'.toString()"
>
<when
test=
"searchDataType2 =='1'.toString()"
>
and ${searchDataType1} >= #{searchDataType3}
<!--大于等于的写法-->
and sumvolume1
<![CDATA[ >= ]]>
#{searchData2}
</when>
</when>
<when
test=
"searchDataType2 =='2'.toString()"
>
<when
test=
"searchDataType2 =='2'.toString()"
>
and ${searchDataType1} = #{searchDataType3}
and sumvolume1 = #{searchData2}
</when>
<when
test=
"searchDataType2 =='3'.toString()"
>
<!--小于等于的写法-->
and sumvolume1
<![CDATA[ <= ]]>
#{searchData2}
</when>
</when>
</choose>
</choose>
</if>
</if>
</if>
<if
test=
"searchDataType3!=null and searchDataType3!=''"
>
<if
test=
"searchData3!=null and searchData3!=''"
>
<!--专线空运-->
<choose>
<when
test=
"searchDataType3 =='1'.toString()"
>
<!--大于等于的写法-->
and sumweightV3
<![CDATA[ >= ]]>
#{searchData3}
</when>
<when
test=
"searchDataType3 =='2'.toString()"
>
and sumweightV3 = #{searchData3}
</when>
<when
test=
"searchDataType3 =='3'.toString()"
>
<!--小于等于的写法-->
and sumweightV3
<![CDATA[ <= ]]>
#{searchData3}
</when>
</choose>
</if>
</if>
</where>
</where>
</sql>
</sql>
<sql
id=
"WherePage"
>
<sql
id=
"WherePage"
>
<where>
<where>
and c.deleted = 0
and c.deleted = 0
and c.STATUS=3
<if
test=
"name!=null and name!=''"
>
<if
test=
"name!=null and name!=''"
>
<choose>
<choose>
<when
test=
"searchtype =='in'.toString()"
>
<when
test=
"searchtype =='in'.toString()"
>
...
@@ -113,8 +152,13 @@
...
@@ -113,8 +152,13 @@
</otherwise>
</otherwise>
</choose>
</choose>
</if>
</if>
<if
test=
"isnew!=null and isnew!=''"
>
<if
test=
"first!=null and first!=''"
>
and is_new= #{isnew}
<!--是否首次成交-->
and c.is_new= #{first}
</if>
<if
test=
"cusYjType!=null and cusYjType!=''"
>
<!--业绩类型-->
and c.is_new= #{cusYjType}
</if>
</if>
<if
test=
"source!=null and source!=''"
>
<if
test=
"source!=null and source!=''"
>
and source= #{source}
and source= #{source}
...
@@ -133,32 +177,48 @@
...
@@ -133,32 +177,48 @@
<if
test=
"deptid!=null and deptid!=''"
>
<if
test=
"deptid!=null and deptid!=''"
>
and u_d.dept_id= #{deptid}
and u_d.dept_id= #{deptid}
</if>
</if>
<if
test=
"searchDataType4!=null and searchDataType4!=''"
>
<if
test=
"sdate4!=null and sdate4!=''"
>
<if
test=
"sdate4!=null and sdate4!=''
<!--客户创建时间-->
and edate4!=null and edate4!=''"
>
<if
test=
"edate4!=null and edate4!=''"
>
<choose>
<when
test=
"searchDataType4 =='0'"
>
and c.create_time BETWEEN #{sdate4} AND #{edate4}
and c.create_time BETWEEN #{sdate4} AND #{edate4}
</when>
</choose>
</if>
</if>
</if>
</if>
</where>
</where>
</sql>
</sql>
<select
id=
"GetCount"
resultType=
"java.lang.Long"
>
<select
id=
"GetCount"
resultType=
"java.lang.Long"
>
<!--
SELECT count(*)
SELECT count(*)
from ecw_customer c left join (
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
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
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
) AS u_d ON c.customer_service = u_d.userid
<include refid="WherePage"/>-->
WITH dataTJ as(
SELECT c.id,
(if(c.is_new = 1,c.update_time,'')) as firstDate,
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sdate}' AND '${edate}') AS allsumvolume,
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}' and transport_id=1) AS sumvolume1,
(select round(sum(charge_weight),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}' and transport_id=3) AS sumweightV3
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"
/>
<include
refid=
"WherePage"
/>
)
select count(*) from dataTJ
<include
refid=
"WherePage2"
/>
</select>
</select>
<select
id=
"getList"
<select
id=
"getList"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisReq"
resultType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisExcelResp"
>
resultType=
"cn.iocoder.yudao.module.delivery.entity.CustomerAnalysisResp"
>
WITH dataExcel as( SELECT number,name,c.id,(
with dataTJ AS(
SELECT number,name,c.id,(
SELECT nickname from system_user where id=c.customer_service
SELECT nickname from system_user where id=c.customer_service
) as salesman,c.customer_service as salesmanid,
) as salesman,c.customer_service as salesmanid,
(SELECT label from system_dict_data
(SELECT label from system_dict_data
...
@@ -169,15 +229,15 @@
...
@@ -169,15 +229,15 @@
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and business_time BETWEEN
'${sduibidate}' AND '${eduibidate}') as allsumvolumeTb,
'${sduibidate}' AND '${eduibidate}') as allsumvolumeTb,
<!--海运-->
<!--海运-->
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
transport_id=1 and
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') AS sumvolume1,
business_time BETWEEN '${sdate}' AND '${edate}'
and transport_id=1
) AS sumvolume1,
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
transport_id=1 and
(select round(sum(charge_volume),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}') as sumvolumeTb1,
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
and transport_id=1
) as sumvolumeTb1,
<!--空运-->
<!--空运-->
(select round(sum(charge_weight)
,2) from view_order_businesstime where customer_id = c.id and transport_id=3
and
(select round(sum(charge_weight)
/100,2) from view_order_businesstime where customer_id = c.id
and
business_time BETWEEN '${sdate}' AND '${edate}'
) AS sumweight
3,
business_time BETWEEN '${sdate}' AND '${edate}'
and transport_id=3) AS sumweightV
3,
(select round(sum(charge_weight)
,2) from view_order_businesstime where customer_id = c.id and transport_id=3
and
(select round(sum(charge_weight)
/100,2) from view_order_businesstime where customer_id = c.id
and
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
) as sumweightTb
3,
business_time BETWEEN '${sduibidate}' AND '${eduibidate}'
and transport_id=3) as sumweightTbV
3,
'4' as monthAvg,
'4' as monthAvg,
'5' as monthAvgTb,
'5' as monthAvgTb,
'6' as seaMonthAvg,
'6' as seaMonthAvg,
...
@@ -185,16 +245,16 @@
...
@@ -185,16 +245,16 @@
'8' as airMothAvg,
'8' as airMothAvg,
'9' as airMothAvgTb,
'9' as airMothAvgTb,
<!--重货 计算占比,不计算同步-->
<!--重货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
order_type=2 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as weightSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and order_type=2
) as weightSumV,
<!--泡货 计算占比,不计算同步-->
<!--泡货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
order_type=3 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as phSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and order_type=3
) as phSumV,
<!--控货 计算占比,不计算同步-->
<!--控货 计算占比,不计算同步-->
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
is_cargo_control=1 and
(select round(sum(vz),2) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as khSumV,
business_time BETWEEN '${sdate}' AND '${edate}'
and is_cargo_control=1
) as khSumV,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(CASE WHEN c.is_new = 1 THEN '是' ELSE '否' END) as isFirst,
(if(c.is_new = 1,c.update_time,''))as firstDate,
(if(c.is_new = 1,c.update_time,''))
as firstDate,
<!--提货率 已提货箱数除总入库总箱数-->
<!--提货率 已提货箱数除总入库总箱数-->
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
(select sum(charge_quantity) from view_order_businesstime where customer_id = c.id and
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
business_time BETWEEN '${sdate}' AND '${edate}') as chargequantity,
...
@@ -202,17 +262,16 @@
...
@@ -202,17 +262,16 @@
business_time BETWEEN '${sdate}' AND '${edate}') as pickquantity,
business_time BETWEEN '${sdate}' AND '${edate}') as pickquantity,
(CASE WHEN c.is_new = 1 THEN '新客户' ELSE '旧客户' END ) as cusYjType,
(CASE WHEN c.is_new = 1 THEN '新客户' ELSE '旧客户' END ) as cusYjType,
(SELECT name_zh from ecw_country where deleted=0 and id=c.country) as country,
(SELECT name_zh from ecw_country where deleted=0 and id=c.country) as country,
c.type,
c.type, c.create_time as createtime
c.create_time as createtime
from ecw_customer c left join (
from ecw_customer c left join (
SELECT d.NAME as deptName,u.dept_id,u.id as userid FROM
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
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id
) AS u_d ON c.customer_service = u_d.userid
) AS u_d ON c.customer_service = u_d.userid
<include
refid=
"WherePage"
/>
)
<include
refid=
"WherePage"
/>
)
select * from data
Excel
select * from data
TJ
<include
refid=
"WherePage2"
/>
<include
refid=
"WherePage2"
/>
order by allsumvolume desc
limit #{start},#{size}
order by allsumvolume desc
,number desc
</select>
</select>
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/resources/mapper/CustomerReportMapper.xml
View file @
6fc4a7ce
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
system_user u LEFT JOIN system_dept d ON u.dept_id = d.id) AS u_d ON c.customer_service = u_d.userid
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"
/>
<include
refid=
"WherePage"
/>
ORDER BY allsumvolume desc
ORDER BY allsumvolume desc
limit 0,
3
0
limit 0,
1
0
</select>
</select>
<sql
id=
"WherePage"
>
<sql
id=
"WherePage"
>
<where>
<where>
...
...
yudao-module-delivery/yudao-module-delivery-rest/src/main/resources/mapper/SalesAnalysisMapper.xml
View file @
6fc4a7ce
...
@@ -4,45 +4,172 @@
...
@@ -4,45 +4,172 @@
<select
id=
"getListPage"
<select
id=
"getListPage"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq"
parameterType=
"cn.iocoder.yudao.module.delivery.entity.SalesAnalysisReq"
resultType=
"cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp"
>
resultType=
"cn.iocoder.yudao.module.delivery.entity.SalesAnalysisResp"
>
select order_no as orderNo, tidan_no as tidanNo,
select c.order_id as orderId, order_no as orderNo, tidan_no as tidanNo,
c.status,salesman_id as salesmanid,transport_id,marks,
c.status,salesman_id as salesmanid,
w.start_warehouse_name as startwarehousename,
(SELECT nickname from system_user where id=c.salesman_id) as salesmanidName,
c.transport_id as transportId,c.drawee,
if(c.transport_id=1,'海运拼柜','专线空运') as transportIdName,
order_type as ordertype,use_weight_unit as useweightunit,
use_volume_unit as usevolumeunit,
c.marks,w.start_warehouse_name as startwarehousename,
w.dst_warehouse_name as dstwarehousename,w.muDiGuo,w.muDiShi,
w.dst_warehouse_name as dstwarehousename,w.muDiGuo,w.muDiShi,
c.channel_id as channelid,channel.name_zh as channelidName,
c.channel_id as channelid,channel.name_zh as channelidName,
c.create_time as createtime,sum_quantity as sumquantity,
c.create_time as createtime,sum_quantity as sumquantity,
sum_volume as sumvolume,sum_weight as sumweight,
sum_volume as sumvolume,sum_weight as sumweight,
is_cargo_control as iscargocontrol
if(is_cargo_control=0,'否','是') as iscargocontrol,
( if( c.transport_id = 1 , c.load_time, c.rucang_time) ) AS businesstime,
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,
(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
from ecw_order c
left join (SELECT ewl.id AS line_id,
left join (SELECT ewl.id AS line_id,
ew_start.id AS start_warehouse_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.id AS dst_warehouse_id,ew_start.title_zh AS start_title_zh,
ew_dest.title_zh AS dst_warehouse_name,
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
ew_start.title_zh AS start_warehouse_name FROM ecw_warehouse_line ewl
LEFT JOIN ecw_warehouse ew_start ON
LEFT JOIN ecw_warehouse ew_start ON ewl.start_warehouse_id = ew_start.id
ewl.start_warehouse_id = ew_start.id
LEFT JOIN ecw_warehouse ew_dest ON ewl.dest_warehouse_id = ew_dest.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_dest on ew_dest.guojia=r_dest.id
LEFT JOIN ecw_region r_sdest on ew_dest.shi=r_sdest.id
LEFT JOIN ecw_region r_sdest on ew_dest.shi=r_sdest.id
) w ON w.line_id = c.line_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 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 and nee.deleted=0
left join ecw_customer sh on sh.id=nee.customer_id and sh.deleted=0
<include
refid=
"WherePage"
/>
<include
refid=
"WherePage"
/>
ORDER BY c.create_time desc limit #{start}, #{size}
ORDER BY c.create_time asc limit #{start}, #{size}
</select>
</select>
<sql
id=
"WherePage"
>
<sql
id=
"WherePage"
>
<where>
<where>
and c.deleted = 0
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!=''"
>
<if
test=
"transportId!=null and transportId!=''"
>
<!--运输方式查询条件-->
<!--运输方式查询条件-->
and c.transport_id= #{transportId}
and c.transport_id= #{transportId}
</if>
</if>
<if
test=
"orderNo!=null and orderNo!=''"
>
<!--订单编号-->
<if
test=
"startWarehouseId!=null and startWarehouseId!=''"
>
and c.order_no= #{orderNo}
<!--始发仓-->
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=
"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>
<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>
</where>
</sql>
</sql>
...
...
yudao-module-shipment/yudao-module-shipment-core/src/main/java/cn/iocoder/yudao/module/shipment/service/makeBillOfLading/MakeBillOfLadingServiceImpl.java
View file @
6fc4a7ce
...
@@ -445,6 +445,7 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
...
@@ -445,6 +445,7 @@ public class MakeBillOfLadingServiceImpl extends AbstractService<MakeBillOfLadin
paramMap
.
put
(
"seaFreight"
,
item
.
getOneSeaFreight
()
+
currencyMap
.
get
(
item
.
getSeaFreightCurrency
())
+
"/m³"
);
paramMap
.
put
(
"seaFreight"
,
item
.
getOneSeaFreight
()
+
currencyMap
.
get
(
item
.
getSeaFreightCurrency
())
+
"/m³"
);
if
(
item
.
getOneClearanceFreight
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
if
(
item
.
getOneClearanceFreight
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
)
{
//paramMap.put("clearanceFreight", "");
//paramMap.put("clearanceFreight", "");
//lanbm 2024-04-29 修改为0的显示
paramMap
.
put
(
"clearanceFreight"
,
"0"
+
currencyMap
.
get
(
item
.
getClearanceFreightCurrency
())
+
"/m³"
);
paramMap
.
put
(
"clearanceFreight"
,
"0"
+
currencyMap
.
get
(
item
.
getClearanceFreightCurrency
())
+
"/m³"
);
}
else
{
}
else
{
paramMap
.
put
(
"clearanceFreight"
,
item
.
getOneClearanceFreight
()
+
currencyMap
.
get
(
item
.
getClearanceFreightCurrency
())
+
"/m³"
);
paramMap
.
put
(
"clearanceFreight"
,
item
.
getOneClearanceFreight
()
+
currencyMap
.
get
(
item
.
getClearanceFreightCurrency
())
+
"/m³"
);
...
...
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/download/DownloadTypeEnum.java
View file @
6fc4a7ce
...
@@ -164,6 +164,16 @@ public enum DownloadTypeEnum implements IntArrayValuable {
...
@@ -164,6 +164,16 @@ public enum DownloadTypeEnum implements IntArrayValuable {
*/
*/
ACHIEVEMENT_DETAIL_EXCEL_EXPORT
(
30
),
ACHIEVEMENT_DETAIL_EXCEL_EXPORT
(
30
),
/*
客户分析报表导出 lanbm 2024-05-01 add
*/
REPORT_CSSTOMER_ANALYSIS
(
31
),
/*
销售分析报表导出 lanbm 2024-05-01 add
*/
REPORT_SALES_ANALYSIS
(
32
),
// ....自己补充
// ....自己补充
;
;
...
...
yudao-module-system/yudao-module-system-impl/src/main/java/cn/iocoder/yudao/module/system/service/downloadLog/DownloadLogServiceImpl.java
View file @
6fc4a7ce
...
@@ -347,6 +347,14 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
...
@@ -347,6 +347,14 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
case
ACHIEVEMENT_DETAIL_EXCEL_EXPORT:
case
ACHIEVEMENT_DETAIL_EXCEL_EXPORT:
achievementDetailExcelExportPushEvent
(
downloadLog
);
achievementDetailExcelExportPushEvent
(
downloadLog
);
break
;
break
;
case
REPORT_CSSTOMER_ANALYSIS:
//客户分析报表 lanbm 2024-05-01 add
REPORT_CSSTOMER_ANALYSIS_Event
(
downloadLog
);
break
;
case
REPORT_SALES_ANALYSIS:
//销售分析报表 lanbm 2024-05-01 add
REPORT_SALES_ANALYSIS_Event
(
downloadLog
);
break
;
default
:
default
:
downloadLog
.
setResult
(
"unknown type"
);
downloadLog
.
setResult
(
"unknown type"
);
break
;
break
;
...
@@ -801,4 +809,42 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
...
@@ -801,4 +809,42 @@ public class DownloadLogServiceImpl extends AbstractService<DownloadLogMapper, D
downloadLog
.
setFileId
(
event
.
getFileId
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
}
/*
lanbm 2024-05-01 add
客户分析
*/
private
void
REPORT_CSSTOMER_ANALYSIS_Event
(
DownloadLogDO
downloadLog
)
{
ReportCustomerAnalysisExcelExportEvent
event
=
new
ReportCustomerAnalysisExcelExportEvent
();
event
.
setUserId
(
downloadLog
.
getUserId
());
event
.
setUserType
(
downloadLog
.
getUserType
());
event
.
setLang
(
downloadLog
.
getLang
());
event
.
setRequestParams
(
downloadLog
.
getRequestParams
());
applicationContext
.
publishEvent
(
event
);
downloadLog
.
setFileName
(
event
.
getFileName
());
downloadLog
.
setPath
(
event
.
getPath
());
downloadLog
.
setDownloadUrl
(
event
.
getUrl
());
downloadLog
.
setResult
(
event
.
getResult
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
/*
销售分析报表 lanbm 2024-05-01 add
*/
private
void
REPORT_SALES_ANALYSIS_Event
(
DownloadLogDO
downloadLog
)
{
ReportSalesAnalysisExcelExportEvent
event
=
new
ReportSalesAnalysisExcelExportEvent
();
event
.
setUserId
(
downloadLog
.
getUserId
());
event
.
setUserType
(
downloadLog
.
getUserType
());
event
.
setLang
(
downloadLog
.
getLang
());
event
.
setRequestParams
(
downloadLog
.
getRequestParams
());
applicationContext
.
publishEvent
(
event
);
downloadLog
.
setFileName
(
event
.
getFileName
());
downloadLog
.
setPath
(
event
.
getPath
());
downloadLog
.
setDownloadUrl
(
event
.
getUrl
());
downloadLog
.
setResult
(
event
.
getResult
());
downloadLog
.
setFileId
(
event
.
getFileId
());
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment