Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
D
dingding
Project
Project
详情
活动
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
Graph
比较
统计图
议题
0
议题
0
列表
看板
标记
Milestones
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程
统计图
注册表
注册表
Wiki
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
svn
dingding
Commits
72e0e579
提交
72e0e579
authored
4月 02, 2020
作者:
liupengfei
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
--no commit message
上级
ad5e1266
隐藏空白字符变更
内嵌
并排
正在显示
8 个修改的文件
包含
117 行增加
和
12 行删除
+117
-12
URLConstant.java
src/main/java/com/config/URLConstant.java
+5
-0
CustomerController.java
...main/java/com/controller/customer/CustomerController.java
+22
-2
UserController.java
src/main/java/com/controller/dingding/UserController.java
+36
-0
CustomerHasBusinessEnum.java
...main/java/com/enums/customer/CustomerHasBusinessEnum.java
+10
-9
CustomerServiceImpl.java
src/main/java/com/service/customer/CustomerServiceImpl.java
+1
-1
AdminUserListVo.java
src/main/java/com/vo/dingding/AdminUserListVo.java
+20
-0
AdminUserVo.java
src/main/java/com/vo/dingding/AdminUserVo.java
+20
-0
application.yml
src/main/resources/application.yml
+3
-0
没有找到文件。
src/main/java/com/config/URLConstant.java
浏览文件 @
72e0e579
...
...
@@ -20,4 +20,9 @@ public class URLConstant {
* 获取部门用户
*/
public
static
final
String
URL_USER_SIMPLELIST
=
"https://oapi.dingtalk.com/user/simplelist"
;
/**
* 获取管理员列表
*/
public
static
final
String
URL_ADMIN_LIST
=
"https://oapi.dingtalk.com/user/get_admin"
;
}
src/main/java/com/controller/customer/CustomerController.java
浏览文件 @
72e0e579
...
...
@@ -2,6 +2,7 @@ package com.controller.customer;
import
java.util.Date
;
import
com.util.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
...
...
@@ -31,11 +32,29 @@ public class CustomerController {
@ApiOperation
(
value
=
"保存客户信息"
,
notes
=
"保存客户信息"
)
@PostMapping
(
"/save"
)
public
CallBack
<?>
save
(
Customer
entity
){
entity
.
set
Cre
ateTime
(
new
Date
());
entity
.
set
Upd
ateTime
(
new
Date
());
if
(
entity
.
getId
()
!=
null
)
{
Customer
old
=
service
.
notNull
(
entity
.
getId
());
entity
.
setCreater
(
old
.
getCreater
());
entity
.
setCreateName
(
old
.
getCreateName
());
// 修改指派时间标记,修改的用户和旧用户不一致的情况,则更新指派时间
boolean
upFlag
=
StringUtils
.
isNotEmpty
(
entity
.
getUserId
())
&&
!
entity
.
getUserId
().
equals
(
old
.
getUserId
());
boolean
upFlag1
=
StringUtils
.
isNotEmpty
(
old
.
getUserId
())
&&
!
old
.
getUserId
().
equals
(
entity
.
getUserId
());
if
(
upFlag
||
upFlag1
)
{
entity
.
setAllotTime
(
new
Date
());
}
else
{
entity
.
setAllotTime
(
old
.
getAllotTime
());
}
service
.
updateByPrimaryKey
(
entity
);
return
CallBack
.
success
();
}
}
if
(
StringUtils
.
isNotEmpty
(
entity
.
getUserId
()))
{
// 添加客户时,指派了负责人,填充指派时间
entity
.
setAllotTime
(
new
Date
());
}
entity
.
setCreateTime
(
new
Date
());
service
.
insert
(
entity
);
return
CallBack
.
success
(
entity
.
getId
());
}
...
...
@@ -46,6 +65,7 @@ public class CustomerController {
return
CallBack
.
success
(
service
.
page
(
pageParam
,
form
));
}
@ApiOperation
(
value
=
"根据客户id查询客户信息"
)
@GetMapping
(
"/get"
)
public
CallBack
<
Customer
>
get
(
Integer
id
)
{
...
...
src/main/java/com/controller/dingding/UserController.java
浏览文件 @
72e0e579
...
...
@@ -2,6 +2,10 @@ package com.controller.dingding;
import
java.util.List
;
import
com.dingtalk.api.request.OapiUserGetAdminRequest
;
import
com.dingtalk.api.response.OapiUserGetAdminResponse
;
import
com.vo.dingding.AdminUserListVo
;
import
com.vo.dingding.AdminUserVo
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -71,4 +75,36 @@ public class UserController {
}
return
ServiceResult
.
failure
(
"-3"
,
response
.
getBody
());
}
/**
* Description: 获取管理员列表
* @param
* @return com.util.ServiceResult<java.util.List<?>>
* @author lpf
* @date 2020-04-02 15:50
*/
@GetMapping
(
"/admin-list"
)
public
ServiceResult
<
List
<
AdminUserVo
>>
adminList
(){
// 获取调用接口凭证
String
accessToken
=
AccessTokenUtil
.
getToken
();
DingTalkClient
client
=
new
DefaultDingTalkClient
(
URLConstant
.
URL_ADMIN_LIST
);
OapiUserGetAdminRequest
request
=
new
OapiUserGetAdminRequest
();
request
.
setHttpMethod
(
"GET"
);
OapiUserGetAdminResponse
response
;
try
{
response
=
client
.
execute
(
request
,
accessToken
);
}
catch
(
ApiException
e
)
{
e
.
printStackTrace
();
log
.
error
(
"获取管理员列表调用接口失败:"
+
e
.
toString
());
return
ServiceResult
.
failure
(
"-2"
,
"获取管理员列表调用接口失败:"
+
e
.
toString
());
}
if
(
response
.
isSuccess
())
{
AdminUserListVo
vo
=
JSON
.
parseObject
(
response
.
getBody
(),
AdminUserListVo
.
class
);
/*AdminUserVo lpf = new AdminUserVo();
lpf.setUserid("526150051021491847");
vo.getAdmin_list().add(lpf);*/
return
ServiceResult
.
success
(
vo
.
getAdmin_list
());
}
return
ServiceResult
.
failure
(
"-3"
,
response
.
getBody
());
}
}
src/main/java/com/enums/customer/CustomerHasBusinessEnum.java
浏览文件 @
72e0e579
...
...
@@ -5,12 +5,13 @@ import java.util.Map;
import
java.util.stream.Stream
;
public
enum
CustomerHasBusinessEnum
{
/** 未知 */
NONE
(
"-1"
,
"未知"
),
/** 是 */
YES
(
"1"
,
"有"
),
/** 否 */
NO
(
"0"
,
"无"
);
NO
(
"0"
,
"无"
),
RELATION
(
"1"
,
"关注,建立关系"
),
FIND
(
"2"
,
"发现,发现商机线索"
),
NEED
(
"3"
,
"和客户共同确定需求"
),
DOC
(
"4"
,
"和客户共同确定方案"
),
YES
(
"5"
,
"赢得商机"
),
PUT
(
"6"
,
"实施"
);
private
final
String
code
;
private
final
String
name
;
...
...
@@ -41,7 +42,7 @@ public enum CustomerHasBusinessEnum {
}
/**
* 判断名称是否有效
* @param
nam
e
* @param
cod
e
* @return
* @author lpf
* @date: 2018年6月11日 下午6:30:16
...
...
@@ -59,7 +60,7 @@ public enum CustomerHasBusinessEnum {
* @date 2019年3月18日17:14:18
*/
public
static
String
getName
(
String
code
)
{
return
stream
().
filter
(
e
->
e
.
code
.
equals
(
code
)).
findFirst
().
map
(
e
->
e
.
name
).
orElse
(
NO
NE
.
name
);
return
stream
().
filter
(
e
->
e
.
code
.
equals
(
code
)).
findFirst
().
map
(
e
->
e
.
name
).
orElse
(
NO
.
name
);
}
/**
...
...
@@ -71,7 +72,7 @@ public enum CustomerHasBusinessEnum {
* @date 2019年3月18日17:14:18
*/
public
static
String
getCode
(
String
name
)
{
return
stream
().
filter
(
e
->
e
.
name
.
equals
(
name
)).
findFirst
().
map
(
e
->
e
.
code
).
orElse
(
NO
NE
.
code
);
return
stream
().
filter
(
e
->
e
.
name
.
equals
(
name
)).
findFirst
().
map
(
e
->
e
.
code
).
orElse
(
NO
.
code
);
}
public
String
getCode
()
{
...
...
src/main/java/com/service/customer/CustomerServiceImpl.java
浏览文件 @
72e0e579
...
...
@@ -31,7 +31,7 @@ public class CustomerServiceImpl extends BaseServiceImpl<Customer, Integer> impl
@Override
public
PageInfo
<
CustomerVo
>
page
(
PageParam
pageParam
,
QueryCustomerForm
form
)
{
if
(
StringUtils
.
isBlank
(
pageParam
.
getOrderBy
()))
{
pageParam
.
setOrderBy
(
"
cre
ateTime desc "
);
pageParam
.
setOrderBy
(
"
upd
ateTime desc "
);
}
startPage
(
pageParam
);
List
<
Customer
>
list
=
mapper
.
list
(
form
);
...
...
src/main/java/com/vo/dingding/AdminUserListVo.java
0 → 100644
浏览文件 @
72e0e579
package
com
.
vo
.
dingding
;
import
com.util.DingTalkResult
;
import
lombok.Data
;
import
java.util.List
;
/**
* Title: AdminUserListVo
* Description: 管理员集合
*
* @author lpf
* @version V1.0
* @date 2020-04-02
*/
@Data
public
class
AdminUserListVo
extends
DingTalkResult
{
private
List
<
AdminUserVo
>
admin_list
;
}
src/main/java/com/vo/dingding/AdminUserVo.java
0 → 100644
浏览文件 @
72e0e579
package
com
.
vo
.
dingding
;
import
lombok.Data
;
/**
* Title: AdminUserVVo
* Description: 管理员用户vo
*
* @author lpf
* @version V1.0
* @date 2020-04-02
*/
@Data
public
class
AdminUserVo
{
// 管理员角色 1:主管理员,2:子管理员
private
String
sys_level
;
// 员工id
private
String
userid
;
}
src/main/resources/application.yml
浏览文件 @
72e0e579
...
...
@@ -43,6 +43,8 @@ spring:
datasource
:
driver-class-name
:
com.mysql.jdbc.Driver
url
:
'
jdbc:mysql://192.168.2.220:3306/crm?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull'
# url: 'jdbc:mysql://localhost:3306/crm?useUnicode=true&characterEncoding=UTF-8&zeroDateTimeBehavior=convertToNull'
username
:
root
password
:
"
'>Nw0zPFwzv0'"
# password: root
initialize
:
true
\ No newline at end of file
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论