Commit ee3d4f0b by 王祖波

Merge remote-tracking branch 'origin/feature-content5' into feature-content5

parents a236ef4d 04aa3317
......@@ -13,6 +13,8 @@ import com.gic.content.api.qdto.account.AccountGenerateQrCodeQDTO;
import com.gic.content.api.qdto.account.AccountScanQrCodeResultQDTO;
import com.gic.content.api.qdto.account.ContentAccountQDTO;
import com.gic.content.api.service.ContentAccountApiService;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.web.controller.content.adaptor.ClerkStoreAdaptor;
import com.gic.haoban.manage.web.qo.content.account.AccountGenerateQrCodeQo;
import com.gic.haoban.manage.web.qo.content.account.AccountInfoQo;
......@@ -26,6 +28,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
......@@ -55,15 +58,34 @@ public class ContentAccountController {
@RequestMapping(path = "/list")
private RestResponse<List<ContentAccountInfoVo>> queryAccountList(AccountInfoQo accountInfoQo) {
ClerkDTO clerkDTO = clerkStoreAdaptor.queryClerkInfo(accountInfoQo.getEnterpriseId(), accountInfoQo.getClerkId());
if (clerkDTO == null) {
return RestResponse.successResult(Collections.emptyList());
// 查询成员
List<StaffClerkRelationDTO> staffClerkRelationDTOS = clerkStoreAdaptor.queryStaffClerkRelationInfo(accountInfoQo.getEnterpriseId(), accountInfoQo.getStaffId());
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
return RestResponse.successResult();
}
List<String> clerkIds = staffClerkRelationDTOS
.stream()
.map(StaffClerkRelationDTO::getClerkId)
.distinct()
.collect(Collectors.toList());
List<String> storeIds = new ArrayList<>();
List<String> clerkCodes = new ArrayList<>();
List<ClerkDTO> clerkDTOS = clerkStoreAdaptor.queryClerkInfos(clerkIds);
if (CollectionUtils.isEmpty(clerkDTOS)) {
return RestResponse.successResult();
}
for (ClerkDTO clerkDTO : clerkDTOS) {
clerkCodes.add(clerkDTO.getClerkCode());
if (new Integer(1).equals(clerkDTO.getClerkType())) {
storeIds.add(clerkDTO.getStoreId());
}
}
ContentAccountQDTO contentAccountQDTO = new ContentAccountQDTO();
contentAccountQDTO.setEnterpriseId(accountInfoQo.getEnterpriseId());
contentAccountQDTO.setQueryForClerk(Boolean.TRUE);
contentAccountQDTO.setUserCodes(Collections.singletonList(clerkDTO.getClerkCode()));
contentAccountQDTO.setStoreIds(Collections.singletonList(clerkDTO.getStoreId()));
contentAccountQDTO.setUserCodes(clerkCodes);
contentAccountQDTO.setStoreIds(storeIds);
ServiceResponse<Page<ContentAccountInfoDTO>> serviceResponse =
contentAccountApiService.queryAccountList(contentAccountQDTO);
if (!serviceResponse.isSuccess() || CollectionUtils.isEmpty(serviceResponse.getResult().getResult())) {
......
......@@ -2,6 +2,7 @@ package com.gic.haoban.manage.web.controller.content.adaptor;
import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.role.StoreRoleDTO;
......@@ -14,6 +15,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
/**
......@@ -81,4 +83,24 @@ public class ClerkStoreAdaptor {
return clerkService.getClerkByClerkId(clerkId);
}
public List<StaffClerkRelationDTO> queryStaffClerkRelationInfo(String enterpriseId, String staffId) {
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationApiService.listBindCodeByStaffId(Collections.singletonList(enterpriseId), staffId);
if (CollectionUtils.isEmpty(staffClerkRelationDTOS)) {
return Collections.emptyList();
}
return staffClerkRelationDTOS;
}
public List<ClerkDTO> queryClerkInfos(List<String> clerkIds) {
if (CollectionUtils.isEmpty(clerkIds)) {
return Collections.emptyList();
}
List<ClerkDTO> clerkDTOS = clerkService.getClerkByClerkIds(new HashSet<>(clerkIds));
if (CollectionUtils.isEmpty(clerkDTOS)) {
return Collections.emptyList();
}
return clerkDTOS;
}
}
......@@ -24,6 +24,13 @@ public class AccountInfoQo implements Serializable {
*/
private String storeId;
/**
* 成员id
*/
private String staffId;
private String wxEnterpriseId;
public String getEnterpriseId() {
return enterpriseId;
}
......@@ -47,4 +54,20 @@ public class AccountInfoQo implements Serializable {
public void setStoreId(String storeId) {
this.storeId = storeId;
}
public String getStaffId() {
return staffId;
}
public void setStaffId(String staffId) {
this.staffId = staffId;
}
public String getWxEnterpriseId() {
return wxEnterpriseId;
}
public void setWxEnterpriseId(String wxEnterpriseId) {
this.wxEnterpriseId = 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