Commit 3e117d95 by qwmqiuwenmin

fix

parent 78fc61e2
......@@ -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);
}
......@@ -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
......@@ -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);
}
......@@ -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;
}
}
......@@ -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);
}
}
......@@ -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
......@@ -43,6 +43,8 @@ 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;
......@@ -467,6 +469,7 @@ public class StaffController extends WebBaseController{
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.getExtendPostion());
......@@ -478,15 +481,17 @@ public class StaffController extends WebBaseController{
vo.setActiveFlag(active);
voList.add(vo);
}
if(page.getPages() < page.getTotalPage()){
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);
}
}
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<>();
......@@ -495,11 +500,13 @@ public class StaffController extends WebBaseController{
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) {
......@@ -509,5 +516,51 @@ public class StaffController extends WebBaseController{
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);
}
}
}
}
......@@ -6,6 +6,8 @@ public class StaffExportVO implements Serializable{
private static final long serialVersionUID = 1L;
private String staffId;
private String staffName;
private String phoneNumber;
......@@ -18,6 +20,7 @@ public class StaffExportVO implements Serializable{
private String activeFlag;
private String clerkName;
public String getActiveFlag() {
return activeFlag;
......@@ -68,5 +71,21 @@ public class StaffExportVO implements Serializable{
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;
}
}
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