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
0
Merge Requests
0
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
15497628
Commit
15497628
authored
Jan 23, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/developer' into developer
parents
ddd2151b
2614f7c7
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
376 additions
and
21 deletions
+376
-21
StaffClerkRelationApiService.java
...oban/manage/api/service/StaffClerkRelationApiService.java
+10
-0
pom.xml
haoban-manage3-service/pom.xml
+11
-5
TabHaobanStaffClerkRelationMapper.java
...service/dao/mapper/TabHaobanStaffClerkRelationMapper.java
+3
-0
StaffClerkRelationService.java
...ban/manage/service/service/StaffClerkRelationService.java
+4
-0
StaffClerkRelationServiceImpl.java
...e/service/service/impl/StaffClerkRelationServiceImpl.java
+16
-0
BindApiServiceImpl.java
...n/manage/service/service/out/impl/BindApiServiceImpl.java
+12
-0
MemberUnionidRelatedApiServiceImpl.java
.../service/out/impl/MemberUnionidRelatedApiServiceImpl.java
+6
-0
StaffApiServiceImpl.java
.../manage/service/service/out/impl/StaffApiServiceImpl.java
+11
-1
StaffClerkRelationApiServiceImpl.java
...ce/service/out/impl/StaffClerkRelationApiServiceImpl.java
+5
-0
StaffDepartmentRelatedApiServiceImpl.java
...ervice/out/impl/StaffDepartmentRelatedApiServiceImpl.java
+4
-0
KafkaMessageServiceImpl.java
...c/haoban/manage/service/task/KafkaMessageServiceImpl.java
+35
-2
jdbc-haoban-manage-service.xml
...service/src/main/resources/jdbc-haoban-manage-service.xml
+1
-1
TabHaobanStaffClerkRelationMapper.xml
...in/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
+9
-0
pom.xml
haoban-manage3-web/pom.xml
+5
-0
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+3
-0
StaffController.java
...com/gic/haoban/manage/web/controller/StaffController.java
+132
-1
WxEnterpriseController.java
.../haoban/manage/web/controller/WxEnterpriseController.java
+6
-4
GlobalExceptionHandler.java
...c/haoban/manage/web/exception/GlobalExceptionHandler.java
+3
-2
StaffExportVO.java
...main/java/com/gic/haoban/manage/web/vo/StaffExportVO.java
+91
-0
ClerkController.java
...com/gic/haoban/manage/web/controller/ClerkController.java
+4
-0
StoreController.java
...com/gic/haoban/manage/web/controller/StoreController.java
+3
-4
GlobalExceptionHandler.java
...c/haoban/manage/web/exception/GlobalExceptionHandler.java
+2
-1
No files found.
haoban-manage3-api/src/main/java/com/gic/haoban/manage/api/service/StaffClerkRelationApiService.java
View file @
15497628
...
...
@@ -122,4 +122,14 @@ public interface StaffClerkRelationApiService {
* @return
*/
ServiceResponse
<
String
>
getClerkMemberChatConfig
(
String
clerkId
);
/**
*
* @Description 方法描述: TODO <pre>
* @return 返回值类型: <pre>
* @author 作者: WQ <pre>
* @date 时间: 2020年12月24日 上午11:21:38 <pre>
* @param wxEnterpriseId: <pre>
* @param pageInfo: <pre>
*/
public
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
}
haoban-manage3-service/pom.xml
View file @
15497628
...
...
@@ -72,6 +72,12 @@
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
haoban-task-api
</artifactId>
<version>
${haoban-task-api}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
haoban-contacts-api
</artifactId>
<version>
${haoban-contacts-api}
</version>
</dependency>
...
...
@@ -159,11 +165,11 @@
<artifactId>
hutool-all
</artifactId>
<version>
5.5.1
</version>
</dependency>
<!-- <dependency> --
>
<!-- <groupId>com.gic</groupId> --
>
<!-- <artifactId>sql-check-sdk</artifactId> --
>
<!-- <version>4.0-SNAPSHOT</version> --
>
<!-- </dependency> --
>
<dependency
>
<groupId>
com.gic
</groupId
>
<artifactId>
sql-check-sdk
</artifactId
>
<version>
${sql-check-sdk}
</version
>
</dependency
>
</dependencies>
<build>
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/TabHaobanStaffClerkRelationMapper.java
View file @
15497628
...
...
@@ -85,4 +85,6 @@ public interface TabHaobanStaffClerkRelationMapper {
TabHaobanStaffClerkRelation
getByCodeAndStoreId
(
@Param
(
"clerkCode"
)
String
clerkCode
,
@Param
(
"storeId"
)
String
storeId
);
List
<
TabHaobanStaffClerkRelation
>
listByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
List
<
TabHaobanStaffClerkRelation
>
pageByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/StaffClerkRelationService.java
View file @
15497628
...
...
@@ -3,6 +3,8 @@ package com.gic.haoban.manage.service.service;
import
java.util.List
;
import
java.util.Set
;
import
com.gic.api.base.commons.Page
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
...
...
@@ -81,5 +83,7 @@ public interface StaffClerkRelationService {
*/
List
<
TabHaobanStaffClerkRelation
>
listByWxEnterpriseId
(
String
wxEnterpriseId
);
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
);
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/StaffClerkRelationServiceImpl.java
View file @
15497628
...
...
@@ -4,18 +4,23 @@ import java.util.*;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.manage.api.enums.BindTypeEnum
;
import
com.gic.haoban.manage.api.enums.ChannelCodeEnum
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanMemberClerkChatConfigMapper
;
import
com.gic.haoban.manage.service.entity.MemberClerkChatConfig
;
import
com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog
;
import
com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation
;
import
com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService
;
import
com.gic.haoban.manage.service.service.ExternalClerkRelatedService
;
import
com.gic.haoban.manage.service.service.StaffClerkBindLogService
;
import
com.gic.haoban.manage.service.service.StaffService
;
import
com.gic.wechat.api.dto.qywx.QywxExternalcontactDTO
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
javafx.scene.control.Tab
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -25,8 +30,11 @@ import org.slf4j.LoggerFactory;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.haoban.common.utils.PageUtil
;
import
com.gic.haoban.common.utils.StringUtil
;
import
com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO
;
import
com.gic.haoban.manage.api.dto.StaffClerkRelationDTO
;
import
com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
...
...
@@ -229,4 +237,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
public
List
<
TabHaobanStaffClerkRelation
>
listByWxEnterpriseId
(
String
wxEnterpriseId
)
{
return
mapper
.
listByWxEnterpriseId
(
wxEnterpriseId
);
}
@Override
public
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
)
{
PageHelper
.
startPage
(
pageInfo
);
List
<
TabHaobanStaffClerkRelation
>
clerkBindList
=
mapper
.
pageByWxEnterpriseId
(
wxEnterpriseId
);
Page
<
StaffClerkRelationDTO
>
retPage
=
PageUtil
.
changePageHelperToCurrentPage
(
new
PageInfo
<>(
clerkBindList
),
StaffClerkRelationDTO
.
class
);
return
retPage
;
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/BindApiServiceImpl.java
View file @
15497628
...
...
@@ -159,6 +159,9 @@ public class BindApiServiceImpl implements BindApiService {
if
(
StringUtils
.
isNotBlank
(
fromClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
){
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
clerkName
;
...
...
@@ -223,6 +226,9 @@ public class BindApiServiceImpl implements BindApiService {
if
(
StringUtils
.
isNotBlank
(
sendClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
){
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
staffDTO
.
getStaffName
();
...
...
@@ -268,6 +274,9 @@ public class BindApiServiceImpl implements BindApiService {
if
(
StringUtils
.
isNotBlank
(
fromClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
){
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
clerkName
;
...
...
@@ -330,6 +339,9 @@ public class BindApiServiceImpl implements BindApiService {
if
(
StringUtils
.
isNotBlank
(
fromClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
){
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
clerkName
;
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/MemberUnionidRelatedApiServiceImpl.java
View file @
15497628
...
...
@@ -315,6 +315,12 @@ public class MemberUnionidRelatedApiServiceImpl implements MemberUnionidRelatedA
}
TabHaobanExternalClerkRelated
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
String
key
=
wxUserId
+
wxEnterpriseId
+
name
+
createTime
;
if
(
exsitDTO
==
null
){
RedisUtil
.
lock
(
key
,
1L
);
exsitDTO
=
externalClerkRelatedService
.
getByParams
(
wxUserId
,
wxEnterpriseId
,
name
,
createTime
);
RedisUtil
.
unlock
(
key
);
}
if
(
exsitDTO
==
null
){
TabHaobanExternalClerkRelated
related
=
new
TabHaobanExternalClerkRelated
();
related
.
setAddCreateTime
(
createTime
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
View file @
15497628
...
...
@@ -51,6 +51,7 @@ import org.springframework.stereotype.Service;
import
java.util.*
;
import
java.util.concurrent.TimeUnit
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
...
...
@@ -209,11 +210,20 @@ public class StaffApiServiceImpl implements StaffApiService {
for
(
TabHaobanStaffDepartmentRelated
tabHaobanStaffDepartmentRelated
:
list
)
{
staffIds
.
add
(
tabHaobanStaffDepartmentRelated
.
getStaffId
());
}
Map
<
String
,
TabHaobanStaffDepartmentRelated
>
map
=
new
HashMap
<
String
,
TabHaobanStaffDepartmentRelated
>();
if
(
CollectionUtils
.
isNotEmpty
(
list
)){
map
=
list
.
stream
().
collect
(
Collectors
.
toMap
(
TabHaobanStaffDepartmentRelated:
:
getStaffId
,
Function
.
identity
(),
(
s1
,
s2
)
->
s2
));
}
if
(
staffIds
.
isEmpty
())
{
return
new
Page
<
StaffDTO
>();
}
PageHelper
.
startPage
(
pageInfo
.
getPageNum
(),
pageInfo
.
getPageSize
());
return
PageUtil
.
changePageHelperToCurrentPage
(
staffService
.
pageStaff
(
staffIds
,
activeFlag
,
""
),
StaffDTO
.
class
);
Page
<
StaffDTO
>
page
=
PageUtil
.
changePageHelperToCurrentPage
(
staffService
.
pageStaff
(
staffIds
,
activeFlag
,
""
),
StaffDTO
.
class
);
List
<
StaffDTO
>
staffList
=
page
.
getResult
();
for
(
StaffDTO
staffDTO
:
staffList
)
{
staffDTO
.
setDepartmentIds
(
map
.
get
(
staffDTO
.
getStaffId
())
==
null
?
null
:
map
.
get
(
staffDTO
.
getStaffId
()).
getDepartmentId
());
}
return
page
;
}
@Override
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffClerkRelationApiServiceImpl.java
View file @
15497628
...
...
@@ -452,4 +452,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
response
.
setResult
(
clerkChatConfig
.
getConfigId
());
return
response
;
}
@Override
public
Page
<
StaffClerkRelationDTO
>
pageByWxEnterpriseId
(
String
wxEnterpriseId
,
BasePageInfo
pageInfo
)
{
return
staffClerkRelatinService
.
pageByWxEnterpriseId
(
wxEnterpriseId
,
pageInfo
);
}
}
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffDepartmentRelatedApiServiceImpl.java
View file @
15497628
...
...
@@ -305,6 +305,10 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
@Override
public
boolean
sendSingleMessage
(
String
clerkId
,
String
title
,
String
content
,
String
pageUrl
)
{
if
(
StringUtils
.
isEmpty
(
clerkId
)){
logger
.
info
(
"clerkId不存在============>"
);
return
false
;
}
Map
<
String
,
String
>
map
=
getWxUserIdByClerkId
(
clerkId
);
String
wxUserId
=
map
.
get
(
"wxUserId"
);
String
corpId
=
map
.
get
(
"corpId"
);
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/task/KafkaMessageServiceImpl.java
View file @
15497628
...
...
@@ -4,7 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.gic.binlog.base.entity.GicField
;
import
com.gic.binlog.base.entity.GicRecord
;
import
com.gic.binlog.base.entity.enums.GicRecordType
;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.EntityUtil
;
import
com.gic.commons.util.GICMQClientUtil
;
import
com.gic.dubbo.entity.ProviderLocalTag
;
import
com.gic.haoban.base.api.common.ServiceResponse
;
import
com.gic.haoban.contacts.manage.api.enums.StatusEnum
;
...
...
@@ -16,6 +19,11 @@ import com.gic.haoban.manage.service.pojo.BinlogBasePojo;
import
com.gic.haoban.manage.service.pojo.ClerkSyncPojo
;
import
com.gic.haoban.manage.service.service.StaffClerkBindLogService
;
import
com.gic.haoban.manage.service.service.StaffClerkRelationService
;
import
com.gic.haoban.task.api.dto.MqMessageQo
;
import
com.gic.mq.sdk.exception.RouterException
;
import
com.gic.qcloud.cmq.CMQClientException
;
import
com.gic.qcloud.cmq.CMQServerException
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.time.DateUtils
;
import
org.apache.kafka.clients.consumer.ConsumerRecord
;
...
...
@@ -47,8 +55,10 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
@Autowired
private
StaffClerkRelationApiService
staffClerkRelationApiService
;
@Autowired
private
ClerkService
clerkService
;
@Override
public
void
onMessage
(
ConsumerRecord
<
String
,
GicRecord
>
record
)
{
...
...
@@ -65,6 +75,29 @@ public class KafkaMessageServiceImpl implements MessageListener<String, GicRecor
if
(
record
.
value
().
getTableName
().
equals
(
CLERK
))
{
dealClerk
((
ClerkSyncPojo
)
pojo
);
//TODO 发消息处理新增店长,任务重新分配问题
ClerkSyncPojo
syncPojo
=
(
ClerkSyncPojo
)
pojo
;
GicRecordType
gicRecordType
=
GicRecordType
.
valueOf
(
syncPojo
.
getRecordType
());
if
(
gicRecordType
.
equals
(
GicRecordType
.
INSERT
)
||
gicRecordType
.
equals
(
GicRecordType
.
UPDATE
)){
//新增,更新某个人为店长
String
clerkId
=
syncPojo
.
getClerkId
();
ClerkDTO
clerkDTO
=
clerkService
.
getClerkByClerkId
(
clerkId
);
Integer
clerkType
=
clerkDTO
.
getClerkType
();
if
(
clerkType
!=
null
&&
clerkType
.
intValue
()
==
1
){
//TODO 发消息处理新增店长,任务重新分配问题
try
{
logger
.
info
(
"待分配任务重分配======>{}"
,
clerkId
);
MqMessageQo
mqMessageQo
=
new
MqMessageQo
();
mqMessageQo
.
setType
(
MqMessageQo
.
DISTRIBUTE_TASK
);
mqMessageQo
.
setData
(
clerkId
);
String
s
=
JSONObject
.
toJSONString
(
mqMessageQo
);
GICMQClientUtil
.
getClientInstance
().
sendCommonMessage
(
RouterConstant
.
ROUTERTYPE
,
s
,
"com.gic.haoban.task.api.service.MqAsynApiService"
,
"run"
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
}
}
}
}
}
...
...
haoban-manage3-service/src/main/resources/jdbc-haoban-manage-service.xml
View file @
15497628
...
...
@@ -37,7 +37,7 @@
</value>
</property>
</bean>
<!-- <bean class="com.gic.sql.interceptor.MybatisSqlInterceptor"/> --
>
<bean
class=
"com.gic.sql.interceptor.MybatisSqlInterceptor"
/
>
</array>
</property>
</bean>
...
...
haoban-manage3-service/src/main/resources/mapper/TabHaobanStaffClerkRelationMapper.xml
View file @
15497628
...
...
@@ -368,4 +368,12 @@
group by wx_user_id
</select>
<select
id=
"pageByWxEnterpriseId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_staff_clerk_relation
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
</select>
</mapper>
\ No newline at end of file
haoban-manage3-web/pom.xml
View file @
15497628
...
...
@@ -63,6 +63,11 @@
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-redis-data
</artifactId>
<version>
${gic-redis-data}
</version>
</dependency>
<dependency>
<groupId>
com.gic
</groupId>
<artifactId>
gic-wechat-api
</artifactId>
<version>
${gic-wechat-api}
</version>
</dependency>
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
15497628
...
...
@@ -130,6 +130,9 @@ public class ClerkController extends WebBaseController{
if
(
StringUtils
.
isNotBlank
(
oldClerkCode
)){
//发送消息
ClerkDTO
leader
=
clerkService
.
getClerkLeaderByStoreId
(
storeId
);
if
(
leader
==
null
){
leader
=
new
ClerkDTO
();
}
String
clerkId
=
leader
.
getClerkId
();
String
storeName
=
departmentDTO
.
getDepartmentName
();
String
staffName
=
staffDTO
.
getStaffName
();
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/StaffController.java
View file @
15497628
...
...
@@ -7,6 +7,8 @@ import com.gic.api.base.commons.Page;
import
com.gic.clerk.api.dto.ClerkDTO
;
import
com.gic.clerk.api.service.ClerkNewService
;
import
com.gic.clerk.api.service.ClerkService
;
import
com.gic.commons.util.DateUtil
;
import
com.gic.commons.util.ExcelUtils
;
import
com.gic.enterprise.api.dto.*
;
import
com.gic.enterprise.api.service.*
;
import
com.gic.enterprise.api.service.EnterpriseService
;
...
...
@@ -25,6 +27,7 @@ import com.gic.haoban.manage.web.errCode.HaoBanErrCode;
import
com.gic.haoban.manage.web.qo.StaffEditJsonQO
;
import
com.gic.haoban.manage.web.vo.ClerkInfoVo
;
import
com.gic.haoban.manage.web.vo.LoginVO
;
import
com.gic.haoban.manage.web.vo.StaffExportVO
;
import
com.gic.haoban.manage.web.vo.StaffVO
;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
org.apache.commons.collections.CollectionUtils
;
...
...
@@ -37,10 +40,16 @@ import org.springframework.web.bind.annotation.RequestParam;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.ArrayList
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Set
;
import
java.util.stream.Collector
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
@RestController
public
class
StaffController
extends
WebBaseController
{
...
...
@@ -431,5 +440,127 @@ public class StaffController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
page
);
}
/**
*
* @Description 会员导出
* @return 返回值类型: <pre>
* @author 作者: qwm
* @date 时间: 2020年12月18日 上午11:11:35 <pre>
*/
@RequestMapping
(
"staff-export"
)
public
HaobanResponse
staffExport
(
HttpServletResponse
response
,
HttpServletRequest
request
){
BasePageInfo
pageInfo
=
new
BasePageInfo
();
int
pageSize
=
1000
;
int
pageNum
=
1
;
pageInfo
.
setPageNum
(
pageNum
);
pageInfo
.
setPageSize
(
pageSize
);
LoginVO
login
=
(
LoginVO
)
AuthRequestUtil
.
getLoginUser
();
String
wxEnterpriseId
=
login
.
getWxEnterpriseId
();
WxEnterpriseDTO
enterprise
=
wxEnterpriseApiService
.
getOne
(
wxEnterpriseId
);
String
wxEnterpriseName
=
""
;
if
(
enterprise
!=
null
){
wxEnterpriseName
=
enterprise
.
getCorpName
();
}
List
<
DepartmentShortDTO
>
relationList
=
departmentApiService
.
listAllDepartment
(
wxEnterpriseId
);
Map
<
String
,
DepartmentShortDTO
>
departmentMap
=
relationList
.
stream
().
collect
(
Collectors
.
toMap
(
DepartmentShortDTO:
:
getDepartmentId
,
s
->
s
));
List
<
String
>
departmentIds
=
relationList
.
stream
().
map
(
DepartmentShortDTO:
:
getDepartmentId
).
collect
(
Collectors
.
toList
());
Page
<
StaffDTO
>
page
=
staffApiService
.
pageStaff
(
departmentIds
,
null
,
null
,
pageInfo
);
List
<
StaffDTO
>
list
=
page
.
getResult
();
List
<
StaffExportVO
>
voList
=
new
ArrayList
<>();
for
(
StaffDTO
staffDTO
:
list
)
{
StaffExportVO
vo
=
new
StaffExportVO
();
vo
.
setStaffId
(
staffDTO
.
getStaffId
());
vo
.
setPhoneNumber
(
staffDTO
.
getPhoneNumber
());
vo
.
setStaffName
(
staffDTO
.
getStaffName
());
vo
.
setPosition
(
staffDTO
.
getPostion
());
vo
.
setDepartmentName
(
departmentMap
.
get
(
staffDTO
.
getDepartmentIds
())
==
null
?
null
:
departmentMap
.
get
(
staffDTO
.
getDepartmentIds
()).
getDepartmentName
());
String
active
=
"是"
;
if
(
staffDTO
.
getActiveFlag
()
==
null
||
staffDTO
.
getActiveFlag
()
==
0
){
active
=
"否"
;
}
vo
.
setActiveFlag
(
active
);
voList
.
add
(
vo
);
}
while
(
page
.
getPages
()
<
page
.
getTotalPage
()){
pageNum
++
;
pageInfo
.
setPageNum
(
pageNum
);
page
=
staffApiService
.
pageStaff
(
departmentIds
,
null
,
null
,
pageInfo
);
List
<
StaffDTO
>
sonList
=
page
.
getResult
();
if
(
CollectionUtils
.
isNotEmpty
(
sonList
)){
list
.
addAll
(
sonList
);
}
}
//拼接导购信息
mergeClerkInfo
(
voList
,
wxEnterpriseId
);
String
fileName
=
wxEnterpriseName
+
"通讯录"
+
DateUtil
.
dateToStr
(
new
Date
(),
DateUtil
.
FORMAT_DATE_8
);
List
<
String
>
fileList
=
new
ArrayList
<>();
List
<
String
>
titleList
=
new
ArrayList
<>();
titleList
.
add
(
"姓名"
);
titleList
.
add
(
"职务"
);
titleList
.
add
(
"部门"
);
titleList
.
add
(
"手机号"
);
titleList
.
add
(
"使用状态"
);
titleList
.
add
(
"关联导购"
);
fileList
.
add
(
"staffName"
);
fileList
.
add
(
"position"
);
fileList
.
add
(
"departmentName"
);
fileList
.
add
(
"phoneNumber"
);
fileList
.
add
(
"activeFlag"
);
fileList
.
add
(
"clerkName"
);
try
{
ExcelUtils
.
csv
(
response
,
request
,
fileName
,
voList
,
fileList
,
titleList
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"导出失败"
);
}
return
null
;
}
private
void
mergeClerkInfo
(
List
<
StaffExportVO
>
list
,
String
wxEnterpriseId
){
BasePageInfo
pageInfoRelation
=
new
BasePageInfo
();
int
pageSizeRelation
=
1000
;
int
pageNumRelation
=
1
;
pageInfoRelation
.
setPageNum
(
pageNumRelation
);
pageInfoRelation
.
setPageSize
(
pageSizeRelation
);
Page
<
StaffClerkRelationDTO
>
bindPage
=
staffClerkRelationApiService
.
pageByWxEnterpriseId
(
wxEnterpriseId
,
pageInfoRelation
);
List
<
StaffClerkRelationDTO
>
bindList
=
bindPage
.
getResult
();
Set
<
String
>
clerkIdList
=
bindList
.
stream
().
map
(
StaffClerkRelationDTO:
:
getClerkId
).
collect
(
Collectors
.
toSet
());
List
<
ClerkDTO
>
clerkList
=
clerkService
.
getClerkByClerkIds
(
clerkIdList
);
while
(
bindPage
.
getPages
()
<
bindPage
.
getTotalPage
()){
pageNumRelation
++
;
pageInfoRelation
.
setPageNum
(
pageNumRelation
);
bindPage
=
staffClerkRelationApiService
.
pageByWxEnterpriseId
(
wxEnterpriseId
,
pageInfoRelation
);
List
<
StaffClerkRelationDTO
>
sonList
=
bindPage
.
getResult
();
Set
<
String
>
clerkSonIdList
=
sonList
.
stream
().
map
(
StaffClerkRelationDTO:
:
getClerkId
).
collect
(
Collectors
.
toSet
());
List
<
ClerkDTO
>
sonClerkList
=
clerkService
.
getClerkByClerkIds
(
clerkSonIdList
);
if
(
CollectionUtils
.
isNotEmpty
(
sonClerkList
)){
clerkList
.
addAll
(
sonClerkList
);
}
if
(
CollectionUtils
.
isNotEmpty
(
sonList
)){
bindList
.
addAll
(
sonList
);
}
}
Map
<
String
,
List
<
StaffClerkRelationDTO
>>
bindMap
=
bindList
.
stream
().
collect
(
Collectors
.
groupingBy
(
StaffClerkRelationDTO:
:
getStaffId
));
Map
<
String
,
ClerkDTO
>
clerkMap
=
clerkList
.
stream
().
collect
(
Collectors
.
toMap
(
ClerkDTO:
:
getClerkId
,
s
->
s
,
(
v1
,
v2
)
->
v2
));
for
(
StaffExportVO
staffDTO
:
list
)
{
List
<
StaffClerkRelationDTO
>
relationList
=
bindMap
.
get
(
staffDTO
.
getStaffId
());
if
(
CollectionUtils
.
isNotEmpty
(
relationList
)){
String
clerkName
=
""
;
for
(
StaffClerkRelationDTO
staffClerkRelationDTO
:
relationList
)
{
ClerkDTO
clerk
=
clerkMap
.
get
(
staffClerkRelationDTO
.
getClerkId
());
if
(
clerk
!=
null
){
clerkName
+=
clerk
.
getClerkName
()
+
","
;
}
}
if
(
StringUtils
.
isNoneBlank
(
clerkName
)){
clerkName
=
clerkName
.
substring
(
0
,
clerkName
.
length
()
-
1
);
}
staffDTO
.
setClerkName
(
clerkName
);
}
}
}
}
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/controller/WxEnterpriseController.java
View file @
15497628
...
...
@@ -504,12 +504,14 @@ public class WxEnterpriseController extends WebBaseController{
return
resultResponse
(
HaoBanErrCode
.
ERR_2
);
}
EnterpriseDTO
enterprise
=
enterpriseService
.
getEnterpriseByEid
(
enterpriseId
);
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()){
logger
.
info
(
"enterprise={}"
,
JSON
.
toJSONString
(
enterprise
));
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
||
enterprise
.
getEnabledState
()
==
null
){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()
&&
enterprise
.
getEnabledState
()
==
1
){
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
false
);
}
logger
.
info
(
"【返回类型】overFlag={}"
,
true
);
return
resultResponse
(
HaoBanErrCode
.
ERR_1
,
true
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/exception/GlobalExceptionHandler.java
View file @
15497628
...
...
@@ -45,7 +45,7 @@ public class GlobalExceptionHandler extends WebBaseController {
}
else
{
message
=
HaoBanErrCode
.
ERR_3
.
getMsg
();
}
res
.
setMessage
(
message
);
res
.
setMessage
(
"系统异常"
);
return
res
;
}
...
...
@@ -69,7 +69,8 @@ public class GlobalExceptionHandler extends WebBaseController {
}
// 输出详细错误信息,便于调试
return
resultResponse
(
errCode
,
null
,
sb
.
toString
());
// return resultResponse(errCode, null, sb.toString());
return
resultResponse
(
HaoBanErrCode
.
ERR_3
);
}
...
...
haoban-manage3-web/src/main/java/com/gic/haoban/manage/web/vo/StaffExportVO.java
0 → 100644
View file @
15497628
package
com
.
gic
.
haoban
.
manage
.
web
.
vo
;
import
java.io.Serializable
;
public
class
StaffExportVO
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
private
String
staffId
;
private
String
staffName
;
private
String
phoneNumber
;
private
String
nationCode
;
private
String
position
;
private
String
departmentName
;
private
String
activeFlag
;
private
String
clerkName
;
public
String
getActiveFlag
()
{
return
activeFlag
;
}
public
void
setActiveFlag
(
String
activeFlag
)
{
this
.
activeFlag
=
activeFlag
;
}
public
String
getStaffName
()
{
return
staffName
;
}
public
void
setStaffName
(
String
staffName
)
{
this
.
staffName
=
staffName
;
}
public
String
getPhoneNumber
()
{
return
phoneNumber
;
}
public
void
setPhoneNumber
(
String
phoneNumber
)
{
this
.
phoneNumber
=
phoneNumber
;
}
public
String
getNationCode
()
{
return
nationCode
;
}
public
void
setNationCode
(
String
nationCode
)
{
this
.
nationCode
=
nationCode
;
}
public
String
getPosition
()
{
return
position
;
}
public
void
setPosition
(
String
position
)
{
this
.
position
=
position
;
}
public
String
getDepartmentName
()
{
return
departmentName
;
}
public
void
setDepartmentName
(
String
departmentName
)
{
this
.
departmentName
=
departmentName
;
}
public
String
getStaffId
()
{
return
staffId
;
}
public
void
setStaffId
(
String
staffId
)
{
this
.
staffId
=
staffId
;
}
public
String
getClerkName
()
{
return
clerkName
;
}
public
void
setClerkName
(
String
clerkName
)
{
this
.
clerkName
=
clerkName
;
}
}
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/ClerkController.java
View file @
15497628
...
...
@@ -598,6 +598,10 @@ public class ClerkController extends WebBaseController{
jsonObject
.
put
(
"storeId"
,
clerk
.
getStoreId
());
String
data
=
jsonObject
.
toJSONString
();
ClerkDTO
gicClerk
=
clerkService
.
getClerkLeaderByStoreId
(
clerk
.
getStoreId
());
if
(
gicClerk
==
null
){
//店长不存在,直接返回
return
resultResponse
(
HaoBanErrCode
.
ERR_1
);
}
String
pageUrl
=
staffDepartmentRelatedApiService
.
getPageUrl
(
AppPageType
.
STORE_RELATED_RECORD
.
getCode
(),
data
);
staffDepartmentRelatedApiService
.
sendSingleMessage
(
gicClerk
.
getClerkId
(),
messageTitle
,
messageContent
,
pageUrl
);
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/controller/StoreController.java
View file @
15497628
...
...
@@ -415,14 +415,13 @@ public class StoreController extends WebBaseController{
return
true
;
}
EnterpriseDTO
enterprise
=
enterpriseService
.
getEnterpriseByEid
(
store
.
getEnterpriseId
());
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
){
if
(
enterprise
==
null
||
enterprise
.
getExpireTime
()
==
null
||
enterprise
.
getEnabledState
()
==
null
){
return
false
;
}
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()){
}
if
(
enterprise
.
getExpireTime
().
getTime
()
>
System
.
currentTimeMillis
()
&&
enterprise
.
getEnabledState
()
==
1
){
return
false
;
}
return
true
;
}
...
...
haoban-manage3-wx/src/main/java/com/gic/haoban/manage/web/exception/GlobalExceptionHandler.java
View file @
15497628
...
...
@@ -76,7 +76,8 @@ public class GlobalExceptionHandler extends WebBaseController {
}
// 输出详细错误信息,便于调试
return
resultResponse
(
errCode
,
null
,
sb
.
toString
());
// return resultResponse(errCode, null, sb.toString());
return
resultResponse
(
HaoBanErrCode
.
ERR_3
);
}
...
...
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