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
5925ec10
Commit
5925ec10
authored
May 01, 2024
by
lanbaoming
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
2024-05-01 报表修改
parent
aeee811d
Changes
16
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
1264 additions
and
742 deletions
+1264
-742
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
+29
-657
SalesAnalysisControl.java
...odule/delivery/controller/admin/SalesAnalysisControl.java
+24
-2
CustomerAnalysisReq.java
...der/yudao/module/delivery/entity/CustomerAnalysisReq.java
+20
-5
CustomerAnalysisResp.java
...er/yudao/module/delivery/entity/CustomerAnalysisResp.java
+5
-3
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
+637
-2
ReportTask.java
...ava/cn/iocoder/yudao/module/delivery/task/ReportTask.java
+41
-0
CustomerAnalysisMapper.xml
...rest/src/main/resources/mapper/CustomerAnalysisMapper.xml
+111
-71
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 @
5925ec10
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 @
5925ec10
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 @
5925ec10
...
@@ -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 @
5925ec10
This diff is collapsed.
Click to expand it.
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/controller/admin/SalesAnalysisControl.java
View file @
5925ec10
...
@@ -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,6 +52,9 @@ public class SalesAnalysisControl {
...
@@ -46,6 +52,9 @@ public class SalesAnalysisControl {
@Autowired
@Autowired
private
DictDataApi
dictDataApi
;
private
DictDataApi
dictDataApi
;
@Resource
private
FileMakeApi
fileMakeApi
;
/*
/*
根据原始信息计算逻辑展示信息 lanbm 2024-04-29 add
根据原始信息计算逻辑展示信息 lanbm 2024-04-29 add
*/
*/
...
@@ -164,13 +173,26 @@ public class SalesAnalysisControl {
...
@@ -164,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/entity/CustomerAnalysisReq.java
View file @
5925ec10
...
@@ -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 @
5925ec10
...
@@ -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/listener/CustomerAnalysisExcelExportListener.java
0 → 100644
View file @
5925ec10
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 @
5925ec10
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 @
5925ec10
...
@@ -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 @
5925ec10
...
@@ -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 @
5925ec10
This diff is collapsed.
Click to expand it.
yudao-module-delivery/yudao-module-delivery-rest/src/main/java/cn/iocoder/yudao/module/delivery/task/ReportTask.java
0 → 100644
View file @
5925ec10
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 @
5925ec10
This diff is collapsed.
Click to expand it.
yudao-module-system/yudao-module-system-api/src/main/java/cn/iocoder/yudao/module/system/enums/download/DownloadTypeEnum.java
View file @
5925ec10
...
@@ -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 @
5925ec10
...
@@ -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