Commit 9b8a0a30 by 墨竹

fix:导购删除增加日志

parent 36a4c852
package com.gic.haoban.manage.service.service.out.impl; package com.gic.haoban.manage.service.service.out.impl;
import java.util.ArrayList; import cn.hutool.core.collection.CollectionUtil;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
import org.apache.commons.collections.CollectionUtils;
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 com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.gic.api.base.commons.Page; import com.gic.api.base.commons.Page;
...@@ -27,12 +14,7 @@ import com.gic.enterprise.api.service.EnterpriseService; ...@@ -27,12 +14,7 @@ import com.gic.enterprise.api.service.EnterpriseService;
import com.gic.enterprise.api.service.StoreService; import com.gic.enterprise.api.service.StoreService;
import com.gic.haoban.base.api.common.BasePageInfo; import com.gic.haoban.base.api.common.BasePageInfo;
import com.gic.haoban.base.api.common.ServiceResponse; import com.gic.haoban.base.api.common.ServiceResponse;
import com.gic.haoban.manage.api.dto.AuditDTO; import com.gic.haoban.manage.api.dto.*;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogDetailDTO;
import com.gic.haoban.manage.api.dto.StaffClerkBindLogInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkInfoDTO;
import com.gic.haoban.manage.api.dto.StaffClerkRelationDTO;
import com.gic.haoban.manage.api.dto.WxEnterpriseQwDTO;
import com.gic.haoban.manage.api.dto.qdto.ClerkSyncQDTO; import com.gic.haoban.manage.api.dto.qdto.ClerkSyncQDTO;
import com.gic.haoban.manage.api.enums.AuditType; import com.gic.haoban.manage.api.enums.AuditType;
import com.gic.haoban.manage.api.enums.BindTypeEnum; import com.gic.haoban.manage.api.enums.BindTypeEnum;
...@@ -46,21 +28,22 @@ import com.gic.haoban.manage.service.entity.MemberClerkChatConfig; ...@@ -46,21 +28,22 @@ import com.gic.haoban.manage.service.entity.MemberClerkChatConfig;
import com.gic.haoban.manage.service.entity.TabHaobanStaff; import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkBindLog;
import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation; import com.gic.haoban.manage.service.entity.TabHaobanStaffClerkRelation;
import com.gic.haoban.manage.service.service.ClerkMainStoreRelatedService; import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.ExternalClerkRelatedService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkBindLogService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.service.hm.HmQrcodeService; import com.gic.haoban.manage.service.service.hm.HmQrcodeService;
import com.gic.haoban.manage.service.task.RouterConstant; import com.gic.haoban.manage.service.task.RouterConstant;
import com.gic.haoban.task.api.dto.MqMessageQo; import com.gic.haoban.task.api.dto.MqMessageQo;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO; import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactDTO;
import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactResultDTO; import com.gic.wechat.api.dto.qywx.welcome.QywxExternalcontactResultDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import org.apache.commons.collections.CollectionUtils;
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 cn.hutool.core.collection.CollectionUtil; import java.util.*;
import java.util.stream.Collectors;
@Service @Service
public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService { public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiService {
...@@ -96,9 +79,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -96,9 +79,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Autowired @Autowired
private HmClerkRelationApiService hmClerkRelationApiService; private HmClerkRelationApiService hmClerkRelationApiService;
@Autowired @Autowired
private HmQrcodeService hmQrcodeService ; private HmQrcodeService hmQrcodeService;
@Autowired @Autowired
private Config config ; private Config config;
@Override @Override
public void bindLogMq(String params) { public void bindLogMq(String params) {
...@@ -118,13 +101,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -118,13 +101,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
String clerkName = null; String clerkName = null;
if (null != clerkDTO) { if (null != clerkDTO) {
phoneNumber = clerkDTO.getPhoneNumber(); phoneNumber = clerkDTO.getPhoneNumber();
clerkName = clerkDTO.getClerkName() ; clerkName = clerkDTO.getClerkName();
} }
String operClerkId = infoDTO.getOptStaffId() ; String operClerkId = infoDTO.getOptStaffId();
clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId()); clerkDTO = clerkService.getClerkByClerkIdNoStatus(clerkRelation.getClerkId());
String operName = null ; String operName = null;
if (null != clerkDTO) { if (null != clerkDTO) {
operName = clerkDTO.getClerkName() ; operName = clerkDTO.getClerkName();
} }
TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog(); TabHaobanStaffClerkBindLog enity = new TabHaobanStaffClerkBindLog();
enity.setClerkId(clerkRelation.getClerkId()); enity.setClerkId(clerkRelation.getClerkId());
...@@ -169,7 +152,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -169,7 +152,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
infoDTO.setBrandName(enterpriseDTO.getBrandName()); infoDTO.setBrandName(enterpriseDTO.getBrandName());
infoDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName()); infoDTO.setEnterpriseName(enterpriseDTO.getEnterpriseName());
} }
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(infoDTO.getClerkId(),-1); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(infoDTO.getClerkId(), -1);
if (null != clerkDTO) { if (null != clerkDTO) {
infoDTO.setClerkPhoneNumber(clerkDTO.getPhoneNumber()); infoDTO.setClerkPhoneNumber(clerkDTO.getPhoneNumber());
infoDTO.setClerkName(clerkDTO.getClerkName()); infoDTO.setClerkName(clerkDTO.getClerkName());
...@@ -233,7 +216,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -233,7 +216,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除绑定关系 //删除绑定关系
tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode); tabHaobanStaffClerkRelationMapper.delByStoreIdAndCode(storeId, clerkCode);
//删除主门店 //删除主门店
delSetMainStore(staffClerkRelation,ChannelCodeEnum.SELF_UNBIND.getCode()); delSetMainStore(staffClerkRelation, ChannelCodeEnum.SELF_UNBIND.getCode());
} }
@Override @Override
...@@ -295,14 +278,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -295,14 +278,14 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
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()); clerkMainStoreRelatedService.delMainStore(oldStaffClerkRelation.getStaffId(), oldStaffClerkRelation.getStoreId(), oldStaffClerkRelation.getWxEnterpriseId());
} }
staffClerkRelationService.bind(staffClerkRelation,optStaffId,chanelCode); staffClerkRelationService.bind(staffClerkRelation, optStaffId, chanelCode);
} }
@Override @Override
public void delByClerkId(String clerkId) { public void delByClerkId(String clerkId) {
TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId); TabHaobanStaffClerkRelation staffClerkRelation = tabHaobanStaffClerkRelationMapper.getOneByClerkId(clerkId);
tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId); tabHaobanStaffClerkRelationMapper.delByClerkId(clerkId);
delSetMainStore(staffClerkRelation,ChannelCodeEnum.AUDIT_UNBIND.getCode()); delSetMainStore(staffClerkRelation, ChannelCodeEnum.AUDIT_UNBIND.getCode());
} }
@Override @Override
...@@ -325,13 +308,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -325,13 +308,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
if ("-1".equals(item.getOptStaffId())) { if ("-1".equals(item.getOptStaffId())) {
item.setOptStaffName("系统"); item.setOptStaffName("系统");
}else { } else {
item.setOptStaffName(item.getOperName()); item.setOptStaffName(item.getOperName());
} }
if(StringUtils.isBlank(item.getOptStaffName())) { if (StringUtils.isBlank(item.getOptStaffName())) {
item.setOptStaffName("未知成员"); item.setOptStaffName("未知成员");
} }
if(StringUtils.isBlank(item.getClerkName())) { if (StringUtils.isBlank(item.getClerkName())) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId()); ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId());
if (null != clerkDTO) { if (null != clerkDTO) {
item.setClerkName(clerkDTO.getClerkName()); item.setClerkName(clerkDTO.getClerkName());
...@@ -361,13 +344,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -361,13 +344,13 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
if ("-1".equals(item.getOptStaffId())) { if ("-1".equals(item.getOptStaffId())) {
item.setOptStaffName("系统"); item.setOptStaffName("系统");
}else { } else {
item.setOptStaffName(item.getOperName()); item.setOptStaffName(item.getOperName());
} }
if(StringUtils.isBlank(item.getOptStaffName())) { if (StringUtils.isBlank(item.getOptStaffName())) {
item.setOptStaffName("未知成员"); item.setOptStaffName("未知成员");
} }
if(StringUtils.isBlank(item.getClerkName())) { if (StringUtils.isBlank(item.getClerkName())) {
ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId()); ClerkDTO clerkDTO = clerkService.getClerkByClerkIdNoStatus(item.getClerkId());
if (null != clerkDTO) { if (null != clerkDTO) {
item.setClerkName(clerkDTO.getClerkName()); item.setClerkName(clerkDTO.getClerkName());
...@@ -384,7 +367,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -384,7 +367,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId); staffClerkBindLogService.pushToMq(staffId, optStaffId, optType, channelCode, relationId);
} }
private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation,Integer channelCode) { private void delSetMainStore(TabHaobanStaffClerkRelation staffClerkRelation, Integer channelCode) {
if (staffClerkRelation == null) { if (staffClerkRelation == null) {
logger.info("staffClerkRelation为空"); logger.info("staffClerkRelation为空");
return; return;
...@@ -396,7 +379,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -396,7 +379,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
//删除主门店 //删除主门店
clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId); clerkMainStoreRelatedService.delMainStore(staffId, staffClerkRelation.getStoreId(), wxEnterpriseId);
//废弃活码 //废弃活码
hmClerkRelationApiService.delByClerkId(clerkId,staffClerkRelation.getEnterpriseId(),wxEnterpriseId,channelCode); hmClerkRelationApiService.delByClerkId(clerkId, staffClerkRelation.getEnterpriseId(), wxEnterpriseId, channelCode);
} }
@Override @Override
...@@ -423,15 +406,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -423,15 +406,15 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
List<String> userIds = new ArrayList<>(); List<String> userIds = new ArrayList<>();
send.setUser(userIds); send.setUser(userIds);
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId()) ; WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(relationDTO.getWxEnterpriseId());
if(qwDTO.needOpenUserId3th()) { if (qwDTO.needOpenUserId3th()) {
userIds.add(relationDTO.getOpenUserId()) ; userIds.add(relationDTO.getOpenUserId());
}else { } else {
userIds.add(relationDTO.getQwUserId()) ; userIds.add(relationDTO.getQwUserId());
} }
QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getDkCorpid() , config.getWxSuiteid() , send); QywxExternalcontactResultDTO configResp = qywxUserApiService.addContactWay(qwDTO.getDkCorpid(), config.getWxSuiteid(), send);
logger.info("configId:{}", JSON.toJSONString(configResp)); logger.info("configId:{}", JSON.toJSONString(configResp));
String configId = configResp.getConfig_id() ; String configId = configResp.getConfig_id();
if (StringUtils.isBlank(configId)) { if (StringUtils.isBlank(configId)) {
logger.info("staff:{}", configId, JSONObject.toJSONString(relationDTO)); logger.info("staff:{}", configId, JSONObject.toJSONString(relationDTO));
response.setCode(4); response.setCode(4);
...@@ -455,8 +438,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -455,8 +438,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@Override @Override
public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId,String staffId) { public List<StaffClerkRelationDTO> listByStaffId(String wxEnterpriseId, String staffId) {
return staffClerkRelationService.listByStaffId(wxEnterpriseId,staffId); return staffClerkRelationService.listByStaffId(wxEnterpriseId, staffId);
} }
@Override @Override
...@@ -466,7 +449,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -466,7 +449,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public void clerkStoreMoveDel(String param) { public void clerkStoreMoveDel(String param) {
logger.info("导购转移删除修改:{}",param); logger.info("导购转移删除修改:{}", param);
if (StringUtils.isBlank(param)) { if (StringUtils.isBlank(param)) {
logger.error("参数为空"); logger.error("参数为空");
return; return;
...@@ -475,25 +458,29 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -475,25 +458,29 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
Integer type = clerkSyncQDTO.getType(); Integer type = clerkSyncQDTO.getType();
String clerkId = clerkSyncQDTO.getClerkId(); String clerkId = clerkSyncQDTO.getClerkId();
String enterpriseId = clerkSyncQDTO.getEnterpriseId(); String enterpriseId = clerkSyncQDTO.getEnterpriseId();
ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId,-1); ClerkDTO clerkDTO = clerkService.getClerkByClerkId(clerkId, -1);
if (clerkDTO == null) { if (clerkDTO == null) {
logger.error("导购为空"); logger.error("导购为空");
return; return;
} }
if (type == 1) { if (type == 1) {
Integer status = clerkDTO.getStatus();
logger.info("导购删除解绑,clerkId:{},status:{}", clerkId, status);
//导购删除解绑 //导购删除解绑
if (!clerkDTO.getStatus().equals(1)) { if (!status.equals(1)) {
//解绑 //解绑
staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode()); staffClerkRelationService.delBind(clerkId, "-1", ChannelCodeEnum.GIC_CLERK_DEL_UNBIND.getCode());
} }
} else if (type == 2) { } else if (type == 2) {
logger.info("门店转移、重新绑定,clerkId:{}", clerkId);
//门店转移、重新绑定 //门店转移、重新绑定
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(clerkDTO.getEnterpriseId(), clerkDTO.getClerkCode()); StaffClerkRelationDTO relationDTO = staffClerkRelationService.getOneBindCodeNoStatus(clerkDTO.getEnterpriseId(), clerkDTO.getClerkCode());
moveOrAddClerk(clerkSyncQDTO,relationDTO); moveOrAddClerk(clerkSyncQDTO, relationDTO);
} else if (type == 3) { } else if (type == 3) {
//店长任务重新分配 //店长任务重新分配
Integer clerkType = clerkDTO.getClerkType(); Integer clerkType = clerkDTO.getClerkType();
logger.info("店长任务重新分配,clerkId:{},clerkType:{}", clerkId, clerkType);
if (clerkType != null && clerkType == 1) { if (clerkType != null && clerkType == 1) {
//发消息处理新增店长,任务重新分配问题 //发消息处理新增店长,任务重新分配问题
try { try {
...@@ -506,10 +493,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -506,10 +493,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, s, GICMQClientUtil.getClientInstance().sendCommonMessage(RouterConstant.ROUTERTYPE, s,
"com.gic.haoban.task.api.service.MqAsynApiService", "run"); "com.gic.haoban.task.api.service.MqAsynApiService", "run");
} catch (Exception e) { } catch (Exception e) {
logger.error("任务重新分配问题发送消息队列出错",e); logger.error("任务重新分配问题发送消息队列出错", e);
} }
} }
hmQrcodeService.updateClerkNameByClerkId(enterpriseId,clerkId,clerkDTO.getClerkName(),clerkDTO.getClerkCode()); hmQrcodeService.updateClerkNameByClerkId(enterpriseId, clerkId, clerkDTO.getClerkName(), clerkDTO.getClerkCode());
} }
} }
......
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