Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
8
8timerapiv200
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
8timerv2
8timerapiv200
Commits
76b342de
Commit
76b342de
authored
Apr 12, 2023
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
CRM 统计数据导出
parent
6014962b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
117 additions
and
12 deletions
+117
-12
src/main/java/cn/timer/api/controller/crm/CrmController.java
+29
-11
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
+8
-0
src/main/java/cn/timer/api/dto/crm/CrmCartogramCountExportDto.java
+54
-0
src/main/resources/mapping/crm/CrmClientDataMapper.xml
+26
-1
No files found.
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
76b342de
package
cn
.
timer
.
api
.
controller
.
crm
;
package
cn
.
timer
.
api
.
controller
.
crm
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
import
java.net.URL
;
import
java.util.ArrayList
;
import
java.net.URLEncoder
;
import
java.util.Comparator
;
import
java.time.LocalDate
;
import
java.util.Date
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.utils.ExcelUtils
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
@@ -67,6 +70,9 @@ import cn.timer.api.utils.ResultUtil;
...
@@ -67,6 +70,9 @@ import cn.timer.api.utils.ResultUtil;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
/**
/**
* Title: CrmController.java
* Title: CrmController.java
*
*
...
@@ -1503,15 +1509,13 @@ public class CrmController {
...
@@ -1503,15 +1509,13 @@ public class CrmController {
reader
.
addHeaderAlias
(
"个人地址"
,
"linkAddress"
);
reader
.
addHeaderAlias
(
"个人地址"
,
"linkAddress"
);
reader
.
addHeaderAlias
(
"跟进记录"
,
"followuprecord"
);
reader
.
addHeaderAlias
(
"跟进记录"
,
"followuprecord"
);
List
<
CrmClientDataImportVo
>
list
=
reader
.
read
(
0
,
1
,
CrmClientDataImportVo
.
class
);
List
<
CrmClientDataImportVo
>
list
=
reader
.
read
(
0
,
1
,
CrmClientDataImportVo
.
class
);
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
for
(
CrmClientDataImportVo
crmClientDataImportVo
:
list
)
{
for
(
CrmClientDataImportVo
crmClientDataImportVo
:
list
)
{
String
name
=
crmClientDataImportVo
.
getClientName
();
String
name
=
crmClientDataImportVo
.
getClientName
();
Map
<
String
,
String
>
map
=
Maps
.
newHashMap
();
try
{
try
{
CrmClientData
crmd
=
CrmClientData
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getBelongUser
,
empNum
).
eq
(
CrmClientData:
:
getClientName
,
crmClientDataImportVo
.
getClientName
())
CrmClientData
crmd
=
CrmClientData
.
builder
().
build
().
selectOne
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
get
OrgCode
,
orgCode
).
eq
(
CrmClientData:
:
get
BelongUser
,
empNum
).
eq
(
CrmClientData:
:
getClientName
,
crmClientDataImportVo
.
getClientName
())
.
eq
(
CrmClientData:
:
getClientCellphone
,
crmClientDataImportVo
.
getClientCellphone
())
);
);
if
(
crmd
==
null
)
{
if
(
crmd
==
null
)
{
String
clientName
=
crmClientDataImportVo
.
getClientName
();
// 客户名称(必填)
String
clientName
=
crmClientDataImportVo
.
getClientName
();
// 客户名称(必填)
String
belongGroupName
=
crmClientDataImportVo
.
getBelongGroupName
();
// 分组名(必填)
String
belongGroupName
=
crmClientDataImportVo
.
getBelongGroupName
();
// 分组名(必填)
...
@@ -1661,6 +1665,20 @@ public class CrmController {
...
@@ -1661,6 +1665,20 @@ public class CrmController {
// return ResultUtil.success("导入成功");
// return ResultUtil.success("导入成功");
}
}
@GetMapping
(
value
=
"/exportCartogram"
)
@ApiOperation
(
value
=
"导出统计"
,
httpMethod
=
"GET"
,
notes
=
"导出统计"
)
public
Result
<
Object
>
exportCartogram
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
belonger
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
HttpServletRequest
request
,
HttpServletResponse
resp
)
{
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)+
" 23:59:59"
;
}
List
<
CrmCartogramCountExportDto
>
userList
=
crmClientDataMapper
.
selectCrmCartogramCount
(
userBean
.
getOrgCode
(),
belonger
,
groupId
,
startCreateTime
,
endCreateTime
);
return
ResultUtil
.
data
(
userList
,
"成功"
);
}
private
ExcelReader
getReaderByUrl
(
String
url
)
{
private
ExcelReader
getReaderByUrl
(
String
url
)
{
InputStream
is
=
null
;
InputStream
is
=
null
;
try
{
try
{
...
...
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
View file @
76b342de
...
@@ -9,6 +9,7 @@ package cn.timer.api.dao.crm;
...
@@ -9,6 +9,7 @@ package cn.timer.api.dao.crm;
import
java.util.List
;
import
java.util.List
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
...
@@ -30,4 +31,11 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
...
@@ -30,4 +31,11 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
@RequestParam
(
name
=
"belongGroup"
,
required
=
false
)
Integer
belongGroup
,
@RequestParam
(
name
=
"belongGroup"
,
required
=
false
)
Integer
belongGroup
,
@RequestParam
(
name
=
"startCreateTime"
,
required
=
false
)
String
startCreateTime
,
@RequestParam
(
name
=
"startCreateTime"
,
required
=
false
)
String
startCreateTime
,
@RequestParam
(
name
=
"endCreateTime"
,
required
=
false
)
String
endCreateTime
);
@RequestParam
(
name
=
"endCreateTime"
,
required
=
false
)
String
endCreateTime
);
List
<
CrmCartogramCountExportDto
>
selectCrmCartogramCount
(
@RequestParam
(
"orgCode"
)
Integer
orgCode
,
@RequestParam
(
name
=
"belongUser"
,
required
=
false
)
Integer
belongUser
,
@RequestParam
(
name
=
"belongGroup"
,
required
=
false
)
Integer
belongGroup
,
@RequestParam
(
name
=
"startCreateTime"
,
required
=
false
)
String
startCreateTime
,
@RequestParam
(
name
=
"endCreateTime"
,
required
=
false
)
String
endCreateTime
);
}
}
src/main/java/cn/timer/api/dto/crm/CrmCartogramCountExportDto.java
0 → 100644
View file @
76b342de
/**
* Title: CrmCartogramDto.java
* Description:
* @author dsc
* @date 2020年6月22日
* @version 1.0
*/
package
cn
.
timer
.
api
.
dto
.
crm
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
/**
*
* @author wuqingjun
* @date 2023年4月12日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
CrmCartogramCountExportDto
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
4445892627839823485L
;
private
Integer
provinceId
;
/**
* 归属人姓名
*/
private
String
belongUserName
;
/**
* 潜在
*/
private
Integer
potential
;
/**
* 意向
*/
private
Integer
intention
;
/**
* 签约
*/
private
Integer
signing
;
/**
* 合作中
*/
private
Integer
cooperation
;
/**
* 已封档
*/
private
Integer
file
;
}
src/main/resources/mapping/crm/CrmClientDataMapper.xml
View file @
76b342de
...
@@ -26,5 +26,29 @@
...
@@ -26,5 +26,29 @@
GROUP BY
GROUP BY
province_id
province_id
</select>
</select>
<select
id=
"selectCrmCartogramCount"
resultType=
"cn.timer.api.dto.crm.CrmCartogramCountExportDto"
>
SELECT belong_user_name,
COUNT(IF(ccd.client_status=1,ccd.id,NULL))potential,
COUNT(IF(ccd.client_status=2,ccd.id,NULL))intention,
COUNT(IF(ccd.client_status=3,ccd.id,NULL))signing,
COUNT(IF(ccd.client_status=4,ccd.id,NULL))cooperation,
COUNT(IF(ccd.client_status=5,ccd.id,NULL))file FROM `crm_client_data` ccd
LEFT JOIN crm_business_group_member cbgm ON cbgm.emp_num = ccd.belong_user
<where>
ccd.org_code = #{orgCode} and cbgm.org_code = #{orgCode}
<if
test=
'null != belongUser and belongUser !=""'
>
AND ccd.belong_user = #{belongUser}
</if>
<if
test=
'null != belongGroup and belongGroup !=""'
>
AND ccd.belong_group = #{belongGroup}
</if>
<if
test=
'null != startCreateTime and startCreateTime !=""'
>
AND ccd.create_time
<![CDATA[>=]]>
#{startCreateTime}
</if>
<if
test=
'null != endCreateTime and endCreateTime !=""'
>
AND ccd.create_time
<![CDATA[<=]]>
#{endCreateTime}
</if>
</where>
GROUP BY ccd.belong_user
</select>
</mapper>
</mapper>
\ No newline at end of file
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