Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
haoban-manage3.0
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
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
haoban3.0
haoban-manage3.0
Commits
f3a81e54
Commit
f3a81e54
authored
Apr 17, 2020
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
064dd05d
d0790889
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
142 additions
and
16 deletions
+142
-16
StaffDepartmentRelatedApiService.java
.../manage/api/service/StaffDepartmentRelatedApiService.java
+2
-1
AuditApiServiceImpl.java
.../manage/service/service/out/impl/AuditApiServiceImpl.java
+27
-2
StaffDepartmentRelatedApiServiceImpl.java
...ervice/out/impl/StaffDepartmentRelatedApiServiceImpl.java
+51
-13
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+52
-0
StaffVO.java
...b/src/main/java/com/gic/haoban/manage/web/vo/StaffVO.java
+10
-0
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffDepartmentRelatedApiService.java
View file @
f3a81e54
package
com
.
gic
.
haoban
.
manage
.
api
.
service
;
import
java.util.List
;
import
java.util.Map
;
import
com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO
;
...
...
@@ -27,7 +28,7 @@ public interface StaffDepartmentRelatedApiService {
StaffDepartmentRelatedDTO
getOneByStaffIdAndDepartmentId
(
String
staffId
,
String
departmentId
);
String
getWxUserIdByClerkId
(
String
clerkId
);
Map
<
String
,
String
>
getWxUserIdByClerkId
(
String
clerkId
);
String
getPageUrl
(
int
type
,
String
data
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/AuditApiServiceImpl.java
View file @
f3a81e54
...
...
@@ -5,6 +5,7 @@ import java.text.SimpleDateFormat;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
...
...
@@ -38,10 +39,13 @@ import com.gic.haoban.manage.service.config.Config;
import
com.gic.haoban.manage.service.dao.mapper.DepartmentMapper
;
import
com.gic.haoban.manage.service.dao.mapper.StaffMapper
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanAuditMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanAudit
;
import
com.gic.haoban.manage.service.entity.TabHaobanDepartment
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaff
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.message.api.dto.MessageDTO
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
import
com.github.pagehelper.PageHelper
;
...
...
@@ -66,6 +70,9 @@ public class AuditApiServiceImpl implements AuditApiService{
@Autowired
private
Config
config
;
@Autowired
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Autowired
private
StaffDepartmentRelatedApiService
staffDepartmentRelatedApiService
;
@Override
...
...
@@ -282,21 +289,39 @@ public class AuditApiServiceImpl implements AuditApiService{
logger
.
info
(
"staff不存在"
);
return
;
}
if
(
content
.
length
()>
30
){
content
.
substring
(
0
,
26
);
content
=
content
+
"..."
;
}
String
wxUserId
=
staff
.
getWxUserId
();
String
staffName
=
staff
.
getStaffName
();
String
wxEnterpriseId
=
staff
.
getWxEnterpriseId
();
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
wxEnterpriseId
);
String
corpId
=
tabHaobanWxEnterprise
.
getCorpid
();
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"storeId"
,
storeId
);
String
data
=
jsonObject
.
toJSONString
();
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
STORE_DETAIL
.
getCode
(),
data
);
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
List
<
ItemDTO
>
items
=
new
ArrayList
();;
ItemDTO
dto1
=
new
ItemDTO
();
ItemDTO
dto2
=
new
ItemDTO
();
dto1
.
setKey
(
"接收人"
);
dto1
.
setValue
(
staffName
);
dto2
.
setKey
(
"接收事件"
);
dto2
.
setValue
(
content
);
items
.
add
(
dto1
);
items
.
add
(
dto2
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
wxUserId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
title
);
messageDTO
.
set
Description
(
content
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
co
nfig
.
getCorpid
(),
config
.
getSuiteI
d
(),
messageDTO
);
messageDTO
.
set
Items
(
items
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
co
rpId
,
config
.
getWxSuitei
d
(),
messageDTO
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffDepartmentRelatedApiServiceImpl.java
View file @
f3a81e54
...
...
@@ -2,7 +2,9 @@ package com.gic.haoban.manage.service.service.out.impl;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Objects
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -14,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.csp.sentinel.util.StringUtil
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.EntityUtil
;
...
...
@@ -25,10 +28,13 @@ import com.gic.haoban.manage.api.service.ApplicationApiService;
import
com.gic.haoban.manage.api.service.StaffDepartmentRelatedApiService
;
import
com.gic.haoban.manage.service.config.Config
;
import
com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper
;
import
com.gic.haoban.manage.service.dao.mapper.WxEnterpriseMapper
;
import
com.gic.haoban.manage.service.entity.TabHaobanApplication
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanWxEnterprise
;
import
com.gic.haoban.manage.service.service.ApplicationService
;
import
com.gic.haoban.manage.service.service.StaffDepartmentRelatedService
;
import
com.gic.wechat.api.dto.qywx.ItemDTO
;
import
com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO
;
import
com.gic.wechat.api.service.qywx.QywxSuiteApiService
;
...
...
@@ -47,6 +53,9 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Autowired
private
QywxSuiteApiService
qywxSuiteApiService
;
@Autowired
private
WxEnterpriseMapper
wxEnterpriseMapper
;
@Autowired
private
Config
config
;
@Override
...
...
@@ -108,40 +117,68 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
@Override
public
String
getWxUserIdByClerkId
(
String
clerkId
)
{
public
Map
<
String
,
String
>
getWxUserIdByClerkId
(
String
clerkId
)
{
Map
<
String
,
String
>
map
=
new
HashMap
<>();
ClerkDTO
clerkDTO
=
clerkService
.
getclerkById
(
clerkId
);
if
(
clerkDTO
==
null
){
return
null
;
return
map
;
}
String
clerkCode
=
clerkDTO
.
getClerkCode
();
if
(
StringUtil
.
isEmpty
(
clerkCode
)
){
return
null
;
return
map
;
}
List
<
TabHaobanStaffDepartmentRelated
>
list
=
staffDepartmentRelatedMapper
.
listByClerkCode
(
clerkCode
);
if
(
CollectionUtil
.
isEmpty
(
list
)){
return
null
;
return
map
;
}
String
wxUserId
=
list
.
get
(
0
).
getWxUserId
();
return
wxUserId
;
String
wxEnterpriseId
=
list
.
get
(
0
).
getWxEnterpriseId
();
TabHaobanWxEnterprise
tabHaobanWxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
wxEnterpriseId
);
map
.
put
(
"wxUserId"
,
wxUserId
);
map
.
put
(
"wxEnterpriseId"
,
wxEnterpriseId
);
map
.
put
(
"corpId"
,
tabHaobanWxEnterprise
.
getCorpid
());
map
.
put
(
"clerkName"
,
clerkDTO
.
getClerkName
());
return
map
;
}
@Override
public
boolean
sendSingleMessage
(
String
clerkId
,
String
title
,
String
content
,
String
pageUrl
)
{
String
wxUserId
=
getWxUserIdByClerkId
(
clerkId
);
if
(
StringUtils
.
isEmpty
(
wxUserId
)){
Map
<
String
,
String
>
map
=
getWxUserIdByClerkId
(
clerkId
);
String
wxUserId
=
map
.
get
(
"wxUserId"
);
String
corpId
=
map
.
get
(
"corpId"
);
String
name
=
map
.
get
(
"clerkName"
);
if
(
jodd
.
util
.
StringUtil
.
isEmpty
(
wxUserId
)){
logger
.
info
(
"wxUserId不存在============clerkId={}"
,
clerkId
);
return
false
;
}
if
(
content
.
length
()>
30
){
content
.
substring
(
0
,
26
);
content
=
content
+
"..."
;
}
//先发送下,试试
QywxXcxSendMessageDTO
messageDTO
=
new
QywxXcxSendMessageDTO
();
List
<
ItemDTO
>
items
=
new
ArrayList
();;
ItemDTO
dto1
=
new
ItemDTO
();
ItemDTO
dto2
=
new
ItemDTO
();
dto1
.
setKey
(
"接收人"
);
dto1
.
setValue
(
name
);
dto2
.
setKey
(
"接收事件"
);
dto2
.
setValue
(
content
);
items
.
add
(
dto1
);
items
.
add
(
dto2
);
ArrayList
<
String
>
list
=
new
ArrayList
<>();
list
.
add
(
wxUserId
);
messageDTO
.
setAppid
(
config
.
getAppid
());
messageDTO
.
setUserIds
(
list
);
messageDTO
.
setPage
(
pageUrl
);
messageDTO
.
setTitle
(
title
);
messageDTO
.
setDescription
(
content
);
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
config
.
getCorpid
(),
config
.
getSuiteId
(),
messageDTO
);
messageDTO
.
setItems
(
items
);
logger
.
info
(
"发送参数为corpId============:{},suitId============:{},messageDTO============:{},"
,
corpId
,
config
.
getWxSuiteid
(),
JSONObject
.
toJSONString
(
messageDTO
));
boolean
b
=
qywxSuiteApiService
.
sendMessage
(
corpId
,
config
.
getWxSuiteid
(),
messageDTO
);
logger
.
info
(
"发送===============》{}"
,
b
);
return
b
;
}
...
...
@@ -157,9 +194,10 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
}
else
{
url
=
baseUrl
+
"?pageType="
+
addurl
;
}
url
=
url
+
"&data="
+
data
;
String
resultUrl
=
URLEncoder
.
encode
(
url
);
return
resultUrl
;
url
=
url
+
"&data="
;
String
encodeData
=
URLEncoder
.
encode
(
data
);
url
=
url
+
encodeData
;
return
url
;
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
f3a81e54
...
...
@@ -12,8 +12,15 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
cn.hutool.core.collection.CollectionUtil
;
import
com.alibaba.fastjson.JSON
;
import
com.gic.api.base.commons.Page
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.enterprise.api.dto.StoreDTO
;
import
com.gic.enterprise.api.service.DepartmentService
;
import
com.gic.enterprise.api.service.StoreService
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.PageResult
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
...
...
@@ -32,6 +39,7 @@ import com.gic.haoban.manage.web.auth.AuthRequestUtil;
import
com.gic.haoban.manage.web.errCode.HaoBanErrCode
;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
...
...
@@ -51,6 +59,10 @@ public class StaffController extends WebBaseController{
private
WxEnterpriseApiService
wxEnterpriseApiService
;
@Autowired
private
WxApplicationApiService
wxApplicationApiService
;
@Autowired
private
ClerkService
clerkService
;
@Autowired
private
StoreService
storeService
;
@RequestMapping
(
"staff-add"
)
public
HaobanResponse
staffAdd
(
StaffDTO
staffDTO
,
String
departmentIds
){
...
...
@@ -195,4 +207,44 @@ public class StaffController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
@RequestMapping
(
"get-clerk-info"
)
public
HaobanResponse
getClerkInfo
(
String
clerkId
){
StaffVO
staffVO
=
new
StaffVO
();
ClerkDTO
clerk
=
clerkService
.
getClerkByClerkId
(
clerkId
);
if
(
clerk
!=
null
)
{
String
storeId
=
clerk
.
getStoreId
();
StoreDTO
storeDTO
=
storeService
.
getStore
(
storeId
);
staffVO
.
setStaffName
(
clerk
.
getClerkName
());
staffVO
.
setNationCode
(
clerk
.
getNationcode
());
staffVO
.
setPhoneNumber
(
clerk
.
getPhoneNumber
());
staffVO
.
setPostion
(
clerk
.
getPositionName
());
staffVO
.
setHeadImg
(
clerk
.
getHeadImgUrl
());
staffVO
.
setDepartmentName
(
storeDTO
==
null
?
""
:
storeDTO
.
getStoreName
());
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
staffVO
);
}
@RequestMapping
(
"get-staff-info"
)
public
HaobanResponse
getStaffInfo
(
String
staffId
){
StaffVO
staffVO
=
new
StaffVO
();
StaffDTO
staff
=
staffApiService
.
selectById
(
staffId
);
if
(
staff
!=
null
)
{
List
<
StaffDepartmentRelatedDTO
>
list
=
staffDepartmentRelatedApiService
.
listByStaffId
(
staffId
);
staffVO
.
setStaffName
(
staff
.
getStaffName
());
staffVO
.
setNationCode
(
staff
.
getNationCode
());
staffVO
.
setPhoneNumber
(
staff
.
getPhoneNumber
());
staffVO
.
setPostion
(
staff
.
getPostion
());
staffVO
.
setHeadImg
(
staff
.
getHeadImg
());
if
(
CollectionUtil
.
isNotEmpty
(
list
)){
String
departmentId
=
list
.
get
(
0
).
getDepartmentId
();
DepartmentDTO
departmentDTO
=
departmentApiService
.
selectById
(
departmentId
);
if
(
departmentDTO
!=
null
){
staffVO
.
setDepartmentName
(
departmentDTO
.
getDepartmentName
());
}
}
}
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
staffVO
);
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/StaffVO.java
View file @
f3a81e54
...
...
@@ -21,6 +21,16 @@ public class StaffVO implements Serializable{
private
String
departmentName
;
private
String
headImg
;
public
String
getHeadImg
()
{
return
headImg
;
}
public
void
setHeadImg
(
String
headImg
)
{
this
.
headImg
=
headImg
;
}
public
String
getStaffName
()
{
return
staffName
;
}
...
...
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