Commit 7ea7bdda by 徐高华

Merge branch 'developer' of http://git.gicdev.com/haoban3.0/haoban-manage3.0.git into developer

parents 9b52a14f 4a2b0172
......@@ -24,11 +24,11 @@ public interface StaffMapper {
List<TabHaobanStaff> listLikeName(@Param("staffName") String staffName, @Param("wxEnterpriseId") String wxEnterpriseId);
Page<TabHaobanStaff> pageStaff(@Param("staffIds") List<String> staffIds,
@Param("activeFlag") Integer activeFlag,
@Param("keyword") String keyword,
@Param("departmentIds") List<String> departmentIds,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("relationFlag") Integer relationFlag);
@Param("activeFlag") Integer activeFlag,
@Param("keyword") String keyword,
@Param("departmentIds") List<String> departmentIds,
@Param("wxEnterpriseId") String wxEnterpriseId,
@Param("relationFlag") Integer relationFlag);
/**
* 选择用户id和企业标识
......
package com.gic.haoban.manage.service.entity;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
......@@ -47,7 +48,10 @@ public class TabHaobanStaff implements Serializable {
private String wxOpenId;
private String qrCode;
@Transient
private String departmentIds;
public String getStaffId() {
return staffId;
}
......@@ -215,4 +219,12 @@ public class TabHaobanStaff implements Serializable {
public void setQrCode(String qrCode) {
this.qrCode = qrCode;
}
public String getDepartmentIds() {
return departmentIds;
}
public void setDepartmentIds(String departmentIds) {
this.departmentIds = departmentIds;
}
}
\ No newline at end of file
......@@ -210,20 +210,19 @@ public class StaffApiServiceImpl implements StaffApiService {
}
@Override
public Page<StaffDTO> pageStaff(List<String> departmentIds, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag,String wxEnterpriseId) {
List<String> staffIds = new ArrayList<>();
public Page<StaffDTO> pageStaff(List<String> departmentIds, Integer activeFlag, String keyword, BasePageInfo pageInfo, Integer relationFlag, String wxEnterpriseId) {
List<String> staffIds = new ArrayList<>();
if (relationFlag != null) {
List<TabHaobanStaffClerkRelation> relationList = staffClerkRelationService.listByWxEnterpriseId(wxEnterpriseId);
staffIds = relationList.stream().map(TabHaobanStaffClerkRelation::getStaffId).collect(Collectors.toList());
}
PageHelper.startPage(pageInfo.getPageNum(), pageInfo.getPageSize());
Page<StaffDTO> page = PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword,departmentIds,wxEnterpriseId,relationFlag), StaffDTO.class);
Page<StaffDTO> page = PageUtil.changePageHelperToCurrentPage(staffService.pageStaff(staffIds, activeFlag, keyword, departmentIds, wxEnterpriseId, relationFlag), StaffDTO.class);
List<StaffDTO> staffDTOList = page.getResult();
if (CollectionUtils.isEmpty(staffDTOList)) {
return new Page<>();
}
staffDTOList.forEach(one -> {
//one.setDepartmentIds(Objects.isNull(related) ? null : related.getDepartmentId());
// 关联状态
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listByStaffId(wxEnterpriseId, one.getStaffId());
one.setRelationFlag(CollectionUtils.isNotEmpty(staffClerkRelationDTOS) ? 1 : 0);
......@@ -1207,24 +1206,24 @@ public class StaffApiServiceImpl implements StaffApiService {
this.addDepartInfo(list);
return list;
}
private void addDepartInfo(List<StaffDTO> list) {
List<String> staffIdList = list.stream().map(dto->dto.getStaffId()).collect(Collectors.toList()) ;
List<String> staffIdList = list.stream().map(dto -> dto.getStaffId()).collect(Collectors.toList());
List<TabHaobanStaffDepartmentRelated> deplist = staffDepartmentRelatedMapper.listStaffDepartmentByStaffIds(staffIdList);
if (CollectionUtil.isNotEmpty(list)) {
Map<String, List<TabHaobanStaffDepartmentRelated>> map = deplist.stream().collect(Collectors.groupingBy(TabHaobanStaffDepartmentRelated::getStaffId)) ;
List<String> depIdList = deplist.stream().map(dto->dto.getDepartmentId()).collect(Collectors.toList()) ;
Map<String, List<TabHaobanStaffDepartmentRelated>> map = deplist.stream().collect(Collectors.groupingBy(TabHaobanStaffDepartmentRelated::getStaffId));
List<String> depIdList = deplist.stream().map(dto -> dto.getDepartmentId()).collect(Collectors.toList());
List<DepartmentDTO> departmentList = this.departmentService.listByIds(depIdList);
Map<String,DepartmentDTO> depMap = departmentList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, dto->dto,(k1,k2)->k1)) ;
for(StaffDTO dto : list) {
String staffId = dto.getStaffId() ;
List<TabHaobanStaffDepartmentRelated> relateList = map.get(staffId) ;
if(CollectionUtils.isNotEmpty(relateList)) {
Map<String, DepartmentDTO> depMap = departmentList.stream().collect(Collectors.toMap(DepartmentDTO::getDepartmentId, dto -> dto, (k1, k2) -> k1));
for (StaffDTO dto : list) {
String staffId = dto.getStaffId();
List<TabHaobanStaffDepartmentRelated> relateList = map.get(staffId);
if (CollectionUtils.isNotEmpty(relateList)) {
List<DepartmentDTO> staffDepList = new ArrayList<>();
for(TabHaobanStaffDepartmentRelated item :relateList) {
if(null != depMap.get(item.getDepartmentId())) {
staffDepList.add(depMap.get(item.getDepartmentId())) ;
for (TabHaobanStaffDepartmentRelated item : relateList) {
if (null != depMap.get(item.getDepartmentId())) {
staffDepList.add(depMap.get(item.getDepartmentId()));
}
}
dto.setDepartmentList(staffDepList);
......@@ -1310,6 +1309,7 @@ public class StaffApiServiceImpl implements StaffApiService {
return Collections.emptyList();
}
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(staffClerkRelationDTO.getEnterpriseId(), staffClerkRelationDTO.getWxEnterpriseId());
logger.info("好办门店id:{}", JSON.toJSONString(enterpriseIdStoreIds));
Integer superManagerFlag = staff.getSuperManagerFlag();
//超管
if (superManagerFlag != null && superManagerFlag == 1) {
......@@ -1326,7 +1326,9 @@ public class StaffApiServiceImpl implements StaffApiService {
}
//取交集
Sets.SetView<String> intersection = Sets.intersection(Sets.newHashSet(enterpriseIdStoreIds), Sets.newHashSet(gicStoreIds));
return intersection.stream().collect(Collectors.toList());
List<String> storeList = intersection.stream().collect(Collectors.toList());
logger.info("该导购权限:clerkId:{},门店:{}", clerkId, JSON.toJSONString(storeList));
return storeList;
}
@Override
......@@ -1345,7 +1347,7 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public boolean isFlagByStoreIdAndEnterpriseId(String storeId, String enterpriseId, String wxEnterpriseId) {
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId ,enterpriseId);
List<String> enterpriseIdStoreIds = storeRangeService.listStoreIdByWxEnterpriseId(wxEnterpriseId, enterpriseId);
if (CollectionUtils.isEmpty(enterpriseIdStoreIds)) {
return false;
}
......
......@@ -275,7 +275,8 @@
<select id="pageStaff" resultMap="BaseResultMap">
select
a.*
a.*,
b.department_id departmentIds
from tab_haoban_staff a
left join tab_haoban_staff_department_related b on a.staff_id = b.staff_id
where a.status_flag = 1 and a.wx_enterprise_id = #{wxEnterpriseId}
......
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