Commit 0706fb7e by 徐高华

Merge branch 'xgh_内容中台' into 'developer'

朋友圈

See merge request !457
parents 915122b2 ff28c9bb
......@@ -81,6 +81,8 @@ public interface StaffClerkRelationApiService {
* @return
*/
List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(String wxEnterpriseId, List<String> storeIds) ;
/**
* 查询导购信息
......
......@@ -248,6 +248,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
public List<StaffClerkRelationDTO> listByStoreId(String storeId) {
return tabHaobanStaffClerkRelationMapper.listByStoreIds(null,Arrays.asList(storeId));
}
@Override
public List<StaffClerkRelationDTO> listByStoreIds(String wxEnterpriseId, List<String> storeIds) {
return tabHaobanStaffClerkRelationMapper.listByStoreIds(wxEnterpriseId,storeIds);
}
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId, int channelCode,String wxEnterpriseId) {
......
......@@ -1724,29 +1724,17 @@ public class WxStaffController extends WebBaseController {
ClerkDTO clerk = this.clerkService.getclerkById(clerkId) ;
int clerkType = clerk.getClerkType() ;
List<ClerkListVO> resultList = null ;
if(clerkType==0) {
return RestResponse.failure("-1", "无权访问");
}else if(clerkType==1) {
List<ClerkListDTO> clerkList = clerkService.getClerkByStoreId(enterpriseId, clerk.getStoreId());
if (CollectionUtils.isNotEmpty(clerkList) && StringUtils.isNotEmpty(clerkSearchParams)) {
clerkList = clerkList.stream().filter(dto->dto.getClerkCode().contains(clerkSearchParams) || dto.getClerkName().contains(clerkSearchParams)).collect(Collectors.toList()) ;
}
if (CollectionUtils.isEmpty(clerkList)) {
return RestResponse.failure("-1", "无导购");
}
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, clerkList);
}else if(clerkType==2) {
// 如果有权限控制,进行管辖门店过0滤
List<String> authStoreIdList = this.staffApiService.getHaoBanStoreIdsRolesByClerkId(clerkId,wxEnterpriseId);
if (CollectionUtils.isEmpty(authStoreIdList)) {
return RestResponse.failure("-1", "无授权门店");
}
if (authStoreIdList.size() == 1 && authStoreIdList.contains("-1")) {
authStoreIdList = null ;
}
// 查询区经门店下的店长,eid,storelist,clerkSearchParams
logger.info("查询所有店长,返回={}", enterpriseId);
if(clerkType != 0) {
return RestResponse.failure("-1", "非店长身份");
}
List<ClerkListDTO> clerkList = clerkService.getClerkByStoreId(enterpriseId, clerk.getStoreId());
if (CollectionUtils.isNotEmpty(clerkList) && StringUtils.isNotEmpty(clerkSearchParams)) {
clerkList = clerkList.stream().filter(dto->dto.getClerkCode().contains(clerkSearchParams) || dto.getClerkName().contains(clerkSearchParams)).collect(Collectors.toList()) ;
}
if (CollectionUtils.isEmpty(clerkList)) {
return RestResponse.failure("-1", "无导购");
}
resultList = EntityUtil.changeEntityListByJSON(ClerkListVO.class, clerkList);
List<String> clerkIdList = resultList.stream().map(dto->dto.getClerkId()).collect(Collectors.toList()) ;
List<StaffClerkRelationDTO> relationList = this.staffClerkRelationApiService.listByClerkIdsWxEnterpriseId(clerkIdList, wxEnterpriseId) ;
List<String> retlationIdList = relationList.stream().map(dto->dto.getClerkId()).collect(Collectors.toList()) ;
......
......@@ -110,38 +110,39 @@ public class QwMessageController extends WebBaseController {
String enterpriseId = qo.getEnterpriseId();
String staffId = qo.getStaffId();
List<String> clerkIdList = qo.getClerkIdList() ;
List<String> storeIdList = qo.getStoreIdList() ;
ClerkDTO clerk = this.clerkService.getclerkById(clerkId);
logger.info("clerkType={},ChooseAll={}",clerk.getClerkType(),qo.getChooseAll());
// 查询所有门店-导购
if(StringUtils.isNotBlank(qo.getChooseAll()) && "1".equals(qo.getChooseAll())) {
if (clerk.getClerkType() == 1) {
String storeId = clerk.getStoreId() ;
clerkIdList = staffApiService.listBindStaffId(storeId);
logger.info("店长,导购数={}",clerkIdList.size());
} else if(clerk.getClerkType()==2) {
// 区经
} else {
clerkIdList = new ArrayList<>();
}
int clerkType = clerk.getClerkType() ;
if(clerkType==0) {
return RestResponse.failure("-1","非店长、区间");
}
logger.info("clerkIdList={}",JSON.toJSONString(clerkIdList));
if(CollectionUtils.isEmpty(clerkIdList)) {
return RestResponse.failure("-1","无发送导购数据");
String chooseAll = qo.getChooseAll() ;
if(StringUtils.isBlank(chooseAll) || !"1".equals(chooseAll)) {
if(clerkType==1 && CollectionUtils.isEmpty(clerkIdList)) {
return RestResponse.failure("-1","请选择导购");
}
if(clerkType==2 && CollectionUtils.isEmpty(storeIdList)) {
return RestResponse.failure("-1","请选择门店");
}
}
JSONObject json = new JSONObject();
json.put("clerkIdList", clerkIdList);
json.put("storeIdList", storeIdList) ;
json.put("enterpriseId", enterpriseId);
json.put("imgJson", imgJson);
json.put("staffId", staffId);
json.put("sendClerkId", clerkId);
json.put("sendClerkType", clerkType) ;
json.put("sendClerkStoreId", clerk.getStoreId());
// 朋友圈-分享
json.put("sendType", 2);
json.put("wxEnterpriseId", wxEnterpriseId);
json.put("content", qo.getContent()) ;
json.put("contentMaterialId", contentMaterialId) ;
String ret = json.toJSONString();
String params = json.toJSONString();
try {
GICMQClientUtil.getClientInstance().sendCommonMessage("haobanCommonRouter", ret,
GICMQClientUtil.getClientInstance().sendCommonMessage("haobanCommonRouter", params,
"com.gic.haoban.app.customer.service.api.service.MessageLogApiService", "callBackSendMessage");
} catch (Exception e) {
logger.info(e.getMessage(), e);
......
......@@ -14,9 +14,16 @@ public class CustomerQO implements Serializable{
private String staffId;
private List<String> memberIdList ;
private List<String> clerkIdList ;
private List<String> storeIdList ;
private String content ;
private boolean qwFriendFlag = false ;
public List<String> getStoreIdList() {
return storeIdList;
}
public void setStoreIdList(List<String> storeIdList) {
this.storeIdList = storeIdList;
}
public String getContent() {
return content;
}
......
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