Commit 6f23fbff by jinxin

删除好办成员时需要删除导购关联关系

parent 226b827d
...@@ -37,7 +37,6 @@ import com.gic.haoban.manage.service.config.Config; ...@@ -37,7 +37,6 @@ 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.StaffMapper; import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
import com.gic.haoban.manage.service.entity.*; import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.errorcode.HaoBanErrCode;
import com.gic.haoban.manage.service.errorcode.QywxErrCode; import com.gic.haoban.manage.service.errorcode.QywxErrCode;
import com.gic.haoban.manage.service.pojo.bo.StaffListBO; import com.gic.haoban.manage.service.pojo.bo.StaffListBO;
import com.gic.haoban.manage.service.service.*; import com.gic.haoban.manage.service.service.*;
...@@ -55,6 +54,7 @@ import com.gic.wechat.api.service.qywx.QywxOrderApiService; ...@@ -55,6 +54,7 @@ import com.gic.wechat.api.service.qywx.QywxOrderApiService;
import com.gic.wechat.api.service.qywx.QywxUserApiService; import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger; import org.slf4j.Logger;
...@@ -281,11 +281,29 @@ public class StaffApiServiceImpl implements StaffApiService { ...@@ -281,11 +281,29 @@ public class StaffApiServiceImpl implements StaffApiService {
phoneNumber = arr[1]; phoneNumber = arr[1];
} }
String openUserid = getOpenUserid(wxUserId, dkCorpid, qwDTO); String openUserid = getOpenUserid(wxUserId, dkCorpid, qwDTO);
TabHaobanStaff staff = staffService.selectByUserIdAndEnterpriseId(wxUserId, openUserid, wxEnterpriseId); TabHaobanStaff staff = new TabHaobanStaff();
if (staff != null) { List<StaffDTO> staffDTOList = staffService.listByUserIdsAndWxEnterpriseId(Lists.newArrayList(wxUserId,openUserid), wxEnterpriseId);
staffService.delOtherStaffByWxUserId(staff.getWxUserId(), staff.getStaffId(), wxEnterpriseId); if (CollUtil.isNotEmpty(staffDTOList) && staffDTOList.size()>1) {
//只保留一个staff
for (int i =0;i<staffDTOList.size()-1;i++){
StaffDTO dto = staffDTOList.get(i);
String staffId = dto.getStaffId();
// 员工解绑
List<StaffClerkRelationDTO> staffClerkRelationDTOS = staffClerkRelationService
.listByStaffId(wxEnterpriseId, staffId);
if (CollectionUtils.isNotEmpty(staffClerkRelationDTOS)) {
for (StaffClerkRelationDTO staffClerkRelationDTO : staffClerkRelationDTOS) {
staffClerkRelationService.delBind(staffId, staffClerkRelationDTO.getClerkId(),
ChannelCodeEnum.ADMIN_UNBIND.getCode(),null, wxEnterpriseId);
}
}
this.staffService.delByStaffId(staffId);
staffDTOList.remove(i);
}
}
if (CollUtil.isNotEmpty(staffDTOList)){
staff = JSONObject.parseObject(JSONObject.toJSONString(staffDTOList.get(0)), TabHaobanStaff.class);
} }
staff = (staff == null ? new TabHaobanStaff() : staff);
staff.setWxUserId(wxUserId); staff.setWxUserId(wxUserId);
if (StringUtils.isNotBlank(openUserid)) { if (StringUtils.isNotBlank(openUserid)) {
staff.setWxOpenUseId(openUserid); staff.setWxOpenUseId(openUserid);
......
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