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
68881eaf
Commit
68881eaf
authored
Jul 31, 2023
by
翁国栋
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/feature_20230426_test' into feature_20230426_test
parents
632b2d01
ab8133df
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
980 additions
and
224 deletions
+980
-224
src/main/java/cn/timer/api/bean/crm/CrmClientLog.java
+69
-0
src/main/java/cn/timer/api/controller/crm/CrmController.java
+395
-217
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
+42
-1
src/main/java/cn/timer/api/dao/crm/CrmClientFollowMapper.java
+27
-0
src/main/java/cn/timer/api/dao/crm/CrmClientLogMapper.java
+18
-0
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountDto.java
+40
-0
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountParam.java
+52
-0
src/main/java/cn/timer/api/dto/crm/CrmClientFollowListDto.java
+29
-0
src/main/java/cn/timer/api/utils/DateUtil.java
+38
-4
src/main/resources/mapping/crm/CrmClientDataMapper.xml
+192
-2
src/main/resources/mapping/crm/CrmClientFollowMapper.xml
+70
-0
src/main/resources/mapping/crm/CrmClientLogMapper.xml
+8
-0
No files found.
src/main/java/cn/timer/api/bean/crm/CrmClientLog.java
0 → 100644
View file @
68881eaf
package
cn
.
timer
.
api
.
bean
.
crm
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.IdType
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.extension.activerecord.Model
;
import
io.swagger.annotations.ApiModel
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
javax.persistence.*
;
import
java.util.Date
;
/**
* Title: 客户跟进动态日志表
*
* @Description:
* @author wuqingjun
* @date 2023年7月31日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"crm_client_log"
)
@ApiModel
(
"客户跟进动态日志表"
)
public
class
CrmClientLog
extends
Model
<
CrmClientLog
>
{
private
static
final
long
serialVersionUID
=
-
7362549097557018582L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"编号"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"客户数据id"
)
private
Integer
cid
;
@ApiModelProperty
(
value
=
"变更前客户数据状态"
)
private
Integer
beforeClientStatus
;
@ApiModelProperty
(
value
=
"变更后客户数据状态"
)
private
Integer
afterClientStatus
;
@ApiModelProperty
(
value
=
"创建人"
)
private
Integer
createUser
;
@ApiModelProperty
(
value
=
"企业id"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"创建人姓名"
)
private
String
createUserName
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remark
;
@TableField
(
fill
=
FieldFill
.
INSERT
)
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
}
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
68881eaf
...
@@ -4,8 +4,10 @@ import java.io.FileNotFoundException;
...
@@ -4,8 +4,10 @@ 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.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.net.URL
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalDate
;
import
java.time.LocalDate
;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
...
@@ -14,14 +16,15 @@ import cn.timer.api.bean.crm.*;
...
@@ -14,14 +16,15 @@ import cn.timer.api.bean.crm.*;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.dao.crm.
CrmRemindRuleMapper
;
import
cn.timer.api.dao.crm.
*
;
import
cn.timer.api.dto.clazz.CityClazzDto
;
import
cn.timer.api.dto.clazz.CityClazzDto
;
import
cn.timer.api.dto.crm.
CrmCartogramCountExportDto
;
import
cn.timer.api.dto.crm.
*
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.dto.yggl.YgCityDto
;
import
cn.timer.api.dto.yggl.YgCityDto
;
import
cn.timer.api.utils.ExcelUtils
;
import
cn.timer.api.utils.ExcelUtils
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.checkerframework.checker.units.qual.A
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.BeanUtils
;
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
;
...
@@ -57,11 +60,7 @@ import cn.timer.api.config.annotation.CurrentUser;
...
@@ -57,11 +60,7 @@ import cn.timer.api.config.annotation.CurrentUser;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enums.SysRoleType
;
import
cn.timer.api.config.enums.SysRoleType
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.controller.kqgl.ClockInTool
;
import
cn.timer.api.dao.crm.CrmClientContactsMapper
;
import
cn.timer.api.dao.crm.CrmClientDataMapper
;
import
cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper
;
import
cn.timer.api.dao.qyzx.QyzxEmpEntAssoMapper
;
import
cn.timer.api.dto.crm.CrmCartogramDto
;
import
cn.timer.api.dto.crm.CrmClientDataImportVo
;
import
cn.timer.api.dto.kqmk.DailyDetailsDto
;
import
cn.timer.api.dto.kqmk.DailyDetailsDto
;
import
cn.timer.api.dto.xcgl.ImportDescriptionDto
;
import
cn.timer.api.dto.xcgl.ImportDescriptionDto
;
import
cn.timer.api.utils.CheckUtil
;
import
cn.timer.api.utils.CheckUtil
;
...
@@ -101,6 +100,10 @@ public class CrmController {
...
@@ -101,6 +100,10 @@ public class CrmController {
@Autowired
@Autowired
private
CrmRemindRuleMapper
crmRemindRuleMapper
;
private
CrmRemindRuleMapper
crmRemindRuleMapper
;
@Autowired
private
CrmClientFollowMapper
crmClientFollowMapper
;
@Autowired
private
CrmClientLogMapper
crmClientLogMapper
;
private
Integer
getEmpNum
(
UserBean
userBean
)
{
private
Integer
getEmpNum
(
UserBean
userBean
)
{
return
userBean
.
getEmpNum
();
return
userBean
.
getEmpNum
();
...
@@ -447,6 +450,14 @@ public class CrmController {
...
@@ -447,6 +450,14 @@ public class CrmController {
}
}
crmClientData
.
setContactsNum
(
contactsnum
);
crmClientData
.
setContactsNum
(
contactsnum
);
crmClientData
.
updateById
();
crmClientData
.
updateById
();
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
crmClientData
.
getId
())
.
beforeClientStatus
(
0
).
afterClientStatus
(
crmClientData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
orgCode
)
.
remark
(
"新增客户"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"新增成功"
);
return
ResultUtil
.
success
(
"新增成功"
);
}
}
...
@@ -518,23 +529,24 @@ public class CrmController {
...
@@ -518,23 +529,24 @@ public class CrmController {
return
ResultUtil
.
data
(
list
,
"获取成功"
);
return
ResultUtil
.
data
(
list
,
"获取成功"
);
}
}
// 归属我的客户
// 归属我的客户
private
List
<
CrmClientData
>
getMyCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
private
List
<
CrmClientData
>
getMyCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
)
{
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
,
Integer
industry
)
{
return
CrmClientData
.
builder
().
build
()
return
CrmClientData
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
CrmClientData:
:
getBelongUser
,
empNum
)
.
eq
(
CrmClientData:
:
getBelongUser
,
empNum
)
.
eq
(
groupId
!=
null
&&
groupId
>
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
eq
(
groupId
!=
null
&&
groupId
>
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
eq
(
status
!=
null
&&
status
>
0
,
CrmClientData:
:
getClientStatus
,
status
).
eq
(
typei
!=
null
&&
typei
>
0
,
CrmClientData:
:
getClientType
,
typei
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
).
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getBelongUserName
,
like
).
or
()
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
).
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getBelongUserName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
).
having
(
"org_code = {0}"
,
orgCode
).
having
(
"belong_user = {0}"
,
empNum
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
).
having
(
"org_code = {0}"
,
orgCode
).
having
(
"belong_user = {0}"
,
empNum
)
}
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
}
// 我协作的客户
// 我协作的客户
private
List
<
CrmClientData
>
getMyAssociateCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
private
List
<
CrmClientData
>
getMyAssociateCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
...
@@ -562,27 +574,38 @@ public class CrmController {
...
@@ -562,27 +574,38 @@ public class CrmController {
return
myCrmClientAssociates
;
return
myCrmClientAssociates
;
}
}
// 我的全部客户
// 我的全部客户
private
List
<
CrmClientData
>
getMyTotalCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
private
List
<
CrmClientData
>
getMyTotalCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
Integer
typei
)
{
String
like
,
Integer
typei
,
Integer
industry
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
),
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
null
,
null
,
null
,
null
,
null
,
industry
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
null
,
null
,
null
,
null
),
true
);
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
null
,
null
,
null
,
null
),
true
);
}
}
// 我关注的客户
// 我关注的客户
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
)
{
private
List
<
CrmClientData
>
getMyStarCilent
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
,
Integer
industry
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
,
industry
).
stream
()
.
filter
(
item
->
item
.
getStar
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
.
filter
(
item
->
item
.
getStar
().
equals
(
1
)).
collect
(
Collectors
.
toList
());
}
}
// 七天未跟进的客户
// 七天未跟进的客户
private
List
<
CrmClientData
>
getCilentFollowOvertime
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
private
List
<
CrmClientData
>
getCilentFollowOvertime
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
Integer
typei
)
{
Integer
status
,
Integer
typei
)
{
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
).
stream
()
return
getMyTotalCilent
(
empNum
,
orgCode
,
groupId
,
status
,
null
,
null
,
null
).
stream
()
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
-
7
)))
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
-
7
)))
.
collect
(
Collectors
.
toList
());
.
collect
(
Collectors
.
toList
());
}
}
private
List
<
CrmClientData
>
getCilentFollowNotDays
(
Integer
empNum
,
Integer
orgCode
,
Integer
groupId
,
Integer
status
,
String
like
,
String
startCreateTime
,
String
endCreateTime
,
String
startFollowTime
,
String
endFollowTime
,
Integer
typei
,
Integer
industry
,
Integer
unfollowedDays
)
{
return
CheckUtil
.
distinct
(
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
industry
),
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
),
true
).
stream
()
.
filter
(
item
->
item
.
getLastFollowTime
()
!=
null
&&
item
.
getLastFollowTime
().
before
(
DateUtil
.
offsetDay
(
new
Date
(),
0
-
unfollowedDays
)))
.
collect
(
Collectors
.
toList
());
}
private
<
T
>
List
<
T
>
getPageList
(
List
<
T
>
list
,
int
pageNumber
,
int
pageSize
,
Comparator
<
T
>
comparator
)
{
private
<
T
>
List
<
T
>
getPageList
(
List
<
T
>
list
,
int
pageNumber
,
int
pageSize
,
Comparator
<
T
>
comparator
)
{
return
list
.
stream
().
sorted
(
comparator
).
skip
((
pageNumber
-
1
)
*
pageSize
).
limit
(
pageSize
)
return
list
.
stream
().
sorted
(
comparator
).
skip
((
pageNumber
-
1
)
*
pageSize
).
limit
(
pageSize
)
...
@@ -590,45 +613,53 @@ public class CrmController {
...
@@ -590,45 +613,53 @@ public class CrmController {
}
}
@GetMapping
(
"getMyCilentTotal"
)
@GetMapping
(
"getMyCilentTotal"
)
@ApiOperation
(
value
=
"获取我的客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取我的客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
CrmClientData
>>
getMyCilentTotal
(
@CurrentUser
UserBean
userBean
,
public
Result
<
List
<
CrmClientData
>>
getMyCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
Integer
typei
)
{
@RequestParam
(
required
=
false
)
Integer
typei
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
@RequestParam
(
required
=
false
)
Integer
followNumber
,
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
@RequestParam
(
required
=
false
)
Integer
industry
)
{
}
if
(
endFollowTime
!=
null
&&
!(
""
).
equals
(
endFollowTime
))
{
if
(
endCreateTime
!=
null
&&
!(
""
).
equals
(
endCreateTime
))
{
endFollowTime
=
endFollowTime
.
substring
(
0
,
10
)
+
" 23:59:59"
;
endCreateTime
=
endCreateTime
.
substring
(
0
,
10
)+
" 23:59:59"
;
}
}
if
(
endFollowTime
!=
null
&&
!(
""
).
equals
(
endFollowTime
))
{
Integer
empNum
=
getEmpNum
(
userBean
);
endFollowTime
=
endFollowTime
.
substring
(
0
,
10
)+
" 23:59:59"
;
Integer
orgCode
=
getOrgCode
(
userBean
);
}
List
<
CrmClientData
>
crmClientDatas
=
null
;
if
(
type
==
null
||
type
==
0
)
{
// 全部客户(去重)
Integer
empNum
=
getEmpNum
(
userBean
);
List
<
CrmClientData
>
myClient
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
Integer
orgCode
=
getOrgCode
(
userBean
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
List
<
CrmClientData
>
crmClientDatas
=
null
;
crmClientDatas
=
CheckUtil
.
distinct
(
myClient
,
myAsso
,
true
).
stream
()
if
(
type
==
null
||
type
==
0
)
{
// 全部客户(去重)
.
filter
(
CheckUtil
.
distinctByKey
(
CrmClientData:
:
getId
)).
collect
(
Collectors
.
toList
());
//List<CrmClientData> myClient = getMyCilent(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei,industry);
}
else
if
(
type
==
1
)
// 我负责的客户
List
<
CrmClientData
>
myClient
=
crmClientDataMapper
.
getCrmClientData
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
unfollowedDays
,
followNumber
,
industry
);
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
);
List
<
CrmClientData
>
myAsso
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
else
if
(
type
==
2
)
// 我协作的客户
crmClientDatas
=
CheckUtil
.
distinct
(
myClient
,
myAsso
,
true
).
stream
()
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
.
filter
(
CheckUtil
.
distinctByKey
(
CrmClientData:
:
getId
)).
collect
(
Collectors
.
toList
());
else
if
(
type
==
3
)
// 我关注的客户
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
// if (unfollowedDays != null){
else
if
(
type
==
4
)
// 七天未跟进的客户
// crmClientDatas = getCilentFollowNotDays(empNum, orgCode, groupId, status, like,startCreateTime,endCreateTime,startFollowTime,endFollowTime,typei,industry,unfollowedDays);
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
// }
else
}
else
if
(
type
==
1
)
// 我负责的客户
return
ResultUtil
.
error
(
"查询失败"
);
crmClientDatas
=
getMyCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
typei
,
industry
);
else
if
(
type
==
2
)
// 我协作的客户
crmClientDatas
=
getMyAssociateCilent
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
typei
,
startFollowTime
,
endFollowTime
,
startCreateTime
,
endCreateTime
);
else
if
(
type
==
3
)
// 我关注的客户
crmClientDatas
=
getMyStarCilent
(
empNum
,
orgCode
,
groupId
,
status
,
typei
,
industry
);
else
if
(
type
==
4
)
// 七天未跟进的客户
crmClientDatas
=
getCilentFollowOvertime
(
empNum
,
orgCode
,
groupId
,
status
,
typei
);
else
return
ResultUtil
.
error
(
"查询失败"
);
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
// Collections.sort(crmClientDatas, Comparator.comparing(CrmClientData::getCreateTime).reversed()); // 按时间降序排序
// int pageNumber = 1;
// int pageNumber = 1;
...
@@ -686,36 +717,38 @@ public class CrmController {
...
@@ -686,36 +717,38 @@ public class CrmController {
return
managers
.
stream
().
map
(
CrmBusinessGroupMember:
:
getGid
).
collect
(
Collectors
.
toList
());
return
managers
.
stream
().
map
(
CrmBusinessGroupMember:
:
getGid
).
collect
(
Collectors
.
toList
());
}
}
@GetMapping
(
"getSeaCilentTotal"
)
@GetMapping
(
"getSeaCilentTotal"
)
@ApiOperation
(
value
=
"获取公海客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取公海客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
CrmClientData
>>
getSeaCilentTotal
(
@CurrentUser
UserBean
userBean
,
public
Result
<
List
<
CrmClientData
>>
getSeaCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
)
Integer
industry
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
Integer
empNum
=
getEmpNum
(
userBean
);
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
// YgglMainEmp yg = YgglMainEmp.builder().build()
// YgglMainEmp yg = YgglMainEmp.builder().build()
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .selectOne(new QueryWrapper<YgglMainEmp>().lambda().eq(YgglMainEmp::getOrgCode, orgCode)
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
// .eq(YgglMainEmp::getEmpNum, empNum).select(YgglMainEmp::getIsManager));
// if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
// if (yg != null && yg.getIsManager() != null && (yg.getIsManager() == 1 || yg.getIsManager() == 2)) {
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
build
()
QyzxEmpEntAsso
qyzxEmpEntAsso
=
QyzxEmpEntAsso
.
builder
().
build
()
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
.
selectOne
(
new
LambdaQueryWrapper
<
QyzxEmpEntAsso
>().
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
orgCode
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
empNum
));
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
empNum
));
if
(
qyzxEmpEntAsso
!=
null
&&
qyzxEmpEntAsso
.
getUserType
()
!=
null
if
(
qyzxEmpEntAsso
!=
null
&&
qyzxEmpEntAsso
.
getUserType
()
!=
null
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
List
<
CrmClientData
>
list
=
CrmClientData
.
builder
().
build
()
List
<
CrmClientData
>
list
=
CrmClientData
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
// int pageNumber = 1;
// int pageNumber = 1;
// int pageSize = 5;
// int pageSize = 5;
...
@@ -728,45 +761,49 @@ public class CrmController {
...
@@ -728,45 +761,49 @@ public class CrmController {
}
else
{
}
else
{
// 当前用户加入的组
// 当前用户加入的组
List
<
Integer
>
gids1
=
MyJoinGroup
(
empNum
,
orgCode
);
List
<
Integer
>
gids1
=
MyJoinGroup
(
empNum
,
orgCode
);
// 当前用户管理的组
// 当前用户管理的组
List
<
Integer
>
gids2
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
Integer
>
gids2
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
Integer
>
myGids
=
CheckUtil
.
distinct
(
gids1
,
gids2
,
true
);
// 当前用户所有业务组id
List
<
Integer
>
myGids
=
CheckUtil
.
distinct
(
gids1
,
gids2
,
true
);
// 当前用户所有业务组id
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
for
(
Integer
gid
:
myGids
)
{
for
(
Integer
gid
:
myGids
)
{
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
()
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
()
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
.
selectList
(
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getBelongUser
,
0
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
CrmClientData:
:
getHidingcustomers
,
1
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
industry
!=
null
&&
industry
>
0
,
CrmClientData:
:
getIndustry
,
industry
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
for
(
CrmClientData
data
:
datas
)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
crmClientDatas
.
add
(
data
);
for
(
CrmClientData
data
:
datas
)
}
crmClientDatas
.
add
(
data
);
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
}
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
return
ResultUtil
.
pageData
(
result
,
(
long
)
crmClientDatas
.
size
(),
"查询成功"
);
// return ResultUtil.data(crmClientDatas, "查询成功");
// return ResultUtil.data(crmClientDatas, "查询成功");
}
}
}
}
@GetMapping
(
"getAllCilentTotal"
)
@GetMapping
(
"getAllCilentTotal"
)
@ApiOperation
(
value
=
"获取所有客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
@ApiOperation
(
value
=
"获取所有客户列表(全)"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
Object
>
getAllCilentTotal
(
@CurrentUser
UserBean
userBean
,
public
Result
<
Object
>
getAllCilentTotal
(
@CurrentUser
UserBean
userBean
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
type
,
@RequestParam
(
required
=
false
)
Integer
groupId
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
String
customerowner
,
@RequestParam
(
required
=
false
)
Integer
status
,
@RequestParam
(
required
=
false
)
String
like
,
@RequestParam
(
required
=
false
)
String
customerowner
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
startCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
endCreateTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
startFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
String
endFollowTime
,
@RequestParam
(
required
=
false
)
String
ifPhone
,
@RequestParam
(
required
=
false
)
String
ifPhone
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"1"
)
int
pageNumber
,
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
)
{
@RequestParam
(
required
=
false
,
defaultValue
=
"10"
)
int
pageSize
,
@RequestParam
(
required
=
false
)
Integer
unfollowedDays
,
@RequestParam
(
required
=
false
)
Integer
followNumber
,
@RequestParam
(
required
=
false
)
Integer
industry
)
{
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
...
@@ -789,86 +826,98 @@ public class CrmController {
...
@@ -789,86 +826,98 @@ public class CrmController {
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
&&
(
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_ADMIN
.
getType
()
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
||
qyzxEmpEntAsso
.
getUserType
()
==
SysRoleType
.
U_TYPE_C_ADMIN
.
getType
()))
{
IPage
<
CrmClientData
>
page
=
new
Page
<
CrmClientData
>(
pageNumber
,
pageSize
);
IPage
<
CrmClientData
>
page
=
new
Page
<
CrmClientData
>(
pageNumber
,
pageSize
);
List
<
CrmBusinessGroupMember
>
grouplis
=
CrmBusinessGroupMember
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmBusinessGroupMember
>().
lambda
().
eq
(
CrmBusinessGroupMember:
:
getEmpNum
,
userBean
.
getEmpNum
())
List
<
CrmBusinessGroupMember
>
grouplis
=
CrmBusinessGroupMember
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmBusinessGroupMember
>().
lambda
().
eq
(
CrmBusinessGroupMember:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
CrmBusinessGroupMember:
:
getOrgCode
,
userBean
.
getOrgCode
()));
.
eq
(
CrmBusinessGroupMember:
:
getOrgCode
,
userBean
.
getOrgCode
()));
String
keywordStr
=
""
;
String
keywordStr
=
""
;
IPage
<
CrmClientData
>
datas
;
IPage
<
CrmClientData
>
datas
;
Integer
count
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
Integer
count
=
new
LambdaQueryChainWrapper
<
QyzxEmpEntAsso
>(
qyzxEmpEntAssoMapper
)
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
QyzxEmpEntAsso:
:
getEmpNum
,
userBean
.
getEmpNum
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
eq
(
QyzxEmpEntAsso:
:
getOrgCode
,
userBean
.
getOrgCode
())
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
"0,1"
)
.
in
(
QyzxEmpEntAsso:
:
getUserType
,
"0,1"
)
.
count
();
.
count
();
if
(
count
>
0
)
{
if
(
count
>
0
)
{
//qw -> qw.like(ZpglRcxx::getName, query).or().eq(ZpglRcxx::getMobile, query).or().eq(ZpglRcxx::getMail, query)
//qw -> qw.like(ZpglRcxx::getName, query).or().eq(ZpglRcxx::getMobile, query).or().eq(ZpglRcxx::getMail, query)
datas
=
CrmClientData
.
builder
().
build
().
selectPage
(
page
,
// datas = CrmClientData.builder().build().selectPage(page,
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
// new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
)
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
}
else
{
// .orderByDesc(CrmClientData::getCreateTime));
if
(
grouplis
.
size
()
>
0
&&
grouplis
!=
null
)
{
StringBuffer
sb
=
new
StringBuffer
();
datas
=
crmClientDataMapper
.
getCrmClientData1
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
for
(
CrmBusinessGroupMember
grp
:
grouplis
)
{
}
else
{
sb
.
append
(
grp
.
getGid
()).
append
(
","
);
if
(
grouplis
.
size
()>
0
&&
grouplis
!=
null
)
{
}
StringBuffer
sb
=
new
StringBuffer
();
keywordStr
=
sb
.
deleteCharAt
(
sb
.
length
()
-
1
).
toString
();
for
(
CrmBusinessGroupMember
grp
:
grouplis
)
{
}
sb
.
append
(
grp
.
getGid
()).
append
(
","
);
}
datas
=
CrmClientData
.
builder
().
build
().
selectPage
(
page
,
keywordStr
=
sb
.
deleteCharAt
(
sb
.
length
()
-
1
).
toString
();
new
QueryWrapper
<
CrmClientData
>().
lambda
().
eq
(
CrmClientData:
:
getOrgCode
,
orgCode
)
}
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
// datas = CrmClientData.builder().build().selectPage(page,
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
).
in
(
CrmClientData:
:
getBelongGroup
,
keywordStr
)
// new QueryWrapper<CrmClientData>().lambda().eq(CrmClientData::getOrgCode, orgCode)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status).in(CrmClientData::getBelongGroup, keywordStr)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.
orderByDesc
(
CrmClientData:
:
getCreateTime
));
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
}
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like)
// .orderByDesc(CrmClientData::getCreateTime));
datas
=
crmClientDataMapper
.
getCrmClientData2
(
page
,
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
}
return
ResultUtil
.
pageData
(
datas
.
getRecords
(),
datas
.
getTotal
(),
"查询成功"
);
return
ResultUtil
.
pageData
(
datas
.
getRecords
(),
datas
.
getTotal
(),
"查询成功"
);
}
else
{
}
else
{
// 当前用户管理的组
// 当前用户管理的组
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
Integer
>
gids
=
MyManageGroup
(
empNum
,
orgCode
);
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
List
<
CrmClientData
>
crmClientDatas
=
new
ArrayList
<
CrmClientData
>();
for
(
Integer
gid
:
gids
)
{
for
(
Integer
gid
:
gids
)
{
List
<
CrmClientData
>
datas
=
CrmClientData
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientData
>()
// List<CrmClientData> datas = CrmClientData.builder().build().selectList(new QueryWrapper<CrmClientData>()
.
lambda
().
eq
(
CrmClientData:
:
getBelongGroup
,
gid
)
// .lambda().eq(CrmClientData::getBelongGroup, gid)
.
eq
(
groupId
!=
null
&&
groupId
>=
0
,
CrmClientData:
:
getBelongGroup
,
groupId
)
// .eq(industry != null && industry > 0, CrmClientData::getIndustry,industry)
.
eq
(
type
!=
null
&&
type
>=
0
,
CrmClientData:
:
getClientType
,
type
).
like
(!
StrUtil
.
isBlank
(
customerowner
),
CrmClientData:
:
getBelongUserName
,
customerowner
)
// .eq(groupId != null && groupId >= 0, CrmClientData::getBelongGroup, groupId)
.
eq
(
status
!=
null
&&
status
>=
0
,
CrmClientData:
:
getClientStatus
,
status
)
// .eq(type != null && type >= 0, CrmClientData::getClientType, type).like(!StrUtil.isBlank(customerowner), CrmClientData::getBelongUserName, customerowner)
.
likeRight
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"1"
.
equals
(
ifPhone
),
CrmClientData:
:
getClientCellphone
,
"1"
)
// .eq(status != null && status >= 0, CrmClientData::getClientStatus, status)
.
and
(!
StringUtils
.
isBlank
(
ifPhone
)
&&
"2"
.
equals
(
ifPhone
),
qw
->
qw
.
isNull
(
CrmClientData:
:
getClientCellphone
).
or
().
eq
(
CrmClientData:
:
getClientCellphone
,
""
))
// .likeRight(!StringUtils.isBlank(ifPhone)&&"1".equals(ifPhone),CrmClientData::getClientCellphone,"1")
.
ge
(
StringUtils
.
isNotBlank
(
startCreateTime
),
CrmClientData:
:
getCreateTime
,
startCreateTime
)
// .and(!StringUtils.isBlank(ifPhone)&&"2".equals(ifPhone),qw -> qw.isNull(CrmClientData::getClientCellphone).or().eq(CrmClientData::getClientCellphone,""))
.
le
(
StringUtils
.
isNotBlank
(
endCreateTime
),
CrmClientData:
:
getCreateTime
,
endCreateTime
)
// .ge(StringUtils.isNotBlank(startCreateTime), CrmClientData::getCreateTime, startCreateTime)
.
ge
(
StringUtils
.
isNotBlank
(
startFollowTime
),
CrmClientData:
:
getLastFollowTime
,
startFollowTime
)
// .le(StringUtils.isNotBlank(endCreateTime), CrmClientData::getCreateTime, endCreateTime)
.
le
(
StringUtils
.
isNotBlank
(
endFollowTime
),
CrmClientData:
:
getLastFollowTime
,
endFollowTime
)
// .ge(StringUtils.isNotBlank(startFollowTime), CrmClientData::getLastFollowTime, startFollowTime)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientName
,
like
).
or
()
// .le(StringUtils.isNotBlank(endFollowTime), CrmClientData::getLastFollowTime, endFollowTime)
.
like
(!
StrUtil
.
isBlank
(
like
),
CrmClientData:
:
getClientCellphone
,
like
));
// .like(!StrUtil.isBlank(like), CrmClientData::getClientName, like).or()
for
(
CrmClientData
data
:
datas
)
// .like(!StrUtil.isBlank(like), CrmClientData::getClientCellphone, like));
crmClientDatas
.
add
(
data
);
}
List
<
CrmClientData
>
datas
=
crmClientDataMapper
.
getCrmClientData3
(
empNum
,
orgCode
,
groupId
,
status
,
like
,
startCreateTime
,
endCreateTime
,
startFollowTime
,
endFollowTime
,
type
,
ifPhone
,
customerowner
,
unfollowedDays
,
followNumber
,
industry
);
for
(
CrmClientData
data
:
datas
)
crmClientDatas
.
add
(
data
);
}
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
List
<
CrmClientData
>
result
=
getPageList
(
crmClientDatas
,
pageNumber
,
pageSize
,
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
Comparator
.
comparing
(
CrmClientData:
:
getCreateTime
).
reversed
());
...
@@ -983,6 +1032,14 @@ public class CrmController {
...
@@ -983,6 +1032,14 @@ public class CrmController {
crmRemindRule
.
setCreateTime
(
new
Date
());
crmRemindRule
.
setCreateTime
(
new
Date
());
crmRemindRule
.
insert
();
crmRemindRule
.
insert
();
}
}
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
oldData
.
getId
())
.
beforeClientStatus
(
oldData
.
getClientStatus
()).
afterClientStatus
(
crmClientFollow
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
orgCode
)
.
remark
(
"新增跟进记录"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"新增成功"
);
return
ResultUtil
.
success
(
"新增成功"
);
}
}
return
ResultUtil
.
error
(
"新增失败"
);
return
ResultUtil
.
error
(
"新增失败"
);
...
@@ -1030,10 +1087,26 @@ public class CrmController {
...
@@ -1030,10 +1087,26 @@ public class CrmController {
if
(
status
!=
null
&&
status
!=
5
)
{
if
(
status
!=
null
&&
status
!=
5
)
{
crmClientData
.
setClientStatus
(
5
);
crmClientData
.
setClientStatus
(
5
);
crmClientData
.
updateById
();
crmClientData
.
updateById
();
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
crmClientData
.
getId
())
.
beforeClientStatus
(
status
).
afterClientStatus
(
crmClientData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"封档成功"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"封档成功"
);
return
ResultUtil
.
success
(
"封档成功"
);
}
else
if
(
status
==
5
)
{
}
else
if
(
status
==
5
)
{
crmClientData
.
setClientStatus
(
1
);
// 解封后默认潜在状态
crmClientData
.
setClientStatus
(
1
);
// 解封后默认潜在状态
crmClientData
.
updateById
();
crmClientData
.
updateById
();
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
crmClientData
.
getId
())
.
beforeClientStatus
(
status
).
afterClientStatus
(
crmClientData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"解封成功"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"解封成功"
);
return
ResultUtil
.
success
(
"解封成功"
);
}
else
}
else
return
ResultUtil
.
error
(
"失败"
);
return
ResultUtil
.
error
(
"失败"
);
...
@@ -1065,6 +1138,14 @@ public class CrmController {
...
@@ -1065,6 +1138,14 @@ public class CrmController {
if
(
CrmClientData
.
builder
().
id
(
cid
).
belongUser
(
belongUser
)
if
(
CrmClientData
.
builder
().
id
(
cid
).
belongUser
(
belongUser
)
.
belongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belongUser
)).
build
().
updateById
())
.
belongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belongUser
)).
build
().
updateById
())
return
ResultUtil
.
success
(
"指派成功"
);
return
ResultUtil
.
success
(
"指派成功"
);
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
oldData
.
getId
())
.
beforeClientStatus
(
oldData
.
getClientStatus
()).
afterClientStatus
(
oldData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"指派成功"
)
.
build
().
insert
();
return
ResultUtil
.
error
(
"指派失败"
);
return
ResultUtil
.
error
(
"指派失败"
);
}
}
...
@@ -1091,8 +1172,17 @@ public class CrmController {
...
@@ -1091,8 +1172,17 @@ public class CrmController {
// 删除协作人列表
// 删除协作人列表
CrmClientAssociate
.
builder
().
build
()
CrmClientAssociate
.
builder
().
build
()
.
delete
(
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getCid
,
cid
));
.
delete
(
new
QueryWrapper
<
CrmClientAssociate
>().
lambda
().
eq
(
CrmClientAssociate:
:
getCid
,
cid
));
if
(
oldData
.
updateById
())
if
(
oldData
.
updateById
()){
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
oldData
.
getId
())
.
beforeClientStatus
(
oldData
.
getClientStatus
()).
afterClientStatus
(
oldData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"释放到公海"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"释放成功"
);
return
ResultUtil
.
success
(
"释放成功"
);
}
return
ResultUtil
.
error
(
"释放失败"
);
return
ResultUtil
.
error
(
"释放失败"
);
}
}
...
@@ -1112,8 +1202,17 @@ public class CrmController {
...
@@ -1112,8 +1202,17 @@ public class CrmController {
return
ResultUtil
.
error
(
"不是当前业务组成员"
);
return
ResultUtil
.
error
(
"不是当前业务组成员"
);
oldData
.
setBelongUser
(
empNum
);
oldData
.
setBelongUser
(
empNum
);
oldData
.
setBelongUserName
(
getEmpName
(
orgCode
,
empNum
));
oldData
.
setBelongUserName
(
getEmpName
(
orgCode
,
empNum
));
if
(
oldData
.
updateById
())
if
(
oldData
.
updateById
()){
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
oldData
.
getId
())
.
beforeClientStatus
(
oldData
.
getClientStatus
()).
afterClientStatus
(
oldData
.
getClientStatus
())
.
createUser
(
empNum
)
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
orgCode
)
.
remark
(
"接收客户"
)
.
build
().
insert
();
return
ResultUtil
.
success
(
"接收成功"
);
return
ResultUtil
.
success
(
"接收成功"
);
}
return
ResultUtil
.
error
(
"接收失败"
);
return
ResultUtil
.
error
(
"接收失败"
);
}
}
...
@@ -1159,6 +1258,14 @@ public class CrmController {
...
@@ -1159,6 +1258,14 @@ public class CrmController {
crmClientData
.
setBelongUser
(
belonger
);
crmClientData
.
setBelongUser
(
belonger
);
crmClientData
.
setBelongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belonger
));
crmClientData
.
setBelongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belonger
));
crmClientData
.
updateById
();
crmClientData
.
updateById
();
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
crmClientData
.
getId
())
.
beforeClientStatus
(
crmClientData
.
getClientStatus
()).
afterClientStatus
(
crmClientData
.
getClientStatus
())
.
createUser
(
userBean
.
getEmpNum
())
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"转移客户"
)
.
build
().
insert
();
}
}
return
ResultUtil
.
success
(
"转移成功"
);
return
ResultUtil
.
success
(
"转移成功"
);
...
@@ -1195,6 +1302,14 @@ public class CrmController {
...
@@ -1195,6 +1302,14 @@ public class CrmController {
CrmClientData
.
builder
().
id
(
yid
).
hidingcustomers
(
0
).
build
().
updateById
();
CrmClientData
.
builder
().
id
(
yid
).
hidingcustomers
(
0
).
build
().
updateById
();
/*** 客户跟进动态日志 ***/
CrmClientLog
.
builder
().
cid
(
crda
.
getId
())
.
beforeClientStatus
(
crda
.
getClientStatus
()).
afterClientStatus
(
crda
.
getClientStatus
())
.
createUser
(
userBean
.
getEmpNum
())
.
createUserName
(
userBean
.
getUserInfo
().
getName
())
.
orgCode
(
userBean
.
getOrgCode
())
.
remark
(
"隐藏客户"
)
.
build
().
insert
();
}
}
...
@@ -1251,6 +1366,69 @@ public class CrmController {
...
@@ -1251,6 +1366,69 @@ public class CrmController {
listAll
.
add
(
cartogram6
);
listAll
.
add
(
cartogram6
);
// 跟进图
// 跟进图
listAll
.
add
(
cartogram
(
orgCode
,
groupId
,
7
,
belonger
,
startCreateTime
,
endCreateTime
));
listAll
.
add
(
cartogram
(
orgCode
,
groupId
,
7
,
belonger
,
startCreateTime
,
endCreateTime
));
// 新增潜在客户数量跟进的客户数量8
Calendar
calendar
=
Calendar
.
getInstance
();
SimpleDateFormat
dateFormat
=
new
SimpleDateFormat
(
"yyyy-MM"
);
List
<
String
>
list
=
cn
.
timer
.
api
.
utils
.
DateUtil
.
getDayByMonth
(
dateFormat
.
format
(
calendar
.
getTime
()));
CrmClientFollowCountParam
param
=
new
CrmClientFollowCountParam
();
param
.
setStartTime
(
startCreateTime
);
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
startCreateTime
)){
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
1
);
SimpleDateFormat
df
=
new
SimpleDateFormat
(
"yyyy-MM-dd HH:mm:ss"
);
param
.
setStartTime
(
df
.
format
(
calendar
.
getTime
()));
}
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
endCreateTime
)){
param
.
setEndTime
(
list
.
get
(
list
.
size
()-
1
)+
" 23:59:59"
);
}
param
.
setOrgCode
(
orgCode
);
//
List
<
CrmClientFollowCountDto
>
crmList
=
crmClientFollowMapper
.
selectCrmClientFollowList
(
param
);
CrmClientFollowListDto
source
=
new
CrmClientFollowListDto
();
source
.
setCreateStr
(
list
);
List
<
CrmClientFollowCountDto
>
dtos
=
null
;
CrmClientFollowCountParam
countParam
=
null
;
CrmClientFollowCountDto
countDto
=
null
;
dtos
=
new
ArrayList
<>();
for
(
CrmClientFollowCountDto
dto
:
crmList
)
{
countDto
=
new
CrmClientFollowCountDto
();
BeanUtils
.
copyProperties
(
dto
,
countDto
);
List
<
Integer
>
count
=
new
ArrayList
<>();
countParam
=
new
CrmClientFollowCountParam
();
for
(
String
day
:
list
)
{
countParam
.
setStartTime
(
day
);
countParam
.
setCreateUser
(
dto
.
getCreateUser
());
count
.
add
(
crmClientFollowMapper
.
selectCountByParam
(
countParam
));
countDto
.
setCreateTime
(
day
);
}
countDto
.
setFollowCount
(
count
);
dtos
.
add
(
countDto
);
}
source
.
setDtos
(
dtos
);
listAll
.
add
(
source
);
//跟进动态
List
<
Map
<
String
,
Object
>>
cartogram9
=
new
ArrayList
<
Map
<
String
,
Object
>>();
// 图9
// 统计类型标记
List
<
ClientTypeClass
>
typeCount
=
new
ArrayList
<>();
typeCount
.
add
(
ClientTypeClass
.
builder
().
id
(
1
).
name
(
"潜在客户转化为意向客户"
).
build
());
typeCount
.
add
(
ClientTypeClass
.
builder
().
id
(
2
).
name
(
"意向客户转为合作的客户"
).
build
());
for
(
ClientTypeClass
clientTypeClass
:
typeCount
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"level"
,
clientTypeClass
.
getId
());
map
.
put
(
"name"
,
clientTypeClass
.
getName
());
if
(
clientTypeClass
.
getId
()==
1
){
map
.
put
(
"num"
,
CrmClientLog
.
builder
().
build
().
selectCount
(
new
QueryWrapper
<
CrmClientLog
>().
lambda
().
eq
(
CrmClientLog:
:
getBeforeClientStatus
,
1
).
eq
(
CrmClientLog:
:
getAfterClientStatus
,
2
)));
}
else
if
(
clientTypeClass
.
getId
()==
2
){
map
.
put
(
"num"
,
CrmClientLog
.
builder
().
build
().
selectCount
(
new
QueryWrapper
<
CrmClientLog
>().
lambda
().
eq
(
CrmClientLog:
:
getAfterClientStatus
,
4
)));
}
if
((
Integer
)
map
.
get
(
"num"
)
>
0
)
{
cartogram9
.
add
(
map
);
}
}
listAll
.
add
(
cartogram9
);
return
ResultUtil
.
data
(
listAll
,
"获取成功"
);
return
ResultUtil
.
data
(
listAll
,
"获取成功"
);
}
}
...
...
src/main/java/cn/timer/api/dao/crm/CrmClientDataMapper.java
View file @
68881eaf
...
@@ -10,6 +10,9 @@ package cn.timer.api.dao.crm;
...
@@ -10,6 +10,9 @@ package cn.timer.api.dao.crm;
import
java.util.List
;
import
java.util.List
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
com.baomidou.mybatisplus.core.metadata.IPage
;
import
com.baomidou.mybatisplus.extension.plugins.pagination.Page
;
import
org.apache.ibatis.annotations.Param
;
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
;
...
@@ -38,4 +41,41 @@ public interface CrmClientDataMapper extends BaseMapper<CrmClientData> {
...
@@ -38,4 +41,41 @@ 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
<
CrmClientData
>
getCrmClientData
(
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"typei"
)
Integer
typei
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
IPage
<
CrmClientData
>
getCrmClientData1
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
IPage
<
CrmClientData
>
getCrmClientData2
(
IPage
<
CrmClientData
>
page
,
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
List
<
CrmClientData
>
getCrmClientData3
(
@Param
(
"empNum"
)
Integer
empNum
,
@Param
(
"orgCode"
)
Integer
orgCode
,
@Param
(
"groupId"
)
Integer
groupId
,
@Param
(
"status"
)
Integer
status
,
@Param
(
"like"
)
String
like
,
@Param
(
"startCreateTime"
)
String
startCreateTime
,
@Param
(
"endCreateTime"
)
String
endCreateTime
,
@Param
(
"startFollowTime"
)
String
startFollowTime
,
@Param
(
"endFollowTime"
)
String
endFollowTime
,
@Param
(
"type"
)
Integer
type
,
@Param
(
"ifPhone"
)
String
ifPhone
,
@Param
(
"customerowner"
)
String
customerowner
,
@Param
(
"unfollowedDays"
)
Integer
unfollowedDays
,
@Param
(
"followNumber"
)
Integer
followNumber
,
@Param
(
"industry"
)
Integer
industry
);
}
\ No newline at end of file
src/main/java/cn/timer/api/dao/crm/CrmClientFollowMapper.java
View file @
68881eaf
...
@@ -7,9 +7,16 @@
...
@@ -7,9 +7,16 @@
*/
*/
package
cn
.
timer
.
api
.
dao
.
crm
;
package
cn
.
timer
.
api
.
dao
.
crm
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
cn.timer.api.dto.crm.CrmClientFollowCountDto
;
import
cn.timer.api.dto.crm.CrmClientFollowCountParam
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
cn.timer.api.bean.crm.CrmClientFollow
;
import
cn.timer.api.bean.crm.CrmClientFollow
;
import
org.apache.ibatis.annotations.Param
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
java.util.List
;
/**
/**
* Title: CrmClientFollowMapper.java
* Title: CrmClientFollowMapper.java
...
@@ -20,5 +27,25 @@ import cn.timer.api.bean.crm.CrmClientFollow;
...
@@ -20,5 +27,25 @@ import cn.timer.api.bean.crm.CrmClientFollow;
* @version 1.0
* @version 1.0
*/
*/
public
interface
CrmClientFollowMapper
extends
BaseMapper
<
CrmClientFollow
>
{
public
interface
CrmClientFollowMapper
extends
BaseMapper
<
CrmClientFollow
>
{
/**
* 根据条件查询 统计跟进数据
* @param param
* @return
*/
List
<
CrmClientFollowCountDto
>
selectCrmClientFollowCount
(
@Param
(
"param"
)
CrmClientFollowCountParam
param
);
/**
* 根据条件查询 统计跟进数据 需要显示的人数
* @param param
* @return
*/
List
<
CrmClientFollowCountDto
>
selectCrmClientFollowList
(
@Param
(
"param"
)
CrmClientFollowCountParam
param
);
/**
* 根据条件查询 统计跟进数据
* @param param
* @return
*/
Integer
selectCountByParam
(
@Param
(
"param"
)
CrmClientFollowCountParam
param
);
}
}
src/main/java/cn/timer/api/dao/crm/CrmClientLogMapper.java
0 → 100644
View file @
68881eaf
package
cn
.
timer
.
api
.
dao
.
crm
;
import
cn.timer.api.bean.crm.CrmClientLog
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* Title: 客户跟进动态日志表
*
* @Description:
* @author wuqingjun
* @date 2023年7月31日
* @version 1.0
*/
public
interface
CrmClientLogMapper
extends
BaseMapper
<
CrmClientLog
>
{
}
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountDto.java
0 → 100644
View file @
68881eaf
package
cn
.
timer
.
api
.
dto
.
crm
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.awt.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
CrmClientFollowCountDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"跟进数"
)
private
List
<
Integer
>
followCount
;
@ApiModelProperty
(
value
=
"创建人"
)
private
Integer
createUser
;
@ApiModelProperty
(
value
=
"创建人姓名"
)
private
String
createUserName
;
@ApiModelProperty
(
value
=
"时间"
)
private
String
createTime
;
}
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountParam.java
0 → 100644
View file @
68881eaf
package
cn
.
timer
.
api
.
dto
.
crm
;
import
cn.timer.api.config.exception.ValidationMsg
;
import
com.alibaba.fastjson.annotation.JSONField
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.validation.constraints.NotNull
;
import
java.io.Serializable
;
import
java.util.Date
;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
CrmClientFollowCountParam
implements
Serializable
{
private
static
final
long
serialVersionUID
=
-
1230023773946170911L
;
/**
* 开始时间
*/
@ApiModelProperty
(
value
=
"开始时间"
)
private
String
startTime
;
/**
* 结束时间
*/
@ApiModelProperty
(
value
=
"结束时间"
)
private
String
endTime
;
/**
* 当前企业id
*/
@ApiModelProperty
(
value
=
"当前企业id"
)
private
Integer
orgCode
;
/**
* 当前用户ID
*/
@ApiModelProperty
(
value
=
"当前用户ID"
)
private
Integer
createUser
;
}
src/main/java/cn/timer/api/dto/crm/CrmClientFollowListDto.java
0 → 100644
View file @
68881eaf
package
cn
.
timer
.
api
.
dto
.
crm
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.AllArgsConstructor
;
import
lombok.Builder
;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.io.Serializable
;
import
java.util.List
;
/**
*
* @author wuqingjun
* @date 2023年7月28日
* @version 1.0
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public
class
CrmClientFollowListDto
implements
Serializable
{
@ApiModelProperty
(
value
=
"时间"
)
private
List
<
String
>
createStr
;
private
List
<
CrmClientFollowCountDto
>
dtos
;
}
src/main/java/cn/timer/api/utils/DateUtil.java
View file @
68881eaf
...
@@ -3,12 +3,10 @@ package cn.timer.api.utils;
...
@@ -3,12 +3,10 @@ package cn.timer.api.utils;
import
java.text.Format
;
import
java.text.Format
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.core.util.StrUtil
;
import
org.springframework.util.StringUtils
;
public
class
DateUtil
{
public
class
DateUtil
{
...
@@ -479,4 +477,40 @@ public class DateUtil {
...
@@ -479,4 +477,40 @@ public class DateUtil {
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
calendar
.
set
(
Calendar
.
DAY_OF_MONTH
,
calendar
.
getActualMinimum
(
Calendar
.
DAY_OF_MONTH
));
return
dft
.
format
(
calendar
.
getTime
());
return
dft
.
format
(
calendar
.
getTime
());
}
}
/**
* 获取当前月的所有天数
* @param yearMonth
* @return
*/
public
static
List
<
String
>
getDayByMonth
(
String
yearMonth
){
List
<
String
>
list
=
new
ArrayList
<>();
if
(
StringUtils
.
isEmpty
(
yearMonth
)){
return
list
;
}
String
[]
year_monnth
=
yearMonth
.
split
(
"-"
);
Calendar
calendar
=
Calendar
.
getInstance
(
Locale
.
CHINA
);
calendar
.
set
(
Integer
.
parseInt
(
year_monnth
[
0
]),
Integer
.
parseInt
(
year_monnth
[
1
])-
1
,
1
);
int
year
=
calendar
.
get
(
Calendar
.
YEAR
);
//年份
int
month
=
calendar
.
get
(
Calendar
.
MONTH
)
+
1
;
//月份
int
day
=
calendar
.
getActualMaximum
(
Calendar
.
DATE
);
for
(
int
i
=
1
;
i
<=
day
;
i
++)
{
String
date
=
null
;
if
(
month
<
10
&&
i
<
10
){
date
=
String
.
valueOf
(
year
)+
"-0"
+
month
+
"-0"
+
i
;
}
if
(
month
<
10
&&
i
>=
10
){
date
=
String
.
valueOf
(
year
)+
"-0"
+
month
+
"-"
+
i
;
}
if
(
month
>=
10
&&
i
<
10
){
date
=
String
.
valueOf
(
year
)+
"-"
+
month
+
"-0"
+
i
;
}
if
(
month
>=
10
&&
i
>=
10
){
date
=
String
.
valueOf
(
year
)+
"-"
+
month
+
"-"
+
i
;
}
list
.
add
(
date
);
}
return
list
;
}
}
}
src/main/resources/mapping/crm/CrmClientDataMapper.xml
View file @
68881eaf
...
@@ -6,11 +6,12 @@
...
@@ -6,11 +6,12 @@
<select
id=
"crmCartogram"
<select
id=
"crmCartogram"
resultType=
"cn.timer.api.dto.crm.CrmCartogramDto"
>
resultType=
"cn.timer.api.dto.crm.CrmCartogramDto"
>
SELECT
SELECT
province_id,
province as provinceName,count(province_id
) num
province_id,
city as provinceName,count(address
) num
FROM
FROM
crm_client_data
crm_client_data
WHERE
WHERE
org_code = #{orgCode}
org_code = #{orgCode}
and client_cellphone != ''
<if
test=
'null != belongUser and belongUser !=""'
>
AND
<if
test=
'null != belongUser and belongUser !=""'
>
AND
belong_user = #{belongUser}
belong_user = #{belongUser}
</if>
</if>
...
@@ -24,7 +25,7 @@
...
@@ -24,7 +25,7 @@
create_time
<![CDATA[<=]]>
#{endCreateTime}
create_time
<![CDATA[<=]]>
#{endCreateTime}
</if>
</if>
GROUP BY
GROUP BY
province_id
city
</select>
</select>
<select
id=
"selectCrmCartogramCount"
resultType=
"cn.timer.api.dto.crm.CrmCartogramCountExportDto"
>
<select
id=
"selectCrmCartogramCount"
resultType=
"cn.timer.api.dto.crm.CrmCartogramCountExportDto"
>
SELECT belong_user_name,
SELECT belong_user_name,
...
@@ -50,4 +51,192 @@
...
@@ -50,4 +51,192 @@
</where>
</where>
GROUP BY ccd.belong_user
GROUP BY ccd.belong_user
</select>
</select>
<select
id=
"getCrmClientData"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId > 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"status != null and status > 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"typei != null and typei > 0"
>
AND ccd.client_type = #{typei}
</if>
<if
test=
"startCreateTime != null and endCreateTime != null"
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.belong_user_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_name LIKE CONCAT('%', #{like}, '%')
OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow ccf
WHERE ccf.cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select
id=
"getCrmClientData1"
resultType=
"CrmClientData"
>
SELECT ccd.*
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC
</select>
<select
id=
"getCrmClientData2"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.org_code = #{orgCode}
AND ccd.belong_user = #{empNum}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"keywordStr != null and keywordStr != ''"
>
AND ccd.belong_group IN (${keywordStr})
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
<select
id=
"getCrmClientData3"
resultType=
"CrmClientData"
>
SELECT *
FROM crm_client_data ccd
WHERE ccd.belong_group = #{gid}
<if
test=
"industry != null and industry > 0"
>
AND ccd.industry = #{industry}
</if>
<if
test=
"groupId != null and groupId >= 0"
>
AND ccd.belong_group = #{groupId}
</if>
<if
test=
"type != null and type >= 0"
>
AND ccd.client_type = #{type}
</if>
<if
test=
"customerowner != null and customerowner != ''"
>
AND ccd.belong_user_name LIKE CONCAT('%', #{customerowner}, '%')
</if>
<if
test=
"status != null and status >= 0"
>
AND ccd.client_status = #{status}
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '1'"
>
AND ccd.client_cellphone LIKE '%1'
</if>
<if
test=
"ifPhone != null and ifPhone != '' and ifPhone == '2'"
>
AND (ccd.client_cellphone IS NULL OR ccd.client_cellphone = '')
</if>
<if
test=
"startCreateTime != null and startCreateTime != '' and endCreateTime != null and endCreateTime != '' "
>
AND ccd.create_time BETWEEN #{startCreateTime} AND #{endCreateTime}
</if>
<if
test=
"startFollowTime != null and endFollowTime != null"
>
AND ccd.last_follow_time BETWEEN #{startFollowTime} AND #{endFollowTime}
</if>
<if
test=
"like != null and like.trim().length() > 0"
>
AND (ccd.client_name LIKE CONCAT('%', #{like}, '%') OR ccd.client_cellphone LIKE CONCAT('%', #{like}, '%'))
</if>
<if
test=
"unfollowedDays != null and unfollowedDays > 0"
>
AND DATEDIFF(NOW(), (SELECT MAX(last_follow_time) FROM crm_client_follow ccf WHERE ccf.cid = ccd.id)) >= #{unfollowedDays}
</if>
<if
test=
"followNumber != null and followNumber > 0"
>
AND (
SELECT COUNT(*)
FROM crm_client_follow
WHERE cid = ccd.id
) >= #{followNumber}
</if>
ORDER BY ccd.create_time DESC;
</select>
</mapper>
</mapper>
\ No newline at end of file
src/main/resources/mapping/crm/CrmClientFollowMapper.xml
0 → 100644
View file @
68881eaf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.crm.CrmClientFollowMapper"
>
<select
id=
"selectCrmClientFollowCount"
resultType=
"cn.timer.api.dto.crm.CrmClientFollowCountDto"
>
SELECT
create_user_name createUserName,
create_user createUser,
DATE(create_time) AS createTime,
COUNT(*) AS followCount
FROM
crm_client_follow
<where>
<if
test=
'null != param.startTime and param.startTime !=""'
>
AND create_time
<![CDATA[>=]]>
#{param.startTime}
</if>
<if
test=
'null != param.endTime and param.endTime !=""'
>
AND create_time
<![CDATA[<=]]>
#{param.endTime}
</if>
<if
test=
'null != param.orgCode and param.orgCode !=""'
>
AND org_code = #{param.orgCode}
</if>
</where>
GROUP BY
createUser, DATE(create_time)
ORDER BY
createUser, DATE(create_time);
</select>
<select
id=
"selectCrmClientFollowList"
resultType=
"cn.timer.api.dto.crm.CrmClientFollowCountDto"
>
SELECT
create_user_name createUserName,
create_user createUser
FROM
crm_client_follow
<where>
<if
test=
'null != param.startTime and param.startTime !=""'
>
AND create_time
<![CDATA[>=]]>
#{param.startTime}
</if>
<if
test=
'null != param.endTime and param.endTime !=""'
>
AND create_time
<![CDATA[<=]]>
#{param.endTime}
</if>
<if
test=
'null != param.orgCode and param.orgCode !=""'
>
AND org_code = #{param.orgCode}
</if>
</where>
GROUP BY
createUser
ORDER BY
createUser
</select>
<select
id=
"selectCountByParam"
resultType=
"int"
>
SELECT
COUNT(*)
FROM
crm_client_follow
<where>
<if
test=
'null != param.startTime and param.startTime !=""'
>
AND DATE(create_time) = #{param.startTime}
</if>
<if
test=
'null != param.createUser and param.createUser !=""'
>
AND create_user = #{param.createUser}
</if>
<if
test=
'null != param.orgCode and param.orgCode !=""'
>
AND org_code = #{param.orgCode}
</if>
</where>
</select>
</mapper>
\ No newline at end of file
src/main/resources/mapping/crm/CrmClientLogMapper.xml
0 → 100644
View file @
68881eaf
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"cn.timer.api.dao.crm.CrmClientLogMapper"
>
</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