Commit d9db4fd4 by qwmqiuwenmin

fix

parent 7e3463d4
......@@ -174,12 +174,27 @@ public class StaffApiServiceImpl implements StaffApiService {
if(related != null) {
List<TabHaobanStaffDepartmentRelated> relatedList = staffDepartmentRelatedService.listStaffDepartmentByStaffId(related.getStaffId());
//只在当前门店
if(relatedList.size() <= 1) {
//微信接口删除
if(relatedList.size() == 1) {
TabHaobanStaff staff = staffService.selectById(relatedList.get(0).getStaffId());
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(staff.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(staff.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
JSONResponse jp = qywxUserApiService.deleteWorkWxUser(enterpriseDTO.getCorpid(), application.getSiteId(), staff.getWxUserId());
}
}
staffDepartmentRelatedService.del(related);
//走修改流程
}else {
String departmentIds = "";
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : relatedList) {
if(!staffDepartmentStaffRelatedId.equals(tabHaobanStaffDepartmentRelated.getStaffDepartmentRelatedId())) {
departmentIds += tabHaobanStaffDepartmentRelated.getDepartmentId() + ",";
}
}
departmentIds = departmentIds.substring(0,departmentIds.length() - 1);
TabHaobanStaff staff = staffService.selectById(relatedList.get(0).getStaffId());
staffEdit(EntityUtil.changeEntityByJSON(StaffDTO.class, staff), departmentIds);
}
}
......@@ -263,6 +278,28 @@ public class StaffApiServiceImpl implements StaffApiService {
}
}
}
WxEnterpriseDTO enterpriseDTO = wxEnterpriseService.selectById(oldStaff.getWxEnterpriseId());
TabHaobanWxApplication application = wxApplicationService.selectByWxEnterpriseIdAndApplicationType(oldStaff.getWxEnterpriseId(),1);
if(enterpriseDTO != null) {
if(application != null) {
UserDTO userDTO = new UserDTO();
userDTO.setCorpid(enterpriseDTO.getCorpid());
List<Integer> wxDepartmentIdArrIntegers = new ArrayList<Integer>();
String[] departmentIdArr = departmentIds.split(",");
for (String string : departmentIdArr) {
TabHaobanDepartment tabs = departmentService.selectById(string);
wxDepartmentIdArrIntegers.add(Integer.parseInt(tabs.getWxDepartmentId()));
}
userDTO.setDepartment((Integer[]) wxDepartmentIdArrIntegers.toArray());
userDTO.setGender("女");
userDTO.setMobile(staffDTO.getPhoneNumber());
userDTO.setName(staffDTO.getStaffName());
userDTO.setUserid(oldStaff.getWxUserId());
JSONResponse jp = qywxUserApiService.updateWorkWxUser(userDTO, enterpriseDTO.getCorpid(), application.getSiteId());
}
}
}
@Override
......
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