Commit 1b5bbdeb by xuwenqian

feat:新增查询所有与好办相关导购

parent d71be61e
......@@ -3,8 +3,9 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class StaffClerkInfoDTO implements Serializable{
public class StaffClerkInfoDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String staffClerkRelationId;
......@@ -48,8 +49,6 @@ public class StaffClerkInfoDTO implements Serializable{
this.mainStoreFlag = mainStoreFlag;
}
private static final long serialVersionUID = 1L;
public String getEnterpriseName() {
return enterpriseName;
}
......
......@@ -3,8 +3,9 @@ package com.gic.haoban.manage.api.dto;
import java.io.Serializable;
import java.util.Date;
public class StaffClerkRelationDTO implements Serializable{
public class StaffClerkRelationDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String staffClerkRelationId;
......@@ -28,7 +29,8 @@ public class StaffClerkRelationDTO implements Serializable{
private Date updateTime;
private static final long serialVersionUID = 1L;
private String storeName;
private String staffName;
public String getStaffClerkRelationId() {
return staffClerkRelationId;
......@@ -118,4 +120,19 @@ public class StaffClerkRelationDTO implements Serializable{
this.updateTime = updateTime;
}
public String getStoreName() {
return storeName;
}
public void setStoreName(String storeName) {
this.storeName = storeName;
}
public String getStaffName() {
return staffName;
}
public void setStaffName(String staffName) {
this.staffName = staffName;
}
}
package com.gic.haoban.manage.api.service;
import java.util.List;
import java.util.Set;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
......@@ -10,12 +7,16 @@ import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import java.util.List;
import java.util.Set;
public interface StaffClerkRelationApiService {
/**
* 绑定日志
*
* @param params
*/
public void bindLogMq(String params);
void bindLogMq(String params);
List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList);
......@@ -30,9 +31,10 @@ public interface StaffClerkRelationApiService {
/**
* 绑定
*
* @return
*/
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO,String optStaffId,int chanelCode);
ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int chanelCode);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
......@@ -96,40 +98,49 @@ public interface StaffClerkRelationApiService {
/**
* 搜索查询列表
*
* @param wxEnterpriseId
* @param search
* @param enterpriseId
* @param optType
* @return
*/
public Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo);
Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo);
/**
* 追加到绑定日志
*
* @param staffId
* @param optStaffId
* @param optType
* @param channelCode
* @param relationId
*/
public void pushToBindLog(String staffId,String optStaffId,int optType,int channelCode,String relationId);
void pushToBindLog(String staffId, String optStaffId, int optType, int channelCode, String relationId);
/**
* 获取config
*
* @param clerkId
* @param memberId
* @return
*/
ServiceResponse<String> getClerkMemberChatConfig(String clerkId);
/**
*
* @Description 方法描述:
* @return 返回值类型: <pre>
* @author 作者: WQ <pre>
* @date 时间: 2020年12月24日 上午11:21:38 <pre>
* @param wxEnterpriseId: <pre>
* @param pageInfo: <pre>
* @Description 方法描述:
*/
Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo);
/**
* 查询状态正常导购
* @return
*/
public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo);
List<StaffClerkRelationDTO> listAll();
}
package com.gic.haoban.manage.service.dao.mapper;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface TabHaobanStaffClerkRelationMapper {
int deleteByPrimaryKey(String staffClerkRelationId);
......@@ -25,14 +24,16 @@ public interface TabHaobanStaffClerkRelationMapper {
List<TabHaobanStaffClerkRelation> listBindCodeByStaffId(@Param("enterpriseIdList")List<String> enterpriseIdList, @Param("staffId")String staffId);
TabHaobanStaffClerkRelation getOneByClerkId(@Param("clerkId")String clerkId);
TabHaobanStaffClerkRelation getOneByClerkId(@Param("clerkId") String clerkId);
/**
* 改变状态 格局clerkId
*
* @param clerkId
* @param status
* @return
*/
public int changeStatusByClerkId(@Param("clerkId") String clerkId,@Param("status") Integer status);
int changeStatusByClerkId(@Param("clerkId") String clerkId, @Param("status") Integer status);
/**
* 更新信息
......@@ -117,7 +118,18 @@ public interface TabHaobanStaffClerkRelationMapper {
/**
* 已使用的门店id列表
*
* @param enterpriseId
*/
List<TabHaobanStaffClerkRelation> listBindStoreIdByEnterpriseId(String enterpriseId);
/**
* 列出所有
*
* @return {@link List<TabHaobanStaffClerkRelation> }
* @author xuwenqian
* @date 2021-07-15 16:24:27
*/
List<StaffClerkRelationDTO> listAll();
}
\ No newline at end of file
package com.gic.haoban.manage.service.service;
import java.util.List;
import java.util.Set;
import com.gic.api.base.commons.Page;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import org.apache.ibatis.annotations.Param;
import java.util.List;
import java.util.Set;
public interface StaffClerkRelationService {
......@@ -20,10 +17,11 @@ public interface StaffClerkRelationService {
/**
* 删除绑定
*
* @param clerkId
* @return
*/
public boolean delBind(String clerkId,String optStaffId,int chanelCode);
boolean delBind(String clerkId, String optStaffId, int chanelCode);
/**
* 删除绑定
......@@ -32,7 +30,7 @@ public interface StaffClerkRelationService {
* @param storeIds
* @return
*/
public boolean delBindByStoreIds(String wxEnterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
boolean delBindByStoreIds(String wxEnterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
/**
* 删除绑定
......@@ -42,35 +40,37 @@ public interface StaffClerkRelationService {
* @param storeIds 解除除了这些门店之外的绑定的门店
* @return
*/
public boolean delBindNotInStoreIds(String wxEnterpriseId, String enterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
boolean delBindNotInStoreIds(String wxEnterpriseId, String enterpriseId, Set<String> storeIds, String optStaffId, int chanelCode);
/**
* 绑定
*
* @param dto
* @return
*/
public String bind(StaffClerkRelationDTO dto,String optStaffId,int chanelCode);
String bind(StaffClerkRelationDTO dto, String optStaffId, int chanelCode);
/**
* 根据clerkId 更新数据
* @param dto
* @return
*/
public boolean updateByClerkId(StaffClerkRelationDTO dto);
boolean updateByClerkId(StaffClerkRelationDTO dto);
/**
* 查询绑定根据clerkId
*
* @param clerkId
* @param wxEnterpriseId
* @return
*/
public StaffClerkRelationDTO getBindByClerkId(String clerkId,String wxEnterpriseId);
StaffClerkRelationDTO getBindByClerkId(String clerkId, String wxEnterpriseId);
StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId);
String insert(StaffClerkRelationDTO staffClerkRelation);
public int cleanStaffClerk( String wxEnterpriseId, List<String> staffIds);
int cleanStaffClerk(String wxEnterpriseId, List<String> staffIds);
StaffClerkRelationDTO getOneBindCodeNoStatus(String enterpriseId, String clerkCode);
......@@ -86,15 +86,15 @@ public interface StaffClerkRelationService {
* 保存
* @param memberClerkChatConfig
*/
public void saveChatConfig(MemberClerkChatConfig memberClerkChatConfig);
void saveChatConfig(MemberClerkChatConfig memberClerkChatConfig);
/**
*
* @param staffId
* @param memberId
* @return
*/
public MemberClerkChatConfig getChatConfig(String staffId,String memberId);
MemberClerkChatConfig getChatConfig(String staffId, String memberId);
/**
* 根据企业查询
* @param wxEnterpriseId
......@@ -121,5 +121,14 @@ public interface StaffClerkRelationService {
*/
List<StaffClerkRelationDTO> listBindStoreIdByEnterpriseId(String enterpriseId);
/**
* 查询所有正常导购
*
* @return {@link List<StaffClerkRelationDTO> }
* @author xuwenqian
* @date 2021-07-15 16:26:17
*/
List<StaffClerkRelationDTO> listAll();
}
package com.gic.haoban.manage.service.service.impl;
import java.util.*;
import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.ToolUtil;
import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.enums.BindTypeEnum;
import com.gic.haoban.manage.api.enums.ChannelCodeEnum;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanMemberClerkChatConfigMapper;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;
import com.gic.haoban.manage.service.entity.TabHaobanClerkMainStoreRelated;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.wechat.api.dto.qywx.QywxExternalcontactDTO;
import com.gic.haoban.manage.service.service.*;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import javafx.scene.control.Tab;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
......@@ -31,14 +24,8 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.gic.api.base.commons.Page;
import com.gic.commons.util.EntityUtil;
import com.gic.haoban.common.utils.PageUtil;
import com.gic.haoban.common.utils.StringUtil;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.service.dao.mapper.TabHaobanStaffClerkRelationMapper;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import java.util.*;
import java.util.stream.Collectors;
@Service
public class StaffClerkRelationServiceImpl implements StaffClerkRelationService {
......@@ -293,4 +280,9 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
}
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, clerkRelations);
}
@Override
public List<StaffClerkRelationDTO> listAll() {
return mapper.listAll();
}
}
......@@ -38,7 +38,7 @@ import java.util.stream.Collectors;
@Service
public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService {
private static final Logger logger= LoggerFactory.getLogger(StaffClerkRelationApiServiceImpl.class);
private static final Logger logger = LoggerFactory.getLogger(StaffClerkRelationApiServiceImpl.class);
@Autowired
private StaffClerkRelationService staffClerkRelatinService;
......@@ -86,9 +86,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public void bindLogMq(String params) {
logger.info("绑定日志mq:{}",params);
logger.info("绑定日志mq:{}", params);
StaffClerkBindLogInfoDTO infoDTO = JSONObject.parseObject(params, StaffClerkBindLogInfoDTO.class);
if (null == infoDTO){
if (null == infoDTO) {
logger.info("数据不存在");
return;
}
......@@ -98,11 +98,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return;
}
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String phoneNumber="";
String phoneNumber = "";
if (null != clerkDTO) {
phoneNumber=clerkDTO.getPhoneNumber();
phoneNumber = clerkDTO.getPhoneNumber();
}
TabHaobanStaffClerkBindLog staffClerkRelation=new TabHaobanStaffClerkBindLog();
TabHaobanStaffClerkBindLog staffClerkRelation = new TabHaobanStaffClerkBindLog();
staffClerkRelation.setClerkId(clerkRelation.getClerkId());
staffClerkRelation.setChannelCode(infoDTO.getChannelCode());
staffClerkRelation.setClerkCode(clerkRelation.getClerkCode());
......@@ -123,11 +123,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public List<StaffClerkRelationDTO> listBindCode(String enterpriseId, Set<String> clerkCodeList) {
return staffClerkRelatinService.listBindCode(enterpriseId,clerkCodeList);
return staffClerkRelatinService.listBindCode(enterpriseId, clerkCodeList);
}
@Override
public List<StaffClerkRelationDTO> listBindCodeByStaffId(List<String> enterpriseIdList, String staffId) {
return staffClerkRelatinService.listBindCodeByStaffId(enterpriseIdList,staffId);
return staffClerkRelatinService.listBindCodeByStaffId(enterpriseIdList, staffId);
}
@Override
......@@ -137,26 +138,26 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return null;
}
List<StaffClerkInfoDTO> infoDTOS = EntityUtil.changeEntityListByJSON(StaffClerkInfoDTO.class, list);
Map<String,String> nameMap=new HashMap<>();
infoDTOS.forEach(infoDTO->{
Map<String, String> nameMap = new HashMap<>();
infoDTOS.forEach(infoDTO -> {
//企业
if (!nameMap.containsKey(infoDTO.getEnterpriseId())) {
EnterpriseDTO enterpriseDTO = enterpriseService.getEnterpriseById(infoDTO.getEnterpriseId());
if (null != enterpriseDTO) {
nameMap.put(infoDTO.getEnterpriseId(),enterpriseDTO.getEnterpriseName());
}else{
nameMap.put(infoDTO.getEnterpriseId(),"未知商户");
nameMap.put(infoDTO.getEnterpriseId(), enterpriseDTO.getEnterpriseName());
} else {
nameMap.put(infoDTO.getEnterpriseId(), "未知商户");
}
}
//门店店员名称
if (!nameMap.containsKey(infoDTO.getClerkId())) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(infoDTO.getClerkId());
if (null != clerkDTO) {
nameMap.put(infoDTO.getClerkId(),clerkDTO.getClerkName());
nameMap.put(infoDTO.getStoreId(),clerkDTO.getStoreName());
nameMap.put(infoDTO.getClerkId(), clerkDTO.getClerkName());
nameMap.put(infoDTO.getStoreId(), clerkDTO.getStoreName());
infoDTO.setClerkPhoneNumber(clerkDTO.getPhoneNumber());
}else{
nameMap.put(infoDTO.getEnterpriseId(),"未知店员");
} else {
nameMap.put(infoDTO.getEnterpriseId(), "未知店员");
}
}
......@@ -164,9 +165,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
if (!nameMap.containsKey(infoDTO.getStoreId())) {
StoreDTO storeDTO = storeService.getStore(infoDTO.getStoreId());
if (null != storeDTO) {
nameMap.put(infoDTO.getStoreId(),storeDTO.getStoreName());
}else{
nameMap.put(infoDTO.getStoreId(),"未知门店");
nameMap.put(infoDTO.getStoreId(), storeDTO.getStoreName());
} else {
nameMap.put(infoDTO.getStoreId(), "未知门店");
}
}
......@@ -178,11 +179,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
@Override
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO,String optStaffId,int chanelCode) {
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int chanelCode) {
logger.info("绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO));
ServiceResponse<Object> response = new ServiceResponse<>();
StaffClerkRelationDTO relationDTO = staffClerkRelatinService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId());
if (null!=relationDTO) {
if (null != relationDTO) {
response.setCode(2);
response.setMessage("已经被绑定,不能绑定");
return response;
......@@ -203,46 +204,48 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
}
}
StaffClerkRelationDTO storeHasBind = staffClerkRelatinService.getOneBindByStoreId(staffClerkRelationDTO.getStaffId(), staffClerkRelationDTO.getStoreId());
if (storeHasBind!=null) {
if (storeHasBind != null) {
response.setCode(3);
response.setMessage("该导购已在该门店下有其它成员绑定");
return response;
}
String relationId = staffClerkRelatinService.bind(staffClerkRelationDTO,optStaffId,chanelCode);
String relationId = staffClerkRelatinService.bind(staffClerkRelationDTO, optStaffId, chanelCode);
response.setResult(relationId);
return response;
}
@Override
public StaffClerkRelationDTO getByCodeAndEnterpriseId(String clerkCode, String enterpriseId) {
return staffClerkRelatinService.getByCodeAndEnterpriseId(clerkCode,enterpriseId);
return staffClerkRelatinService.getByCodeAndEnterpriseId(clerkCode, enterpriseId);
}
@Override
public String delByStoreIdAndCode(String storeId, String clerkCode) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getByCodeAndStoreId(clerkCode, storeId);
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId,clerkCode);
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode);
delSetMainStore(staffClerkRelation);
return null;
}
@Override
public List<StaffClerkRelationDTO> listByClerkIds(List<String> clerkIds) {
if(clerkIds == null || clerkIds.isEmpty()){
if (clerkIds == null || clerkIds.isEmpty()) {
return Collections.EMPTY_LIST;
}
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds);
if(CollectionUtil.isEmpty(list)){
if (CollectionUtil.isEmpty(list)) {
return new ArrayList<StaffClerkRelationDTO>();
}
List<StaffClerkRelationDTO> result = EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
return result;
}
@Override
public List<StaffClerkRelationDTO> listByStoreId(String storeId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByStoreId(storeId);
if(CollectionUtil.isEmpty(list)){
if (CollectionUtil.isEmpty(list)) {
return new ArrayList<StaffClerkRelationDTO>();
}
List<StaffClerkRelationDTO> result = EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
......@@ -251,98 +254,92 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public boolean unbindByStaffAndClerkId(String staffId, String clerkId) {
boolean b = staffClerkRelatinService.delBind(clerkId,staffId, ChannelCodeEnum.ADMIN_UNBIND.getCode());
return b;
return staffClerkRelatinService.delBind(clerkId, staffId, ChannelCodeEnum.ADMIN_UNBIND.getCode());
}
@Override
public StaffClerkRelationDTO getOneByClerkId(String clerkId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
StaffClerkRelationDTO result = EntityUtil.changeEntityByJSON(StaffClerkRelationDTO.class, tab);
return result;
}
@Override
public StaffClerkRelationDTO getByClerkId(String clerkId) {
StaffClerkRelationDTO staffRelation = staffClerkRelatinService.getByClerkId(clerkId);
return staffRelation;
}
@Override
public StaffClerkRelationDTO getOneByStoreIdAndStaffId(String storeId,
String staffId) {
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId,staffId);
if(tab == null){
TabHaobanStaffClerkRelation tab = tabHaobanStaffClerkRelationMapper.getOneByStoreIdAndStaffId(storeId, staffId);
if (tab == null) {
return null;
}
StaffClerkRelationDTO dto = EntityUtil.changeEntity(StaffClerkRelationDTO.class, tab);
return dto;
return EntityUtil.changeEntity(StaffClerkRelationDTO.class, tab);
}
@Override
public void delAndInsert(StaffClerkRelationDTO staffClerkRelation,String optStaffId,int chanelCode) {
if(StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())){
public void delAndInsert(StaffClerkRelationDTO staffClerkRelation, String optStaffId, int chanelCode) {
if (StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())) {
TabHaobanStaffClerkRelation oldStaffClerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
staffClerkBindLogService.pushToMq(oldStaffClerkRelation.getStaffId(),optStaffId, BindTypeEnum.UNBIND.getVal(),chanelCode,staffClerkRelation.getStaffClerkRelationId());
staffClerkBindLogService.pushToMq(oldStaffClerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), chanelCode, staffClerkRelation.getStaffClerkRelationId());
clerkMainStoreRelatedService.delMainStore(oldStaffClerkRelation.getStaffId(), oldStaffClerkRelation.getStoreId(), oldStaffClerkRelation.getWxEnterpriseId());
}
String relationId = staffClerkRelatinService.insert(staffClerkRelation);
staffClerkBindLogService.pushToMq(staffClerkRelation.getStaffId(),optStaffId, BindTypeEnum.BIND.getVal(),chanelCode,relationId);
staffClerkBindLogService.pushToMq(staffClerkRelation.getStaffId(), optStaffId, BindTypeEnum.BIND.getVal(), chanelCode, relationId);
//设置主门店
clerkMainStoreRelatedService.getMainStoreByStaffId(staffClerkRelation.getStaffId(), staffClerkRelation.getWxEnterpriseId());
}
@Override
public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation);
}
@Override
public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId,String wxUserId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId,wxUserId);
public List<StaffClerkRelationDTO> listByEnterpriseIdAndWxUserId(String enterpriseId, String wxUserId) {
List<TabHaobanStaffClerkRelation> list = tabHaobanStaffClerkRelationMapper.listByEnterpriseIdAndWxUserId(enterpriseId, wxUserId);
return EntityUtil.changeEntityListByJSON(StaffClerkRelationDTO.class, list);
}
@Override
public Page<StaffClerkBindLogDetailDTO> pageStaffClerkBindLog(String wxEnterpriseId, String search, String enterpriseId, int optType, BasePageInfo pageInfo) {
List<TabHaobanWxEnterpriseRelated> wxEnterpriseRelateds = wxEnterpriseRelatedService.getByWxEnterpriseId(wxEnterpriseId);
if (CollectionUtils.isEmpty(wxEnterpriseRelateds)) {
logger.info("没有关联企业");
return null;
}
List<String> enterpriseList = wxEnterpriseRelateds.stream().map(TabHaobanWxEnterpriseRelated::getEnterpriseId)
.filter(eid->{
.filter(eid -> {
if (StringUtils.isBlank(enterpriseId)) {
return true;
}else if (enterpriseId.equals(eid)) {
return true;
}else{
return false;
} else {
return enterpriseId.equals(eid);
}
}).collect(Collectors.toList());
if (CollectionUtils.isEmpty(enterpriseList)) {
logger.info("没有有效的企业");
return null;
}
List<String> clerkIds=null;
// if (StringUtils.isNotBlank(search)) {
// List<ClerkDTO> clerk = clerkNewService.listClerkByEnterpriseIdAndSearch(enterpriseList, search);
// if (CollectionUtils.isEmpty(clerk)) {
// logger.info("没有搜索到相应信息");
// return new Page<StaffClerkBindLogDetailDTO>();
// }
// clerkIds = clerk.stream().map(ClerkDTO::getClerkId).collect(Collectors.toList());
// }
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageBindLog(wxEnterpriseId, clerkIds, null, enterpriseList, optType,search, pageInfo);
List<String> clerkIds = null;
Page<StaffClerkBindLogDetailDTO> retList = staffClerkBindLogService.pageBindLog(wxEnterpriseId, clerkIds, null, enterpriseList, optType, search, pageInfo);
if (CollectionUtils.isNotEmpty(retList.getResult())) {
retList.getResult().forEach(staffClerkBindLogDetailDTO -> {
TabHaobanStaff haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getStaffId());
if (null !=haobanStaff) {
if (null != haobanStaff) {
staffClerkBindLogDetailDTO.setStaffName(haobanStaff.getStaffName());
staffClerkBindLogDetailDTO.setWxUserId(haobanStaff.getWxUserId());
}else{
} else {
staffClerkBindLogDetailDTO.setStaffName("未知成员");
}
if ("-1".equals(staffClerkBindLogDetailDTO.getOptStaffId())) {
staffClerkBindLogDetailDTO.setOptStaffName("系统");
}else {
} else {
haobanStaff = staffService.selectById(staffClerkBindLogDetailDTO.getOptStaffId());
if (null != haobanStaff) {
staffClerkBindLogDetailDTO.setOptStaffName(haobanStaff.getStaffName());
......@@ -363,24 +360,24 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public void pushToBindLog(String staffId, String optStaffId, int optType, int channelCode, String relationId) {
staffClerkBindLogService.pushToMq(staffId,optStaffId,optType,channelCode,relationId);
staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId);
}
private void setMainStore(StaffClerkRelationDTO staffClerkRelation){
if(staffClerkRelation == null){
private void setMainStore(StaffClerkRelationDTO staffClerkRelation) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
return;
}
String staffId = staffClerkRelation.getStaffId();
String wxEnterpriseId = staffClerkRelation.getWxEnterpriseId();
List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
if(list != null && list.size() == 1){
if (list != null && list.size() == 1) {
clerkMainStoreRelatedService.setMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
}
}
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation){
if(staffClerkRelation == null){
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation) {
if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空");
return;
}
......@@ -389,29 +386,21 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
externalClerkRelatedService.delByClerkIdAndStaffId(staffClerkRelation.getClerkId(), staffId);
//删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
// TabHaobanClerkMainStoreRelated r = clerkMainStoreRelatedService.selectByWxEnterpriseIdAndStoreId(staffId, wxEnterpriseId);
// r.setStatusFlag(0);
// clerkMainStoreRelatedService.update(r);
// List<StaffClerkRelationDTO> list = staffClerkRelatinService.lisByStaffId(wxEnterpriseId, staffId);
// if(list != null && list.size() >= 1){
// clerkMainStoreRelatedService.setMainStore(staffId, list.get(list.size()-1).getStoreId(), wxEnterpriseId);
// }
}
@Override
public ServiceResponse<String> getClerkMemberChatConfig(String clerkId) {
ServiceResponse response=new ServiceResponse();
ServiceResponse response = new ServiceResponse();
StaffClerkRelationDTO relationDTO = staffClerkRelatinService.getByClerkId(clerkId);
if (null == relationDTO) {
logger.info("导购没有关联企业微信:{}",clerkId);
logger.info("导购没有关联企业微信:{}", clerkId);
response.setCode(2);
response.setMessage("导购没有关联企业微信");
return response;
}
MemberClerkChatConfig chatConfig = staffClerkRelatinService.getChatConfig(relationDTO.getStaffId(), "-1");
if (chatConfig!=null) {
if (chatConfig != null) {
response.setResult(chatConfig.getConfigId());
return response;
}
......@@ -426,15 +415,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(relationDTO.getWxEnterpriseId(), SecretTypeEnum.HAOBAN_HELP.getVal());
if (null == secretSetting||secretSetting.getCheckFlag()==0) {
logger.info("没有配置secret:{}",relationDTO.getWxEnterpriseId());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
logger.info("没有配置secret:{}", relationDTO.getWxEnterpriseId());
response.setCode(3);
response.setMessage("企业微信配置异常");
return response;
}
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(relationDTO.getWxEnterpriseId());
String configId = qywxUserApiService.getExternalcontactByUserId(enterpriseDTO.getCorpid(), secretSetting.getSecretVal(), send);
logger.info("configId:{}",configId);
logger.info("configId:{}", configId);
if (StringUtils.isBlank(configId)) {
logger.info("staff:{}", configId, JSONObject.toJSONString(relationDTO));
response.setCode(4);
......@@ -454,6 +443,11 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override
public Page<StaffClerkRelationDTO> pageByWxEnterpriseId(String wxEnterpriseId, BasePageInfo pageInfo) {
return staffClerkRelatinService.pageByWxEnterpriseId(wxEnterpriseId,pageInfo);
return staffClerkRelatinService.pageByWxEnterpriseId(wxEnterpriseId, pageInfo);
}
@Override
public List<StaffClerkRelationDTO> listAll() {
return staffClerkRelatinService.listAll();
}
}
......@@ -233,12 +233,11 @@
<update id="delByStoreIdAndCode" >
update tab_haoban_staff_clerk_relation
set
status_flag = 0,
set status_flag = 0,
update_time = now()
where clerk_code = #{clerkCode,jdbcType=VARCHAR}
and store_id = #{storeId,jdbcType=VARCHAR}
and status_flag =1
and status_flag = 1
</update>
<select id="listByClerkIds" resultMap="BaseResultMap" parameterType="java.lang.String" >
......@@ -426,13 +425,24 @@
</update>
<select id="listBindStoreIdByEnterpriseId" resultMap="BaseResultMap">
select
store_id,
select store_id,
wx_enterprise_id
from tab_haoban_staff_clerk_relation
where
enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag =1
where enterprise_id = #{wxEnterpriseId,jdbcType=VARCHAR}
and status_flag = 1
group by store_id
</select>
<select id="listAll" resultType="com.gic.haoban.manage.api.dto.StaffClerkRelationDTO">
SELECT a.store_id,
a.staff_id,
a.clerk_id,
b.staff_name,
c.store_name
FROM tab_haoban_staff_clerk_relation a
LEFT JOIN tab_haoban_staff b ON b.staff_id = a.staff_id
LEFT JOIN tab_gic_clerk c ON c.clerk_id = a.clerk_id
WHERE a.status_flag = 1
GROUP BY a.staff_id
</select>
</mapper>
\ No newline at end of file
......@@ -303,20 +303,23 @@ public class StoreController extends WebBaseController{
//获取门店详情
public boolean isEnterpriseOver(String storeId) {
StoreDTO store = storeService.getStore(storeId);
if(store == null){
if (store == null) {
return true;
}
EnterpriseDTO enterprise = enterpriseService.getEnterpriseByEid(store.getEnterpriseId());
EnterpriseDTO enterprise = enterpriseService.getEnterpriseById(store.getEnterpriseId());
if (enterprise == null || enterprise.getStatus() != 1) {
return true;
}
if (enterprise.getExpireTime() == null) {
if (enterprise.getEnabledState() == null) {
return false;
} else return enterprise.getEnabledState() != 1;
} else
} else {
return enterprise.getEnabledState() != 1;
}
} else {
return enterprise.getExpireTime().getTime() <= System.currentTimeMillis() || enterprise.getEnabledState() != 1;
}
}
}
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