Commit 3cf1e268 by jinxin

针对多个商户使用一个企微时,导出所属商户名称

parent a7c6baed
......@@ -93,6 +93,11 @@ public class StaffServiceImpl implements StaffService {
}
String sortField = "a."+staffListBO.getSortField();
staffListBO.setSortField(sortField);
//业务需求:许可激活时间和过期时间增加升序和降序排序,时间为空的数据无论升序还是降序排序均排在最后
if("asc".equals(staffListBO.getSortType()) || "ASC".equals(staffListBO.getSortType())){
String s = "ISNULL("+sortField+"),"+sortField;
staffListBO.setSortField(s);
}
return mapper.pageStaff(staffListBO);
}
......
......@@ -6,6 +6,7 @@ import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSONArray;
import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.qdto.TransferActiveCodeQDTO;
......@@ -503,6 +504,12 @@ public class StaffController extends WebBaseController {
pageNum++;
}
List<StaffExportVO> voList = new ArrayList<>();
//针对多个商户使用一个企微时,导出所属商户名称
Boolean flag=false;
List<WxEnterpriseRelatedDTO> result = staffApiService.getWxEnterpriseRelatedList(wxEnterpriseId).getResult();
if (CollUtil.isNotEmpty(result) && result.size()>1){
flag = true;
}
for (StaffDTO staffDTO : staffAllList) {
StaffExportVO vo = new StaffExportVO();
vo.setStaffId(staffDTO.getStaffId());
......@@ -511,6 +518,15 @@ public class StaffController extends WebBaseController {
vo.setPosition(staffDTO.getPostion());
vo.setDepartmentName(departmentMap.get(staffDTO.getDepartmentIds()) == null ? null : departmentMap.get(staffDTO.getDepartmentIds()).getDepartmentName());
vo.setRelationFlag((Objects.isNull(staffDTO.getRelationFlag()) || staffDTO.getRelationFlag() == 0) ? "未关联" : "已关联");
if (flag){
List<String> enterpriseNameList = staffDTO.getEnterpriseNameList();
if (CollUtil.isNotEmpty(enterpriseNameList)){
String enterpriseName = String.join(",", enterpriseNameList);
vo.setEnterpriseName(enterpriseName);
}else {
vo.setEnterpriseName("无归属");
}
}
voList.add(vo);
}
//拼接导购信息
......@@ -521,8 +537,15 @@ public class StaffController extends WebBaseController {
}
mergeClerkInfo(voList, wxEnterpriseId);
String fileName = wxEnterpriseName + "通讯录" + DateUtil.dateToStr(new Date(), DateUtil.FORMAT_DATE_8);
List<String> titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购");
List<String> fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName");
List<String> titleList =new ArrayList<>();
List<String> fileList = new ArrayList<>();
if (flag){
titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购","所属商户");
fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName","enterpriseName");
}else {
titleList = Arrays.asList("姓名", "职务", "部门", "手机号", "关联状态", "关联导购");
fileList = Arrays.asList("staffName", "position", "departmentName", "phoneNumber", "relationFlag", "clerkName");
}
try {
ExcelUtils.xls(response, request, fileName, voList, fileList, titleList);
} catch (Exception e) {
......@@ -642,6 +665,9 @@ public class StaffController extends WebBaseController {
String wxEnterpriseId = login.getWxEnterpriseId();
ServiceResponse<List<WxEnterpriseRelatedDTO>> response = staffApiService.getWxEnterpriseRelatedList(wxEnterpriseId);
List<WxEnterpriseRelatedVO> vo = JSONArray.parseArray(JSONObject.toJSONString(response.getResult()), WxEnterpriseRelatedVO.class);
if (CollUtil.isEmpty(vo)){
return RestResponse.successResult(new ArrayList<>());
}
return RestResponse.successResult(vo);
}
......
......@@ -27,6 +27,18 @@ public class StaffExportVO implements Serializable{
* 关联状态为 员工是否关联某门店导购
*/
private String relationFlag;
/**
* gic品牌名称
*/
private String enterpriseName;
public String getEnterpriseName() {
return enterpriseName;
}
public void setEnterpriseName(String enterpriseName) {
this.enterpriseName = enterpriseName;
}
public String getActiveFlag() {
return activeFlag;
......
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