Commit 90458f9e by 墨竹

Merge branch 'master' of http://git.gicdev.com/haoban3.0/haoban-manage3.0 into developer

parents 05677f4f 8a3eac9f
...@@ -123,8 +123,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -123,8 +123,8 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
@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 staffClerkRelationService.listBindCode(wxEnterpriseId,enterpriseId, clerkCodeList); return staffClerkRelationService.listBindCode(wxEnterpriseId, enterpriseId, clerkCodeList);
} }
@Override @Override
...@@ -163,9 +163,10 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -163,9 +163,10 @@ 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) {
ServiceResponse resp = this.bindCheck(staffClerkRelationDTO, optStaffId, channelCode) ; ServiceResponse resp = this.bindCheck(staffClerkRelationDTO, optStaffId, channelCode);
if(null != resp) { if (resp != null && !resp.isSuccess()) {
return resp ; logger.error("不允许绑定:{}", resp.getMessage());
return resp;
} }
String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode); String relationId = staffClerkRelationService.bind(staffClerkRelationDTO, optStaffId, channelCode);
return ServiceResponse.success(relationId); return ServiceResponse.success(relationId);
...@@ -186,30 +187,35 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -186,30 +187,35 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} else { } else {
StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(clerkId, wxEnterpriseId); StaffClerkRelationDTO relationDTO = staffClerkRelationService.getBindByClerkId(clerkId, wxEnterpriseId);
if (null != relationDTO) { if (null != relationDTO) {
logger.info("已经被绑定,不能绑定");
return ServiceResponse.failure("2", "已经被绑定,不能绑定"); return ServiceResponse.failure("2", "已经被绑定,不能绑定");
} }
} }
AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(clerkId, AuditType.CLERK_BIND.getCode(),wxEnterpriseId,enterpriseId); AuditDTO auditDTO = auditApiService.findByBindRelatedIdAndAuditType(clerkId, AuditType.CLERK_BIND.getCode(), wxEnterpriseId, enterpriseId);
if (null != auditDTO) { if (null != auditDTO) {
logger.info("该导购已经被被申请绑定,请审核处理后再绑定");
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(staffId)) { if (staffIds.contains(staffId)) {
logger.info("该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定"); return ServiceResponse.failure("5", "该成员已经已经在该门店下申请了绑定,请审核处理后再绑定");
} }
} }
StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffId, staffClerkRelationDTO.getStoreId()); StaffClerkRelationDTO storeHasBind = staffClerkRelationService.getOneBindByStoreId(staffId, staffClerkRelationDTO.getStoreId());
if (storeHasBind != null) { if (storeHasBind != null) {
logger.info("该导购已在该门店下有其它成员绑定");
return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定"); return ServiceResponse.failure("3", "该导购已在该门店下有其它成员绑定");
} }
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId); List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) { if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购"); return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
} }
return null ; return null;
} }
@Override @Override
...@@ -230,7 +236,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -230,7 +236,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
if (CollectionUtil.isEmpty(clerkIds)) { if (CollectionUtil.isEmpty(clerkIds)) {
return Collections.emptyList(); return Collections.emptyList();
} }
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class,tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds, null)); return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds, null));
} }
@Override @Override
...@@ -238,7 +244,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -238,7 +244,7 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
if (CollectionUtil.isEmpty(clerkIds)) { if (CollectionUtil.isEmpty(clerkIds)) {
return Collections.emptyList(); return Collections.emptyList();
} }
return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class,tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds, wxEnterpriseId)); return EntityUtil.changeEntityListNew(StaffClerkRelationDTO.class, tabHaobanStaffClerkRelationMapper.listByClerkIds(clerkIds, wxEnterpriseId));
} }
@Override @Override
...@@ -299,6 +305,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -299,6 +305,12 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
return serviceResponse; return serviceResponse;
} }
} }
String staffId = staffClerkRelation.getStaffId();
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService.listManageBindByStaffId(staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
logger.info("该导购已绑定区经,不允许绑定导购");
return ServiceResponse.failure("3", "该导购已绑定区经,不允许绑定导购");
}
if (StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())) { if (StringUtils.isNotBlank(staffClerkRelation.getStaffClerkRelationId())) {
TabHaobanStaffClerkRelation oldStaffClerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(staffClerkRelation.getStaffClerkRelationId()); TabHaobanStaffClerkRelation oldStaffClerkRelation = tabHaobanStaffClerkRelationMapper.selectByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId()); tabHaobanStaffClerkRelationMapper.delByPrimaryKey(staffClerkRelation.getStaffClerkRelationId());
...@@ -492,9 +504,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -492,9 +504,9 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
} else if (type == 2) { } else if (type == 2) {
logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId()); logger.info("导购门店转移,新的导购和门店,clerkId={},storeId={}", clerkId, clerkSyncQDTO.getStoreId());
StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByCodeAndEnterpriseId(clerkCode,enterpriseId); StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByCodeAndEnterpriseId(clerkCode, enterpriseId);
if (null == oldRelationDTO) { if (null == oldRelationDTO) {
logger.info("导购未关联成员,clerkCode={}",clerkCode); logger.info("导购未关联成员,clerkCode={}", clerkCode);
return; return;
} }
/* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId); /* StaffClerkRelationDTO oldRelationDTO = staffClerkRelationService.getByClerkId(oldClerkId);
...@@ -534,25 +546,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe ...@@ -534,25 +546,25 @@ public class StaffClerkRelationApiServiceImpl implements StaffClerkRelationApiSe
} }
} }
} }
// 导购门店转移 // 导购门店转移
private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) { private void moveOrAddClerk(ClerkSyncQDTO clerkSyncQDTO, StaffClerkRelationDTO oldRelationDTO) {
boolean flag = false ; boolean flag = false;
if(null != RedisUtil.getCache("clerkMoveFlag2022")) { if (null != RedisUtil.getCache("clerkMoveFlag2022")) {
flag = true ; flag = true;
} }
if(flag) { if (flag) {
String oldClerkId = oldRelationDTO.getClerkId(); String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId()); this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), clerkSyncQDTO.getClerkId());
// 设置新的ID // 设置新的ID
oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId()); oldRelationDTO.setClerkId(clerkSyncQDTO.getClerkId());
oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId()); oldRelationDTO.setStoreId(clerkSyncQDTO.getStoreId());
ServiceResponse response = this.bindCheck(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode()) ; ServiceResponse response = this.bindCheck(oldRelationDTO, "-1", ChannelCodeEnum.SYNC_BIND.getCode());
logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId()); logger.info("绑定结果正常:{},{}", JSONObject.toJSONString(response), oldRelationDTO.getClerkId());
if(response==null) { if (response == null) {
this.staffClerkRelationService.insert(oldRelationDTO) ; this.staffClerkRelationService.insert(oldRelationDTO);
} }
}else { } else {
String oldClerkId = oldRelationDTO.getClerkId(); String oldClerkId = oldRelationDTO.getClerkId();
this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null); this.staffClerkRelationService.delBind(oldClerkId, "-1", ChannelCodeEnum.SYNC_UNBIND.getCode(), null);
// 设置新的ID // 设置新的ID
......
...@@ -1011,7 +1011,7 @@ public class WxStaffController extends WebBaseController { ...@@ -1011,7 +1011,7 @@ public class WxStaffController extends WebBaseController {
List<BindClerkVO> bindList = new ArrayList<>(); List<BindClerkVO> bindList = new ArrayList<>();
List<BindClerkVO> unBindList = new ArrayList<>(); List<BindClerkVO> unBindList = new ArrayList<>();
for (ClerkDTO dto : list) { for (ClerkDTO dto : list) {
BindClerkVO vo = EntityUtil.changeEntityByJSON(BindClerkVO.class, dto); BindClerkVO vo = EntityUtil.changeEntityNew(BindClerkVO.class, dto);
if (bindCodeMap.containsKey(dto.getClerkCode())) { if (bindCodeMap.containsKey(dto.getClerkCode())) {
String staffId = bindCodeMap.get(dto.getClerkCode()).getStaffId(); String staffId = bindCodeMap.get(dto.getClerkCode()).getStaffId();
StaffDTO staffDTO = staffApiService.selectById(staffId); StaffDTO staffDTO = staffApiService.selectById(staffId);
......
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