Commit 2fe39e51 by qwmqiuwenmin

fix

parent c2857a60
......@@ -265,9 +265,36 @@ public class MessageApiServiceImpl implements MessageApiService {
private void addUser(QywxCallBackDTO qywxCallBackDTO, TabHaobanStaff staff){
String add = this.staffService.add(staff);
log.info("新增用户返回结果:{}", add);
this.addUserDepart(qywxCallBackDTO, add, staff.getWxEnterpriseId());
TabHaobanWxEnterprise enterprise = this.enterpriseService.getEnterpriseBycorpId(qywxCallBackDTO.getAuthCorpId());
StaffDTO staffDTO = staffApiService.selectByUserId(staff.getWxUserId());
String[] departArr = qywxCallBackDTO.getDepartment();
String departmentIds = "";
for(String s : departArr){
TabHaobanDepartment department = this.departmentService.getByWxId(s, enterprise.getWxEnterpriseId());
if(department == null){
log.info("部门不存在");
continue;
}
departmentIds += department.getDepartmentId() + ",";
}
departmentIds = departmentIds.substring(0,departmentIds.length() - 1);
if(staffDTO == null){
staffApiService.add(EntityUtil.changeEntityByJSON(StaffDTO.class, staff), departmentIds);
}else{
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staff.getStaffId());
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : list) {
if(!departmentIds.contains(tabHaobanStaffDepartmentRelated.getDepartmentId())){
departmentIds += tabHaobanStaffDepartmentRelated.getDepartmentId() + ",";
}
if(departmentIds.endsWith(",")){
departmentIds = departmentIds.substring(0,departmentIds.length() - 1);
}
}
staffApiService.staffEdit(EntityUtil.changeEntityByJSON(StaffDTO.class, staff), departmentIds);
}
// String add = this.staffService.add(staff);
// log.info("新增用户返回结果:{}", add);
// this.addUserDepart(qywxCallBackDTO, add, staff.getWxEnterpriseId());
}
private void addUserDepart(QywxCallBackDTO qywxCallBackDTO, String staffId, String wxEnterpriseId){
......
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