Commit 488ba86c by 徐高华

导购关联表关联成员状态

parent f5a1498b
...@@ -82,8 +82,6 @@ public interface StaffClerkRelationApiService { ...@@ -82,8 +82,6 @@ public interface StaffClerkRelationApiService {
*/ */
List<StaffClerkRelationDTO> listByStoreId(String storeId); List<StaffClerkRelationDTO> listByStoreId(String storeId);
List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds);
/** /**
* 查询导购信息 * 查询导购信息
* @param storeId * @param storeId
......
...@@ -72,17 +72,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -72,17 +72,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId, String enterpriseId, Set<String> clerkCodeList) { public List<StaffClerkRelationDTO> listBindCode(String wxEnterpriseId, String enterpriseId, Set<String> clerkCodeList) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCode(wxEnterpriseId, enterpriseId, clerkCodeList)); return mapper.listBindCode(wxEnterpriseId, enterpriseId, clerkCodeList);
} }
@Override @Override
public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) { public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) {
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, mapper.listBindCodeByStaffId(enterpriseIdList, staffId)); return mapper.listBindCodeByStaffId(enterpriseIdList, staffId);
} }
@Override @Override
public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId) { public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId) {
TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(oldClerkId, null); StaffClerkRelationDTO clerkRelation = mapper.getOneByClerkId(oldClerkId, null);
if (null == clerkRelation) { if (null == clerkRelation) {
logger.info("老的绑定关联不存在,clerkId={}", oldClerkId); logger.info("老的绑定关联不存在,clerkId={}", oldClerkId);
return true; return true;
...@@ -126,13 +126,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -126,13 +126,15 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
logger.info("没有传门店列表:{}", wxEnterpriseId); logger.info("没有传门店列表:{}", wxEnterpriseId);
return true; return true;
} }
List<TabHaobanStaffClerkRelation> needUnbind = mapper.listBindByStoreIds(wxEnterpriseId, storeIds); List<String> storeIdList = new ArrayList<>();
storeIdList.addAll(storeIds) ;
List<StaffClerkRelationDTO> needUnbind = mapper.listByStoreIds(wxEnterpriseId, storeIdList);
if (CollectionUtils.isEmpty(needUnbind)) { if (CollectionUtils.isEmpty(needUnbind)) {
logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId); logger.info("没有门店绑定了需要解绑的:{}", wxEnterpriseId);
return true; return true;
} }
for (TabHaobanStaffClerkRelation staffClerkRelation : needUnbind) { for (StaffClerkRelationDTO staffClerkRelation : needUnbind) {
String enterpriseId = staffClerkRelation.getEnterpriseId(); String enterpriseId = staffClerkRelation.getEnterpriseId();
//删除好友通知会员 //删除好友通知会员
List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(staffClerkRelation.getStoreId(), staffClerkRelation.getStaffId()); List<String> memberIds = externalClerkRelatedService.getByStoreIdAndStaffId(staffClerkRelation.getStoreId(), staffClerkRelation.getStaffId());
...@@ -146,7 +148,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -146,7 +148,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds); clerkMainStoreRelatedService.delMainStoreByStoreIds(storeIds);
//放入队列 //放入队列
staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need); staffClerkBindLogService.pushToMqBatch(optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, need);
for (TabHaobanStaffClerkRelation clerkRelation : needUnbind) { for (StaffClerkRelationDTO clerkRelation : needUnbind) {
//废弃活码 //废弃活码
String enterpriseId = clerkRelation.getEnterpriseId(); String enterpriseId = clerkRelation.getEnterpriseId();
hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode); hmClerkRelationApiService.delByClerkId(clerkRelation.getClerkId(), enterpriseId, wxEnterpriseId, channelCode);
...@@ -212,13 +214,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -212,13 +214,12 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) { public StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation relation = mapper.getBindByClerkId(clerkId, wxEnterpriseId); return mapper.getOneByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, relation);
} }
@Override @Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) { public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId)); return mapper.getByCodeAndEnterpriseId(clerkCode, enterpriseId);
} }
...@@ -254,17 +255,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -254,17 +255,17 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) { public StaffClerkRelationDTO getOneBindByStoreId(String staffId, String storeId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getOneBindStoreId(staffId, storeId)); return mapper.getOneByStoreIdAndStaffId(storeId,staffId);
} }
@Override @Override
public StaffClerkRelationDTO getByClerkId(String clerkId) { public StaffClerkRelationDTO getByClerkId(String clerkId) {
return EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, mapper.getByClerkId(clerkId, null)); return mapper.getOneByClerkId(clerkId, null);
} }
@Override @Override
public StaffClerkRelationDTO getByClerkId(String clerkId, String wxEnterpriseId) { public StaffClerkRelationDTO getByClerkId(String clerkId, String wxEnterpriseId) {
TabHaobanStaffClerkRelation staffClerkRelation = mapper.getByClerkId(clerkId, wxEnterpriseId); StaffClerkRelationDTO staffClerkRelation = mapper.getOneByClerkId(clerkId, wxEnterpriseId);
return EntityUtil.changeEntityNew(StaffClerkRelationDTO.class, staffClerkRelation); return EntityUtil.changeEntityNew(StaffClerkRelationDTO.class, staffClerkRelation);
} }
...@@ -308,19 +309,19 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -308,19 +309,19 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) { public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) {
PageHelper.startPage(pageInfo); PageHelper.startPage(pageInfo);
List<TabHaobanStaffClerkRelation> clerkBindList = mapper.pageByWxEnterpriseId(wxEnterpriseId); List<StaffClerkRelationDTO> clerkBindList = mapper.pageByWxEnterpriseId(wxEnterpriseId);
Page<StaffClerkRelationDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindList), StaffClerkRelationDTO.class); Page<StaffClerkRelationDTO> retPage = PageUtil.changePageHelperToCurrentPage(new PageInfo<>(clerkBindList), StaffClerkRelationDTO.class);
return retPage; return retPage;
} }
@Override @Override
public List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId) { public List<StaffClerkRelationDTO> listBindByStoreId(String wxEnterpriseId, String storeId) {
return mapper.listBindByStoreId(wxEnterpriseId, storeId); return mapper.listByStoreIds(wxEnterpriseId, Arrays.asList(storeId));
} }
@Override @Override
public List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId) { public List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId) {
List<TabHaobanStaffClerkRelation> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId); List<StaffClerkRelationDTO> clerkRelations = mapper.listBindStoreIdByEnterpriseId(enterpriseId);
if (CollectionUtils.isEmpty(clerkRelations)) { if (CollectionUtils.isEmpty(clerkRelations)) {
return new ArrayList<>(); return new ArrayList<>();
} }
...@@ -339,9 +340,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -339,9 +340,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) { if (qwDTO.needOpenUserId3th()) {
return mapper.listWxOpenUserIdByClerkIds(clerkList, wxEnterpriseId); return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId,2);
} }
return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId); return mapper.listWxUserIdByClerkIds(clerkList, wxEnterpriseId,1);
} }
@Override @Override
...@@ -351,9 +352,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -351,9 +352,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
} }
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId); WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId);
if (qwDTO.needOpenUserId3th()) { if (qwDTO.needOpenUserId3th()) {
return mapper.listIdsByWxOpenUserIds(wxUserIds, wxEnterpriseId, enterpriseId); return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId,2);
} }
return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId); return mapper.listIdsByWxUserIds(wxUserIds, wxEnterpriseId, enterpriseId,1);
} }
@Override @Override
...@@ -385,6 +386,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -385,6 +386,6 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId) { public List<StaffClerkRelationDTO> listManageBindByStaffId(String staffId) {
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, mapper.listManageBindByStaffId(staffId)); return mapper.listManageBindByStaffId(staffId);
} }
} }
...@@ -439,7 +439,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA ...@@ -439,7 +439,7 @@ public class ExternalClerkRelatedApiServiceImpl implements ExternalClerkRelatedA
@Override @Override
public boolean isFriends(String memberId, String clerkId, String enterpriseId) { public boolean isFriends(String memberId, String clerkId, String enterpriseId) {
TabHaobanStaffClerkRelation staffClerkRelation = staffClerkRelationMapper.getByClerkId(clerkId,null); StaffClerkRelationDTO staffClerkRelation = staffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
return false; return false;
} }
......
...@@ -246,18 +246,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -246,18 +246,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public List<StaffClerkRelationDTO> listByStoreId(String storeId) { public List<StaffClerkRelationDTO> listByStoreId(String storeId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreId(storeId); return tabHaobanStaffClerkRelationMapper.listByStoreIds(null,Arrays.asList(storeId));
if (CollectionUtil.isEmpty(list)) {
return new ArrayList<>();
}
List<StaffClerkRelationDTO> result = EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
return result;
}
@Override
public List<StaffClerkRelationDTO> listByStoreIds(List<String> storeIds) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreIds(storeIds);
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, list);
} }
@Override @Override
...@@ -267,9 +256,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -267,9 +256,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public StaffClerkRelationDTO getOneByClerkId(String clerkId) { public StaffClerkRelationDTO getOneByClerkId(String clerkId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); return tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
StaffClerkRelationDTO result = EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, tab);
return result;
} }
@Override @Override
...@@ -284,13 +271,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -284,13 +271,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId, public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId,String staffId) {
String staffId) { StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
if (tab == null) { if (tab == null) {
return null; return null;
} }
return EntityUtil.changeEntity(StaffClerkRelationDTO.class, tab); return tab;
} }
@Override @Override
...@@ -338,8 +324,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -338,8 +324,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) { public List<StaffClerkRelationDTO> listByEnterpriseIdAndStaffid(String enterpriseId, String staffid) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid); return tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndStaffid(enterpriseId, staffid);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
} }
@Override @Override
......
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import cn.hutool.core.collection.CollectionUtil; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.clerk.api.dto.ClerkDTO; import com.gic.clerk.api.dto.ClerkDTO;
import com.gic.clerk.api.service.ClerkService; import com.gic.clerk.api.service.ClerkService;
import com.gic.commons.util.EntityUtil; import com.gic.commons.util.EntityUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.StaffDTO; import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO; import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO; import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
...@@ -16,24 +33,14 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil; ...@@ -16,24 +33,14 @@ import com.gic.haoban.manage.api.util.notify.NoticeMessageUtil;
import com.gic.haoban.manage.service.config.Config; import com.gic.haoban.manage.service.config.Config;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper; import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper; import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated; import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService; import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.WxEnterpriseService; import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.wechat.api.dto.qywx.ItemDTO; import com.gic.wechat.api.dto.qywx.ItemDTO;
import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO; import com.gic.wechat.api.dto.qywx.QywxXcxSendMessageDTO;
import com.gic.wechat.api.service.qywx.QywxSuiteApiService; import com.gic.wechat.api.service.qywx.QywxSuiteApiService;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.io.UnsupportedEncodingException; import cn.hutool.core.collection.CollectionUtil;
import java.net.URLEncoder;
import java.nio.charset.StandardCharsets;
import java.util.*;
@Service @Service
public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService { public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRelatedApiService {
...@@ -135,7 +142,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -135,7 +142,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
public Map<String, String> getWxUserIdByClerkId(String clerkId) { public Map<String, String> getWxUserIdByClerkId(String clerkId) {
Map<String, String> map = new HashMap<>(); Map<String, String> map = new HashMap<>();
TabHaobanStaffClerkRelation relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); StaffClerkRelationDTO relation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId,null);
if (relation == null) { if (relation == null) {
return map; return map;
} }
...@@ -267,7 +274,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -267,7 +274,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId); logger.info("店长不存在,发送消息失败{}", storeId);
return; return;
} }
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId()); StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) { if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId()); logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return; return;
...@@ -298,7 +305,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela ...@@ -298,7 +305,7 @@ public class StaffDepartmentRelatedApiServiceImpl implements StaffDepartmentRela
logger.info("店长不存在,发送消息失败{}", storeId); logger.info("店长不存在,发送消息失败{}", storeId);
return; return;
} }
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId()); StaffClerkRelationDTO tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(gicClerk.getClerkId(),null);
if (tab == null) { if (tab == null) {
logger.info("店长未绑定clerkId={}", gicClerk.getClerkId()); logger.info("店长未绑定clerkId={}", gicClerk.getClerkId());
return; return;
......
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