Commit d0a35e85 by qwmqiuwenmin

fix

parent 9564aa6b
package com.gic.haoban.manage.service.service.out.impl;
import com.alibaba.fastjson.JSON;
import com.gic.commons.util.EntityUtil;
import com.gic.commons.util.GICMQClientUtil;
import com.gic.haoban.base.api.common.Constant;
import com.gic.haoban.common.utils.HaobanResponse;
import com.gic.haoban.manage.api.dto.DepartmentDTO;
import com.gic.haoban.manage.api.dto.GicMessageDTO;
import com.gic.haoban.manage.api.dto.QywxCallBackDTO;
import com.gic.haoban.manage.api.dto.StaffDTO;
import com.gic.haoban.manage.api.dto.StaffDepartmentRelatedDTO;
import com.gic.haoban.manage.api.enums.GicDataType;
import com.gic.haoban.manage.api.enums.GicEditType;
import com.gic.haoban.manage.api.enums.WxEditType;
import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.MessageApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.entity.*;
import com.gic.haoban.manage.service.service.*;
import com.gic.mq.sdk.GicMQClient;
import java.util.List;
import org.apache.commons.lang.StringUtils;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
......@@ -42,6 +48,8 @@ public class MessageApiServiceImpl implements MessageApiService {
private StaffService staffService;
@Autowired
private StaffDepartmentRelatedService staffDepartmentRelatedService;
@Autowired
private StaffApiService staffApiService;
@Override
public void gicMessageReceive(GicMessageDTO gicMessageDTO) {
......@@ -198,9 +206,32 @@ public class MessageApiServiceImpl implements MessageApiService {
staff.setWxUserId(qywxCallBackDTO.getNewUserid());
staff.setStaffId(oldStaff.getStaffId());
log.info("【微信回调更新】staff={}",JSON.toJSONString(staff));
this.staffService.updateByPrimaryKey(staff);
this.staffDepartmentRelatedService.delByUserid(qywxCallBackDTO.getUserid());
this.addUserDepart(qywxCallBackDTO, oldStaff.getStaffId(), enterprise.getWxEnterpriseId());
// this.staffService.updateByPrimaryKey(staff);
// this.staffDepartmentRelatedService.delByUserid(qywxCallBackDTO.getUserid());
// this.addUserDepart(qywxCallBackDTO, oldStaff.getStaffId(), enterprise.getWxEnterpriseId());
String[] departArr = qywxCallBackDTO.getDepartment();
String departmentIds = "";
//部门修改了
if(departArr != null){
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);
}else{
//部门没有修改
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staff.getStaffId());
for (TabHaobanStaffDepartmentRelated tabHaobanStaffDepartmentRelated : list) {
departmentIds += tabHaobanStaffDepartmentRelated.getDepartmentId() + ",";
}
departmentIds = departmentIds.substring(0,departmentIds.length() - 1);
}
staffApiService.staffEdit(EntityUtil.changeEntityByJSON(StaffDTO.class, staff), departmentIds);
}else {
this.addUser(qywxCallBackDTO, staff);
}
......
......@@ -376,7 +376,7 @@ public class StaffApiServiceImpl implements StaffApiService {
index ++;
}
userDTO.setDepartment(wxDepartmentIdArrIntegers);
userDTO.setGender("女");
userDTO.setGender(staffDTO.getSex().toString());
userDTO.setMobile(staffDTO.getPhoneNumber());
userDTO.setName(staffDTO.getStaffName());
userDTO.setUserid(oldStaff.getWxUserId());
......
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