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
ab8133df
Commit
ab8133df
authored
Jul 31, 2023
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
跟进动态统计
parent
2a3f92a3
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
314 additions
and
15 deletions
+314
-15
src/main/java/cn/timer/api/bean/crm/CrmClientLog.java
+69
-0
src/main/java/cn/timer/api/controller/crm/CrmController.java
+127
-12
src/main/java/cn/timer/api/dao/crm/CrmClientFollowMapper.java
+13
-0
src/main/java/cn/timer/api/dao/crm/CrmClientLogMapper.java
+18
-0
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountDto.java
+3
-1
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountParam.java
+5
-0
src/main/java/cn/timer/api/dto/crm/CrmClientFollowListDto.java
+29
-0
src/main/resources/mapping/crm/CrmClientFollowMapper.xml
+42
-2
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 @
ab8133df
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 @
ab8133df
...
...
@@ -4,6 +4,7 @@ import java.io.FileNotFoundException;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.math.BigDecimal
;
import
java.net.URL
;
import
java.net.URLEncoder
;
import
java.text.SimpleDateFormat
;
...
...
@@ -15,8 +16,7 @@ import cn.timer.api.bean.crm.*;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureProductPlan
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.dao.crm.CrmClientFollowMapper
;
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.crm.*
;
import
cn.timer.api.dto.insure.PolicyDto
;
...
...
@@ -24,6 +24,7 @@ import cn.timer.api.dto.yggl.YgCityDto;
import
cn.timer.api.utils.ExcelUtils
;
import
org.apache.poi.xssf.usermodel.XSSFWorkbook
;
import
org.checkerframework.checker.units.qual.A
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
...
...
@@ -59,8 +60,6 @@ import cn.timer.api.config.annotation.CurrentUser;
import
cn.timer.api.config.annotation.UserBean
;
import
cn.timer.api.config.enums.SysRoleType
;
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.dto.kqmk.DailyDetailsDto
;
import
cn.timer.api.dto.xcgl.ImportDescriptionDto
;
...
...
@@ -103,6 +102,8 @@ public class CrmController {
private
CrmRemindRuleMapper
crmRemindRuleMapper
;
@Autowired
private
CrmClientFollowMapper
crmClientFollowMapper
;
@Autowired
private
CrmClientLogMapper
crmClientLogMapper
;
private
Integer
getEmpNum
(
UserBean
userBean
)
{
return
userBean
.
getEmpNum
();
...
...
@@ -449,6 +450,14 @@ public class CrmController {
}
crmClientData
.
setContactsNum
(
contactsnum
);
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
(
"新增成功"
);
}
...
...
@@ -1023,6 +1032,14 @@ public class CrmController {
crmRemindRule
.
setCreateTime
(
new
Date
());
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
.
error
(
"新增失败"
);
...
...
@@ -1070,10 +1087,26 @@ public class CrmController {
if
(
status
!=
null
&&
status
!=
5
)
{
crmClientData
.
setClientStatus
(
5
);
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
(
"封档成功"
);
}
else
if
(
status
==
5
)
{
crmClientData
.
setClientStatus
(
1
);
// 解封后默认潜在状态
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
(
"解封成功"
);
}
else
return
ResultUtil
.
error
(
"失败"
);
...
...
@@ -1105,6 +1138,14 @@ public class CrmController {
if
(
CrmClientData
.
builder
().
id
(
cid
).
belongUser
(
belongUser
)
.
belongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belongUser
)).
build
().
updateById
())
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
(
"指派失败"
);
}
...
...
@@ -1131,8 +1172,17 @@ public class CrmController {
// 删除协作人列表
CrmClientAssociate
.
builder
().
build
()
.
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
.
error
(
"释放失败"
);
}
...
...
@@ -1152,8 +1202,17 @@ public class CrmController {
return
ResultUtil
.
error
(
"不是当前业务组成员"
);
oldData
.
setBelongUser
(
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
.
error
(
"接收失败"
);
}
...
...
@@ -1199,6 +1258,14 @@ public class CrmController {
crmClientData
.
setBelongUser
(
belonger
);
crmClientData
.
setBelongUserName
(
getEmpName
(
getOrgCode
(
userBean
),
belonger
));
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
(
"转移成功"
);
...
...
@@ -1235,6 +1302,14 @@ public class CrmController {
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
();
}
...
...
@@ -1291,7 +1366,7 @@ public class CrmController {
listAll
.
add
(
cartogram6
);
// 跟进图
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
()));
...
...
@@ -1306,14 +1381,54 @@ public class CrmController {
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
endCreateTime
)){
param
.
setEndTime
(
list
.
get
(
list
.
size
()-
1
)+
" 23:59:59"
);
}
param
.
setOrgCode
(
orgCode
);
//
List
<
CrmClientFollowCountDto
>
crm
=
crmClientFollowMapper
.
selectCrmClientFollowCount
(
param
);
for
(
String
day:
list
)
{
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
);
}
listAll
.
add
(
null
);
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
,
"获取成功"
);
}
...
...
src/main/java/cn/timer/api/dao/crm/CrmClientFollowMapper.java
View file @
ab8133df
...
...
@@ -33,6 +33,19 @@ public interface CrmClientFollowMapper extends BaseMapper<CrmClientFollow> {
* @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 @
ab8133df
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
View file @
ab8133df
...
...
@@ -8,8 +8,10 @@ import lombok.Builder;
import
lombok.Data
;
import
lombok.NoArgsConstructor
;
import
java.awt.*
;
import
java.io.Serializable
;
import
java.util.Date
;
import
java.util.List
;
/**
*
...
...
@@ -25,7 +27,7 @@ public class CrmClientFollowCountDto implements Serializable {
@ApiModelProperty
(
value
=
"跟进数"
)
private
Integer
followCount
;
private
List
<
Integer
>
followCount
;
@ApiModelProperty
(
value
=
"创建人"
)
private
Integer
createUser
;
...
...
src/main/java/cn/timer/api/dto/crm/CrmClientFollowCountParam.java
View file @
ab8133df
...
...
@@ -44,4 +44,9 @@ public class CrmClientFollowCountParam implements Serializable {
*/
@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 @
ab8133df
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/resources/mapping/crm/CrmClientFollowMapper.xml
View file @
ab8133df
...
...
@@ -23,8 +23,47 @@
</if>
</where>
GROUP BY
create
_user_name
, DATE(create_time)
create
User
, DATE(create_time)
ORDER BY
create_user_name, DATE(create_time);
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 @
ab8133df
<?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