Commit e2df5bab by 徐高华

导购门店转移

parent 1ffdd123
...@@ -28,6 +28,8 @@ public interface HmClerkRelationApiService { ...@@ -28,6 +28,8 @@ public interface HmClerkRelationApiService {
*/ */
ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId,Integer invokingType); ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId,Integer invokingType);
ServiceResponse delByClerkId(String clerkId,String enterpriseId,String wxEnterpriseId,Integer invokingType , String newClerkId);
/** /**
* 根据导购信息获取hmid * 根据导购信息获取hmid
* *
......
...@@ -22,6 +22,8 @@ public interface StaffClerkRelationService { ...@@ -22,6 +22,8 @@ public interface StaffClerkRelationService {
*/ */
boolean delBind(String clerkId, String optStaffId, int channelCode); boolean delBind(String clerkId, String optStaffId, int channelCode);
boolean delBind(String clerkId, String optStaffId, int channelCode , String newClerkId);
/** /**
* 解绑-删除绑定(门店级别) * 解绑-删除绑定(门店级别)
* *
......
...@@ -79,6 +79,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -79,6 +79,11 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
@Override @Override
public boolean delBind(String oldClerkId, String optStaffId, int channelCode) { public boolean delBind(String oldClerkId, String optStaffId, int channelCode) {
return this.delBind(oldClerkId, optStaffId, channelCode, null) ;
}
@Override
public boolean delBind(String oldClerkId, String optStaffId, int channelCode, String newClerkId) {
TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(oldClerkId); TabHaobanStaffClerkRelation clerkRelation = mapper.getByClerkId(oldClerkId);
if (null == clerkRelation) { if (null == clerkRelation) {
logger.info("老的绑定关联不存在,clerkId={}", oldClerkId); logger.info("老的绑定关联不存在,clerkId={}", oldClerkId);
...@@ -97,7 +102,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService ...@@ -97,7 +102,7 @@ public class StaffClerkRelationServiceImpl implements StaffClerkRelationService
//推入日志 //推入日志
staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, clerkRelation.getStaffClerkRelationId()); staffClerkBindLogService.pushToMq(clerkRelation.getStaffId(), optStaffId, BindTypeEnum.UNBIND.getVal(), channelCode, clerkRelation.getStaffClerkRelationId());
//废弃活码 //废弃活码
hmClerkRelationApiService.delByClerkId(oldClerkId, enterpriseId, clerkRelation.getWxEnterpriseId(), channelCode); hmClerkRelationApiService.delByClerkId(oldClerkId, enterpriseId, clerkRelation.getWxEnterpriseId(), channelCode, newClerkId);
return i > 0; return i > 0;
} }
......
...@@ -163,22 +163,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -163,22 +163,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
@Override @Override
public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int channelCode) { public ServiceResponse bindStaffClerk(StaffClerkRelationDTO staffClerkRelationDTO, String optStaffId, int channelCode) {
logger.info("开始绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO)); logger.info("开始绑定clerk:{}", JSONObject.toJSONString(staffClerkRelationDTO));
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(staffClerkRelationDTO.getClerkId(), staffClerkRelationDTO.getWxEnterpriseId()); String clerkId = staffClerkRelationDTO.getClerkId() ;
String wxEnterpriseId = staffClerkRelationDTO.getWxEnterpriseId() ;
String staffId = staffClerkRelationDTO.getStaffId() ;
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(clerkId, wxEnterpriseId);
if (null != relationDTO) { if (null != relationDTO) {
return ServiceResponse.failure("2", "已经被绑定,不能绑定"); return ServiceResponse.failure("2", "已经被绑定,不能绑定");
} }
AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(staffClerkRelationDTO.getClerkId(), AuditType.CLERK_BIND.getCode()); AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(clerkId, AuditType.CLERK_BIND.getCode());
if (null != auditDTO) { if (null != auditDTO) {
return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定"); return ServiceResponse.failure("4", "该导购已经被被申请绑定,请审核处理后再绑定");
} }
List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId()); List<AuditDTO> list = auditApiService.listByStoreId(staffClerkRelationDTO.getStoreId());
if (CollectionUtils.isNotEmpty(list)) { if (CollectionUtils.isNotEmpty(list)) {
Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet()); Set<String> staffIds = list.stream().map(AuditDTO::getCommitStaffId).collect(Collectors.toSet());
if (staffIds.contains(staffClerkRelationDTO.getStaffId())) { if (staffIds.contains(staffId)) {
return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定"); return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
} }
} }
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffClerkRelationDTO.getStaffId(), staffClerkRelationDTO.getStoreId()); StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffId, staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) { if (storeHasBind != null) {
return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定"); return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
} }
...@@ -189,7 +192,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -189,7 +192,6 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return serviceResponse; return serviceResponse;
} }
} }
String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode); String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode);
return ServiceResponse.success(relationId); return ServiceResponse.success(relationId);
} }
...@@ -504,10 +506,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -504,10 +506,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) { private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) {
//正常的时候 //正常的时候
String oldClerkId = oldRelationDTO.getClerkId() ; String oldClerkId = oldRelationDTO.getClerkId() ;
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode()); this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(),clerkSyncQDTO.getClerkId());
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId()); oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId()); oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
ServiceResponse response = bindStaffClerk(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode()); ServiceResponse response = this.bindStaffClerk(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId()); logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId());
} }
......
...@@ -36,6 +36,12 @@ public class HmClerkRelationApiServiceImpl implements HmClerkRelationApiService ...@@ -36,6 +36,12 @@ public class HmClerkRelationApiServiceImpl implements HmClerkRelationApiService
@Override @Override
public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId, Integer invokingType) { public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId, Integer invokingType) {
return this.delByClerkId(clerkId, enterpriseId, wxEnterpriseId, invokingType, null) ;
}
@Override
public ServiceResponse delByClerkId(String clerkId, String enterpriseId, String wxEnterpriseId,
Integer invokingType, String newClerkId) {
// 单人活码 直接废弃,多人活码,更新 // 单人活码 直接废弃,多人活码,更新
HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId); HmQrcodeBO hmQrcodeBO = hmQrcodeService.queryByClerkId(clerkId, wxEnterpriseId);
if (hmQrcodeBO != null) { if (hmQrcodeBO != null) {
......
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