Commit 7daa6b0e by 墨竹

Merge remote-tracking branch 'origin/developer' into developer

parents 678dc9dd 68f4660e
package com.gic.haoban.manage.web.controller.hm;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.servlet.http.HttpServletRequest;
......@@ -25,7 +27,12 @@ import com.gic.commons.util.EntityUtil;
import com.gic.commons.webapi.reponse.RestResponse;
import com.gic.haoban.base.api.common.pojo.dto.WebLoginDTO;
import com.gic.haoban.common.utils.AuthWebRequestUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.hm.HmQrcodeListDTO;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.api.service.StaffClerkRelationApiService;
import com.gic.haoban.manage.api.service.hm.HmQrcodeApiService;
import com.gic.haoban.manage.web.vo.hm.ClerkListVO;
import com.gic.haoban.manage.web.vo.hm.ClerkStoreListVO;
@RestController
......@@ -37,6 +44,10 @@ public class HmStoreController {
private ClerkService clerkService;
@Autowired
private StaffApiService staffApiService;
@Autowired
private StaffClerkRelationApiService staffClerkRelationApiService;
@Autowired
private HmQrcodeApiService hmQrcodeApiService;
@RequestMapping("store-clerk-list")
@ResponseBody
......@@ -84,9 +95,69 @@ public class HmStoreController {
retPage.setParams(params);
retPage.setTotalCount(page.getTotalCount());
retPage.setTotalPage(page.getTotalPage());
List<ClerkStoreListVO> result = EntityUtil.changeEntityListByJSON(ClerkStoreListVO.class, page.getResult()) ;
List<ClerkStoreListVO> result = EntityUtil.changeEntityListByJSON(ClerkStoreListVO.class, page.getResult());
// 好办状态
this.haobanStatus(result);
retPage.setResult(result);
return RestResponse.successResult(retPage);
}
private void haobanStatus(List<ClerkStoreListVO> list) {
List<String> clerkIdList = new ArrayList<>();
if (CollectionUtils.isEmpty(list)) {
for (ClerkStoreListVO store : list) {
if (CollectionUtils.isNotEmpty(store.getClerkList())) {
List<String> tempList = store.getClerkList().stream().map(dto -> dto.getClerkId())
.collect(Collectors.toList());
if (CollectionUtils.isNotEmpty(tempList)) {
clerkIdList.addAll(tempList);
}
}
}
}
// 未开启客户联系的
List<String> status2List = new ArrayList<>();
// 已有单人活码的
List<String> status3List = new ArrayList<>();
// 可以创建单人活码的
List<String> status4List = new ArrayList<>();
// 已关联企微号的,且开启客户联系
List<String> statusList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(clerkIdList)) {
List<StaffClerkRelationDTO> clerkRelationList = this.staffClerkRelationApiService
.listByClerkIds(clerkIdList);
if (CollectionUtils.isNotEmpty(clerkRelationList)) {
status2List.addAll(clerkRelationList.stream().filter(dto -> dto.getStatusFlag() == 1)
.map(dto -> dto.getClerkId()).collect(Collectors.toList()));
statusList.addAll(clerkRelationList.stream().filter(dto -> dto.getStatusFlag() == 2)
.map(dto -> dto.getClerkId()).collect(Collectors.toList()));
}
}
if (CollectionUtils.isNotEmpty(statusList)) {
List<HmQrcodeListDTO> hmList = new ArrayList<>();
if (CollectionUtils.isNotEmpty(hmList)) {
status2List.addAll(hmList.stream().filter(dto -> dto.getStatusFlag() == 3).map(dto -> dto.getClerkId())
.collect(Collectors.toList()));
status3List.addAll(hmList.stream().filter(dto -> dto.getStatusFlag() == 1).map(dto -> dto.getClerkId())
.collect(Collectors.toList()));
}
status4List
.addAll(statusList.stream().filter(id -> (!status2List.contains(id) && !status3List.contains(id)))
.collect(Collectors.toList()));
}
list.stream().forEach(item -> {
for (ClerkListVO clerk : item.getClerkList()) {
if (status2List.contains(clerk.getClerkId())) {
clerk.setHmStatus(2);
}
if (status3List.contains(clerk.getClerkId())) {
clerk.setHmStatus(3);
}
if (status4List.contains(clerk.getClerkId())) {
clerk.setHmStatus(4);
}
}
});
}
}
......@@ -15,15 +15,28 @@ public class ClerkListVO implements Serializable {
private String enterpriseId;
private String imageUrl;
private Integer clerkType = 0;// 店长(0:否,1:是)
private String nationcode;
private String haobanRemark;
// 1未关联企微 2关联的企微号未配置客户联系功能 3已有单人活码 4无单人活码(可以创建)
private int hmStatus = 1;
public String getHaobanRemark() {
return haobanRemark;
public int getHmStatus() {
return hmStatus;
}
public void setHmStatus(int hmStatus) {
this.hmStatus = hmStatus;
}
public void setHaobanRemark(String haobanRemark) {
this.haobanRemark = haobanRemark;
public String getHaobanRemark() {
if(this.getHmStatus()==2) {
return "关联的企微号未配置客户联系功能";
}
if(this.getHmStatus()==3) {
return "单人活码已创建";
}
if(this.getHmStatus()==4) {
return "--";
}
return "未关联企微号";
}
public String getClerkId() {
......@@ -62,10 +75,6 @@ public class ClerkListVO implements Serializable {
return clerkType;
}
public String getNationcode() {
return nationcode;
}
public void setClerkId(String clerkId) {
this.clerkId = clerkId;
}
......@@ -101,8 +110,4 @@ public class ClerkListVO implements Serializable {
public void setClerkType(Integer clerkType) {
this.clerkType = clerkType;
}
public void setNationcode(String nationcode) {
this.nationcode = nationcode;
}
}
\ No newline at end of file
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