Commit c954244f by qwmqiuwenmin

fix

parent a2aca17e
......@@ -53,4 +53,6 @@ public interface StaffClerkRelationService {
StaffClerkRelationDTO getByClerkId(String clerkId);
List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList);
}
......@@ -104,4 +104,8 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
public StaffClerkRelationDTO getByClerkId(String clerkId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class,mapper.getByClerkId(clerkId));
}
@Override
public List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class,mapper.listByClerkIds(clerkList));
}
}
......@@ -1107,17 +1107,15 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public List<String> listUnBindClerk(String storeId) {
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
if(department == null){
return Collections.EMPTY_LIST;
}
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
List<String> clerkCodes = list.stream().filter(s->s.getClerkCode()!=null).map(s->s.getClerkCode()).collect(Collectors.toList());
List<String> storeIds = new ArrayList<String>();
storeIds.add(storeId);
List<String> clerkList = clerkService.getclerkListByStoreIds(storeIds);
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listByClerkIds(clerkList);
List<String> clerkIds = staffRelationList.stream().filter(s->s.getClerkId()!=null).map(s->s.getClerkId()).collect(Collectors.toList());
List<String> unBindList = new ArrayList<>();
if(CollectionUtil.isNotEmpty(clerkCodes)){
List<ClerkDTO> clerkList = clerkService.listClerk(storeId, clerkCodes, false);
for (ClerkDTO clerkDTO : clerkList) {
unBindList.add(clerkDTO.getClerkId());
for (String clerkId : clerkList) {
if(!clerkIds.contains(clerkId)){
unBindList.add(clerkId);
}
}
return unBindList;
......@@ -1370,12 +1368,25 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public List<String> listBindClerkUserId(String storeId) {
TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
if(department == null){
return Collections.EMPTY_LIST;
// TabHaobanDepartment department = departmentService.selectByRelatedId(storeId);
// if(department == null){
// return Collections.EMPTY_LIST;
// }
// List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
// List<String> userIdList = list.stream().filter(s->StringUtils.isNotBlank(s.getClerkCode())).map(s->s.getWxUserId()).collect(Collectors.toList());
List<String> userIdList = new ArrayList<String>();
List<String> storeIds = new ArrayList<String>();
storeIds.add(storeId);
List<String> clerkList = clerkService.getclerkListByStoreIds(storeIds);
List<StaffClerkRelationDTO> staffRelationList = staffClerkRelationService.listByClerkIds(clerkList);
Map<String,StaffClerkRelationDTO> clerkIdMap = staffRelationList.stream().filter(s->s.getClerkId()!=null).collect(Collectors.toMap(StaffClerkRelationDTO::getClerkId, s->s));
Set<String> keySet = clerkIdMap.keySet();
for (String clerkId : clerkList) {
if(keySet.contains(clerkId)){
userIdList.add(clerkIdMap.get(clerkId).getWxUserId());
}
}
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listByDepartmentId(department.getDepartmentId());
List<String> userIdList = list.stream().filter(s->StringUtils.isNotBlank(s.getClerkCode())).map(s->s.getWxUserId()).collect(Collectors.toList());
return userIdList;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment