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
bc414567
Commit
bc414567
authored
May 12, 2023
by
284718418@qq.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
客户跟进计划,需添加设置下次跟进时间及跟进内容、跟进方式,以及系统到时自动提醒功能
parent
e967b930
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
260 additions
and
7 deletions
+260
-7
src/main/java/cn/timer/api/bean/crm/CrmClientPlan.java
+94
-0
src/main/java/cn/timer/api/config/enums/PinType.java
+1
-0
src/main/java/cn/timer/api/controller/crm/CrmController.java
+45
-7
src/main/java/cn/timer/api/controller/crm/task/CrmClientPlanTask.java
+61
-0
src/main/java/cn/timer/api/dao/crm/CrmClientPlanMapper.java
+17
-0
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
+42
-0
No files found.
src/main/java/cn/timer/api/bean/crm/CrmClientPlan.java
0 → 100644
View file @
bc414567
/**
* Title: CrmClientFollow.java
* Description:
* @author dsc
* @date 2020年6月8日
* @version 1.0
*/
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.Entity
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
javax.persistence.Table
;
import
java.util.Date
;
/**
* Title: CrmClientPlan.java
*
* @Description:
* @author wuqingjun
* @date 2023年5月12日
* @version 1.0
*/
@Entity
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Table
(
name
=
"crm_client_plan"
)
@ApiModel
(
"客户管理-跟进计划"
)
public
class
CrmClientPlan
extends
Model
<
CrmClientPlan
>
{
private
static
final
long
serialVersionUID
=
-
7362549097557018583L
;
@Id
@GeneratedValue
@TableId
(
type
=
IdType
.
AUTO
)
@ApiModelProperty
(
value
=
"编号"
)
private
Integer
id
;
@ApiModelProperty
(
value
=
"客户数据id"
)
private
Integer
cid
;
@ApiModelProperty
(
value
=
"内容"
)
private
String
content
;
@ApiModelProperty
(
value
=
"备注"
)
private
String
remake
;
@ApiModelProperty
(
value
=
"创建人"
)
private
Integer
createUser
;
@ApiModelProperty
(
value
=
"创建人姓名"
)
private
String
createUserName
;
@ApiModelProperty
(
value
=
"创建人手机号码"
)
private
String
createUserPhone
;
@ApiModelProperty
(
value
=
"企业id"
)
private
Integer
orgCode
;
@ApiModelProperty
(
value
=
"执行时间"
)
private
Date
executeTime
;
@ApiModelProperty
(
value
=
"状态:0.未提醒 1.已提醒"
)
private
Integer
status
;
@ApiModelProperty
(
value
=
"是否短信提醒:0否,1是"
)
private
Integer
ifWarnSms
;
@TableField
(
fill
=
FieldFill
.
INSERT
)
@ApiModelProperty
(
value
=
"提醒时间"
)
private
Date
warnTime
;
@ApiModelProperty
(
value
=
"创建时间"
)
private
Date
createTime
;
@ApiModelProperty
(
value
=
"更新时间"
)
private
Date
updateTime
;
}
src/main/java/cn/timer/api/config/enums/PinType.java
View file @
bc414567
...
@@ -20,6 +20,7 @@ public enum PinType {
...
@@ -20,6 +20,7 @@ public enum PinType {
CHANGE_INFORMATION
(
"SMS_178485359"
,
"信息变更"
),
CHANGE_INFORMATION
(
"SMS_178485359"
,
"信息变更"
),
// REMIND("SMS_180347486", "短信提醒");
// REMIND("SMS_180347486", "短信提醒");
CRM_CLIENT_PLAN
(
"SMS_460755268"
,
"客户跟进计划提醒"
),
REMIND
(
"SMS_193517459"
,
"短信提醒"
);
REMIND
(
"SMS_193517459"
,
"短信提醒"
);
...
...
src/main/java/cn/timer/api/controller/crm/CrmController.java
View file @
bc414567
...
@@ -10,6 +10,7 @@ import java.time.LocalDate;
...
@@ -10,6 +10,7 @@ import java.time.LocalDate;
import
java.util.*
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
java.util.stream.Collectors
;
import
cn.timer.api.bean.crm.*
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.controller.zpgl.sevice.ZpglService
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
cn.timer.api.dto.crm.CrmCartogramCountExportDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
import
cn.timer.api.dto.insure.PolicyDto
;
...
@@ -44,13 +45,6 @@ import cn.timer.api.bean.clazz.ClientSourceClass;
...
@@ -44,13 +45,6 @@ import cn.timer.api.bean.clazz.ClientSourceClass;
import
cn.timer.api.bean.clazz.ClientTypeClass
;
import
cn.timer.api.bean.clazz.ClientTypeClass
;
import
cn.timer.api.bean.clazz.IndustryClass
;
import
cn.timer.api.bean.clazz.IndustryClass
;
import
cn.timer.api.bean.clazz.SysRegion
;
import
cn.timer.api.bean.clazz.SysRegion
;
import
cn.timer.api.bean.crm.CrmBusinessGroup
;
import
cn.timer.api.bean.crm.CrmBusinessGroupMember
;
import
cn.timer.api.bean.crm.CrmClientAssociate
;
import
cn.timer.api.bean.crm.CrmClientContacts
;
import
cn.timer.api.bean.crm.CrmClientData
;
import
cn.timer.api.bean.crm.CrmClientFollow
;
import
cn.timer.api.bean.crm.CrmSeaRule
;
import
cn.timer.api.bean.qyzx.QyzxEmpEntAsso
;
import
cn.timer.api.bean.qyzx.QyzxEmpEntAsso
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.bean.yggl.YgglMainEmp
;
import
cn.timer.api.config.annotation.CurrentUser
;
import
cn.timer.api.config.annotation.CurrentUser
;
...
@@ -956,6 +950,8 @@ public class CrmController {
...
@@ -956,6 +950,8 @@ public class CrmController {
return
ResultUtil
.
error
(
"请确认该客户数据是否存在"
);
return
ResultUtil
.
error
(
"请确认该客户数据是否存在"
);
if
(
oldData
.
getClientStatus
()
==
5
)
if
(
oldData
.
getClientStatus
()
==
5
)
return
ResultUtil
.
error
(
"请解封后继续编辑操作"
);
return
ResultUtil
.
error
(
"请解封后继续编辑操作"
);
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
crmClientFollow
.
getContent
()))
return
ResultUtil
.
error
(
"请填写跟进内容!"
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
...
@@ -1701,6 +1697,48 @@ public class CrmController {
...
@@ -1701,6 +1697,48 @@ public class CrmController {
return
ResultUtil
.
data
(
userList
,
"成功"
);
return
ResultUtil
.
data
(
userList
,
"成功"
);
}
}
@PostMapping
(
"addClientPlan"
)
@Transactional
@ApiOperation
(
value
=
"新增客户跟进计划"
,
httpMethod
=
"POST"
,
notes
=
"接口发布说明"
)
public
Result
<
Void
>
addClientPlan
(
@CurrentUser
UserBean
userBean
,
@RequestBody
CrmClientPlan
crmClientPlan
)
{
Integer
cid
=
crmClientPlan
.
getCid
();
if
(
cid
==
null
){
return
ResultUtil
.
error
(
"请传入id再试"
);
}
CrmClientData
oldData
=
CrmClientData
.
builder
().
id
(
cid
).
build
().
selectById
();
if
(
oldData
==
null
){
return
ResultUtil
.
error
(
"请确认该客户数据是否存在"
);
}
if
(
oldData
.
getClientStatus
()
==
5
){
return
ResultUtil
.
error
(
"请解封后继续编辑操作"
);
}
if
(
org
.
springframework
.
util
.
StringUtils
.
isEmpty
(
crmClientPlan
.
getContent
())){
return
ResultUtil
.
error
(
"请填写内容!"
);
}
Integer
orgCode
=
getOrgCode
(
userBean
);
Integer
empNum
=
getEmpNum
(
userBean
);
crmClientPlan
.
setOrgCode
(
orgCode
);
crmClientPlan
.
setCreateUser
(
empNum
);
crmClientPlan
.
setCreateUserName
(
getEmpName
(
orgCode
,
empNum
));
crmClientPlan
.
setCreateUserPhone
(
userBean
.
getQyzxEmpLogin
().
getPhone
());
if
(
crmClientPlan
.
insert
()){
return
ResultUtil
.
success
(
"新增成功"
);
}
return
ResultUtil
.
error
(
"新增失败"
);
}
@GetMapping
(
"getCilentPlan"
)
@ApiOperation
(
value
=
"获取客户跟进计划"
,
httpMethod
=
"GET"
,
notes
=
"接口发布说明"
)
public
Result
<
List
<
CrmClientPlan
>>
getCilentPlan
(
@CurrentUser
UserBean
userBean
,
@RequestParam
Integer
cid
)
{
Integer
orgCode
=
getOrgCode
(
userBean
);
return
ResultUtil
.
data
(
CrmClientPlan
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientPlan
>().
lambda
()
.
eq
(
CrmClientPlan:
:
getOrgCode
,
orgCode
).
eq
(
CrmClientPlan:
:
getCid
,
cid
).
orderByDesc
(
CrmClientPlan:
:
getId
)),
"获取成功"
);
}
private
ExcelReader
getReaderByUrl
(
String
url
)
{
private
ExcelReader
getReaderByUrl
(
String
url
)
{
InputStream
is
=
null
;
InputStream
is
=
null
;
try
{
try
{
...
...
src/main/java/cn/timer/api/controller/crm/task/CrmClientPlanTask.java
0 → 100644
View file @
bc414567
package
cn
.
timer
.
api
.
controller
.
crm
.
task
;
import
cn.hutool.core.date.DateUtil
;
import
cn.timer.api.bean.crm.CrmClientPlan
;
import
cn.timer.api.bean.insure.InsureLog
;
import
cn.timer.api.bean.insure.InsurePolicy
;
import
cn.timer.api.bean.insure.InsureUser
;
import
cn.timer.api.config.exception.CustomException
;
import
cn.timer.api.dao.insure.InsureUserMapper
;
import
cn.timer.api.dao.yggl.YgglMainEmpMapper
;
import
cn.timer.api.utils.aliyun.AliyunSMS
;
import
com.baomidou.mybatisplus.core.conditions.query.QueryWrapper
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.Scheduled
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.CollectionUtils
;
import
org.springframework.util.StringUtils
;
import
java.util.Date
;
import
java.util.List
;
/**
* @Description TODO
* @Author wuqingjun
* @Date 2023/5/12
*/
@Configuration
//1.主要用于标记配置类,兼备Component的效果。
@EnableScheduling
// 2.开启定时任务
@Slf4j
public
class
CrmClientPlanTask
{
@Autowired
private
AliyunSMS
aliyunSMS
;
@Scheduled
(
cron
=
"0 0/30 * * * ? "
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateInsureStatusTask
(){
try
{
Date
now
=
DateUtil
.
date
();
List
<
CrmClientPlan
>
crmClientPlanList
=
CrmClientPlan
.
builder
().
build
().
selectList
(
new
QueryWrapper
<
CrmClientPlan
>().
lambda
().
eq
(
CrmClientPlan:
:
getIfWarnSms
,
1
).
eq
(
CrmClientPlan:
:
getStatus
,
0
).
lt
(
CrmClientPlan:
:
getWarnTime
,
now
));
if
(!
CollectionUtils
.
isEmpty
(
crmClientPlanList
))
{
for
(
CrmClientPlan
plan:
crmClientPlanList
)
{
String
result
=
aliyunSMS
.
sendCrmClientPlanSms
(
plan
.
getCreateUserName
(),
plan
.
getCreateUserPhone
());
if
(!
StringUtils
.
isEmpty
(
result
)){
CrmClientPlan
p
=
new
CrmClientPlan
();
p
.
setId
(
plan
.
getId
());
p
.
setStatus
(
1
);
p
.
updateById
();
log
.
info
(
"客户跟进计划定时任务执行-{}-{}"
,
plan
.
getCreateUserName
(),
plan
.
getCreateUserPhone
());
}
}
}
}
catch
(
Exception
e
){
e
.
printStackTrace
();
throw
new
CustomException
(
"客户跟进计划定时任务异常"
);
}
}
}
src/main/java/cn/timer/api/dao/crm/CrmClientPlanMapper.java
0 → 100644
View file @
bc414567
package
cn
.
timer
.
api
.
dao
.
crm
;
import
cn.timer.api.bean.crm.CrmClientPlan
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
/**
* Title: CrmClientPlanMapper.java
*
* @Description:
* @author wuqingjun
* @date 2023年5月12日
* @version 1.0
*/
public
interface
CrmClientPlanMapper
extends
BaseMapper
<
CrmClientPlan
>
{
}
src/main/java/cn/timer/api/utils/aliyun/AliyunSMS.java
View file @
bc414567
...
@@ -295,6 +295,48 @@ public class AliyunSMS {
...
@@ -295,6 +295,48 @@ public class AliyunSMS {
return
"发送失败"
;
return
"发送失败"
;
}
}
/**
* 客户跟进计划提醒
*
* @param name 用户名字
* @return
*/
@SuppressWarnings
(
"deprecation"
)
public
String
sendCrmClientPlanSms
(
String
name
,
String
phone
)
{
DefaultProfile
profile
=
DefaultProfile
.
getProfile
(
REGION_ID
,
ACCESSKEY_ID
,
SECRET
);
IAcsClient
client
=
new
DefaultAcsClient
(
profile
);
CommonRequest
request
=
new
CommonRequest
();
request
.
setMethod
(
MethodType
.
POST
);
request
.
setDomain
(
DOMAIN
);
request
.
setVersion
(
VERSION
);
request
.
setAction
(
ACTION_SEND
);
request
.
putQueryParameter
(
"RegionId"
,
REGION_ID
);
request
.
putQueryParameter
(
"PhoneNumbers"
,
phone
);
request
.
putQueryParameter
(
"SignName"
,
PROJECT_NAME
);
request
.
putQueryParameter
(
CODE_NAME
,
PinType
.
CRM_CLIENT_PLAN
.
getCode
());
request
.
putQueryParameter
(
TEMPLATE_PARAM
,
"{\"name\":\""
+
name
+
"\"}"
);
String
a
=
null
;
try
{
CommonResponse
response
=
client
.
getCommonResponse
(
request
);
a
=
response
.
getData
();
}
catch
(
ServerException
e
)
{
e
.
printStackTrace
();
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
}
if
(
a
!=
null
&&
a
.
contains
(
"OK"
))
{
return
a
;
}
return
"发送失败"
;
}
@Value
(
"${config-8timer.environmental-science}"
)
@Value
(
"${config-8timer.environmental-science}"
)
public
String
environmental_science
;
public
String
environmental_science
;
...
...
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