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
77592261
Commit
77592261
authored
Jun 18, 2021
by
fudahua
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
离职继承fix
parent
948c4a1f
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
110 additions
and
18 deletions
+110
-18
HandoverExternalMapper.java
...ban/manage/service/dao/mapper/HandoverExternalMapper.java
+5
-0
HandoverStaffMapper.java
...haoban/manage/service/dao/mapper/HandoverStaffMapper.java
+15
-0
HandoverServiceImpl.java
...oban/manage/service/service/impl/HandoverServiceImpl.java
+46
-16
HandoverOperationApiServiceImpl.java
...ice/service/out/impl/HandoverOperationApiServiceImpl.java
+1
-0
HandoverExternalMapper.xml
...vice/src/main/resources/mapper/HandoverExternalMapper.xml
+17
-0
HandoverStaffMapper.xml
...service/src/main/resources/mapper/HandoverStaffMapper.xml
+25
-0
TabHaobanClerkMainStoreRelatedMapper.xml
...resources/mapper/TabHaobanClerkMainStoreRelatedMapper.xml
+1
-2
No files found.
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/HandoverExternalMapper.java
View file @
77592261
...
...
@@ -81,4 +81,8 @@ public interface HandoverExternalMapper {
* @return
*/
TabHandoverExternal
getByExternalUserIdAndStaffId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"staffId"
)
String
staffId
,
@Param
(
"externalUserId"
)
String
externalUserId
);
/**
*/
int
delNoTransferExternal
(
@Param
(
"userIds"
)
List
<
String
>
userIds
,
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/dao/mapper/HandoverStaffMapper.java
View file @
77592261
...
...
@@ -45,4 +45,18 @@ public interface HandoverStaffMapper {
* @return
*/
List
<
TabHandoverStaff
>
listByStoreId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"storeId"
)
String
storeId
);
/**
* 获取待分配列表
*
* @param wxEnterpriseId
* @return
*/
List
<
TabHandoverStaff
>
listByWxEnterpriseId
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
);
/**
* 删除用户
*/
int
delByUserIds
(
@Param
(
"wxEnterpriseId"
)
String
wxEnterpriseId
,
@Param
(
"userIds"
)
List
<
String
>
userIds
);
}
\ No newline at end of file
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/impl/HandoverServiceImpl.java
View file @
77592261
package
com
.
gic
.
haoban
.
manage
.
service
.
service
.
impl
;
import
com.alibaba.fastjson.JSONObject
;
import
com.gic.api.base.commons.Page
;
import
com.gic.commons.util.ToolUtil
;
import
com.gic.haoban.base.api.common.BasePageInfo
;
...
...
@@ -15,14 +16,13 @@ import com.gic.wechat.api.dto.qywx.QywxUnassignedInfoDTO;
import
com.gic.wechat.api.service.qywx.QywxUserApiService
;
import
com.github.pagehelper.PageHelper
;
import
com.github.pagehelper.PageInfo
;
import
com.google.common.collect.Sets
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.slf4j.Logger
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
java.util.Date
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
import
static
org
.
slf4j
.
LoggerFactory
.
getLogger
;
...
...
@@ -70,22 +70,19 @@ public class HandoverServiceImpl implements HandoverService {
@Override
public
boolean
saveHandover
(
String
wxEnterpriseId
,
List
<
QywxUnassignedInfoDTO
>
infoList
)
{
logger
.
info
(
"saveHandover-保存离职基础数据:{}"
,
wxEnterpriseId
);
TabHaobanWxEnterprise
wxEnterprise
=
wxEnterpriseMapper
.
selectByPrimaryKey
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
infoList
))
{
logger
.
info
(
"保存失败"
);
logger
.
info
(
"没有要保存的数据,删除所有需要删除逇"
);
delHandoverStaff
(
wxEnterpriseId
,
null
);
return
false
;
}
Map
<
String
,
List
<
QywxUnassignedInfoDTO
>>
handoverUserMap
=
infoList
.
stream
().
collect
(
Collectors
.
groupingBy
(
dto
->
dto
.
getHandoverUserid
()));
handoverUserMap
.
forEach
((
userId
,
list
)
->
{
TabHandoverStaff
handoverStaff
=
getHandoverStaff
(
wxEnterpriseId
,
userId
);
if
(
null
==
handoverStaff
)
{
logger
.
info
(
"staff已经存在不许重复"
);
return
;
}
// List<String> staffIds = new ArrayList<>();
// staffIds.add(handoverStaff.getStaffId());
// List<String> handoverExternalIds = handoverExternalMapper.listIdByStaffIds(wxEnterpriseId, staffIds);
List
<
TabHandoverExternal
>
externalList
=
list
.
stream
().
map
(
dto
->
{
TabHandoverExternal
mid
=
getHandExternal
(
dto
,
wxEnterprise
,
handoverStaff
);
mid
.
setStaffId
(
handoverStaff
.
getStaffId
());
...
...
@@ -104,9 +101,33 @@ public class HandoverServiceImpl implements HandoverService {
handoverExternalMapper
.
insertBatch
(
needAdd
);
});
//删除不需要的staff数据
List
<
TabHandoverStaff
>
handoverStaffList
=
handoverStaffMapper
.
listByWxEnterpriseId
(
wxEnterpriseId
);
if
(
CollectionUtils
.
isEmpty
(
handoverStaffList
))
{
logger
.
info
(
"没有新数据,无需删除"
);
return
true
;
}
Set
<
String
>
hasWxUserIds
=
handoverStaffList
.
stream
().
map
(
dto
->
dto
.
getHandoverUserId
()).
collect
(
Collectors
.
toSet
());
Sets
.
SetView
<
String
>
needDelUserIds
=
Sets
.
difference
(
hasWxUserIds
,
handoverUserMap
.
keySet
());
if
(
CollectionUtils
.
isEmpty
(
needDelUserIds
))
{
logger
.
info
(
"没有新数据,无需删除2"
);
return
true
;
}
logger
.
info
(
"删除数据"
);
delHandoverStaff
(
wxEnterpriseId
,
new
ArrayList
<>(
needDelUserIds
));
return
false
;
}
/**
* 删除企业下的数据
*
* @param wxEnterpriseId
* @param wxUserIds
*/
private
void
delHandoverStaff
(
String
wxEnterpriseId
,
List
<
String
>
wxUserIds
)
{
handoverStaffMapper
.
delByUserIds
(
wxEnterpriseId
,
wxUserIds
);
handoverExternalMapper
.
delNoTransferExternal
(
wxUserIds
,
wxEnterpriseId
);
}
private
void
saveHandoverStaff
(
TabHandoverStaff
handoverStaff
)
{
if
(
handoverStaff
.
getHandoverStaffId
()
!=
null
)
{
...
...
@@ -255,14 +276,23 @@ public class HandoverServiceImpl implements HandoverService {
}
list
.
forEach
(
dto
->
{
TabHandoverExternal
handoverExternal
=
handoverExternalMapper
.
getByTransferId
(
wxEnterpriseId
,
transferId
,
dto
.
getExternalUserid
());
if
(
dto
.
getTakeoverTime
()
>
0
)
{
Date
date
=
new
Date
(
dto
.
getTakeoverTime
()
*
1000
);
handoverExternal
.
setTakeoverTime
(
date
);
try
{
TabHandoverExternal
handoverExternal
=
handoverExternalMapper
.
getByTransferId
(
wxEnterpriseId
,
transferId
,
dto
.
getExternalUserid
());
if
(
handoverExternal
==
null
)
{
logger
.
info
(
"不存在该人员,有问题:{}"
,
dto
.
getExternalUserid
());
return
;
}
if
(
dto
.
getTakeoverTime
()
!=
null
&&
dto
.
getTakeoverTime
()
>
0
)
{
Date
date
=
new
Date
(
dto
.
getTakeoverTime
()
*
1000
);
handoverExternal
.
setTakeoverTime
(
date
);
}
handoverExternal
.
setTransferStatus
(
dto
.
getStatus
());
handoverExternal
.
setUpdateTime
(
new
Date
());
handoverExternalMapper
.
updateByPrimaryKeySelective
(
handoverExternal
);
}
catch
(
Exception
e
)
{
logger
.
info
(
"exception:{},{}"
,
JSONObject
.
toJSONString
(
dto
),
e
);
e
.
printStackTrace
();
}
handoverExternal
.
setTransferStatus
(
dto
.
getStatus
());
handoverExternal
.
setUpdateTime
(
new
Date
());
handoverExternalMapper
.
updateByPrimaryKeySelective
(
handoverExternal
);
});
return
true
;
}
...
...
haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/HandoverOperationApiServiceImpl.java
View file @
77592261
...
...
@@ -141,6 +141,7 @@ public class HandoverOperationApiServiceImpl implements HandoverOperationApiServ
handoverService
.
dealResult
(
wxEnterpriseId
,
dto
.
getHandoverTransferId
(),
customerResults
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
logger
.
info
(
"处理异常:{},{}"
,
JSONObject
.
toJSONString
(
dto
),
e
);
}
});
...
...
haoban-manage3-service/src/main/resources/mapper/HandoverExternalMapper.xml
View file @
77592261
...
...
@@ -323,4 +323,20 @@
and external_user_id=#{externalUserId}
and status_flag!=0
</select>
<update
id=
"delNoTransferExternal"
>
update tab_haoban_handover_external
set
status_flag = 0,
update_time = now()
where
wx_enterprise_id=#{wxEnterpriseId}
<if
test=
"userIds!=null and userIds.size>0"
>
and user_id in
<foreach
collection=
"userIds"
item=
"item"
separator=
","
open=
"("
close=
")"
>
#{item}
</foreach>
</if>
and status_flag=1
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/HandoverStaffMapper.xml
View file @
77592261
...
...
@@ -178,4 +178,28 @@
and store_id=#{storeId}
and status_flag=1
</select>
<select
id=
"listByWxEnterpriseId"
resultMap=
"BaseResultMap"
>
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_handover_staff
where wx_enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag=1
</select>
<update
id=
"delByUserIds"
>
update tab_haoban_handover_staff
set
status_flag = 0,
update_time = now()
where
wx_enterprise_id=#{wxEnterpriseId}
and status_flag=1
<if
test=
"userIds!=null and userIds.size>0"
>
and handover_user_id in
<foreach
collection=
"userIds"
item=
"item"
open=
"("
close=
")"
separator=
","
>
#{item}
</foreach>
</if>
</update>
</mapper>
\ No newline at end of file
haoban-manage3-service/src/main/resources/mapper/TabHaobanClerkMainStoreRelatedMapper.xml
View file @
77592261
...
...
@@ -189,8 +189,7 @@
select
<include
refid=
"Base_Column_List"
/>
from tab_haoban_clerk_main_store_related
where 1=1
and wx_enterprise_id = #{wxEnterpriseId}
where wx_enterprise_id = #{wxEnterpriseId}
and staff_id = #{staffId}
order by create_time desc limit 1
</select>
...
...
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