Commit cda95f4e by 徐高华

Merge remote-tracking branch 'origin/master_xgh_pendingid' into

developer

Conflicts:
	haoban-manage3-service/src/main/java/com/gic/haoban/manage/service/service/out/impl/StaffApiServiceImpl.java
parents d657d45e 13330710
......@@ -33,7 +33,16 @@ import com.gic.haoban.manage.service.entity.TabHaobanDepartment;
import com.gic.haoban.manage.service.entity.TabHaobanStaff;
import com.gic.haoban.manage.service.entity.TabHaobanStaffDepartmentRelated;
import com.gic.haoban.manage.service.entity.TabHaobanSyncErrorLog;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.service.DepartmentService;
import com.gic.haoban.manage.service.service.SecretSettingService;
import com.gic.haoban.manage.service.service.StaffClerkRelationService;
import com.gic.haoban.manage.service.service.StaffDepartmentRelatedService;
import com.gic.haoban.manage.service.service.StaffPrivacyUseLogService;
import com.gic.haoban.manage.service.service.StaffService;
import com.gic.haoban.manage.service.service.StoreRangeService;
import com.gic.haoban.manage.service.service.SyncErrorLogService;
import com.gic.haoban.manage.service.service.UserLoginLogService;
import com.gic.haoban.manage.service.service.WxEnterpriseService;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.api.dto.PicUploadResDTO;
......@@ -90,8 +99,6 @@ public class StaffApiServiceImpl implements StaffApiService {
@Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Autowired
private WxApplicationService wxApplicationService;
@Autowired
private StoreWidgetService storeWidgetService;
@Autowired
private PowerService powerService;
......@@ -123,6 +130,24 @@ public class StaffApiServiceImpl implements StaffApiService {
@Override
public List<StaffDepartmentRelatedDTO> listStaffDepartmentByStaffId(String staffId) {
List<TabHaobanStaffDepartmentRelated> list = staffDepartmentRelatedService.listStaffDepartmentByStaffId(staffId);
// 如果成员部门为空,修复部门数据
if(CollectionUtils.isEmpty(list)) {
TabHaobanStaff staff = this.staffMapper.selectByPrimaryKey(staffId) ;
String wxEnterpriseId = staff.getWxEnterpriseId() ;
WxEnterpriseQwDTO qwDTO = this.wxEnterpriseService.getQwInfo(wxEnterpriseId) ;
String wxUserId = staff.getWxUserId() ;
if(qwDTO.needOpenUserIdDk()) {
wxUserId = staff.getWxOpenUseId() ;
}
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(qwDTO.getWxEnterpriseId(), SecretTypeEnum.CUSTOMIZED_APP.getVal());
if (null != secretSetting && StringUtils.isNotBlank(secretSetting.getSecretVal())) {
UserDTO user = qywxUserApiService.getSelfWorkWxUser(qwDTO.getDkCorpid(), secretSetting.getSecretVal(), wxUserId);
logger.info("成员详情(代开)={}",JSON.toJSONString(user)) ;
if(null != user.getDepartment()) {
this.staffDepartChange(staff, wxEnterpriseId, user.getDepartment()); ;
}
}
}
return EntityUtil.changeEntityListByJSON(StaffDepartmentRelatedDTO.class, list);
}
......@@ -250,7 +275,7 @@ public class StaffApiServiceImpl implements StaffApiService {
staffService.updateByPrimaryKey(staff);
}
logger.info("staff变更保存:{}", JSONObject.toJSONString(user));
staffDepartChange(staff, wxEnterpriseId, user);
staffDepartChange(staff, wxEnterpriseId, user.getDepartment());
// 返回结果带上员工姓名
res.setResult(staff.getStaffName());
return res;
......@@ -320,9 +345,8 @@ public class StaffApiServiceImpl implements StaffApiService {
return arr;
}
private void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, UserDTO user) {
private void staffDepartChange(TabHaobanStaff staff, String wxEnterpriseId, Integer[] departmentIds) {
//更新部门
Integer[] departmentIds = user.getDepartment();
List<String> wxDepartIds = new ArrayList<>();
for (Integer wDId : departmentIds) {
wxDepartIds.add(wDId.toString());
......@@ -348,12 +372,11 @@ public class StaffApiServiceImpl implements StaffApiService {
StaffDepartmentRelatedDTO dto = new StaffDepartmentRelatedDTO();
dto.setPhoneNumber(staff.getPhoneNumber());
dto.setStaffId(staff.getStaffId());
dto.setStaffName(user.getName());
dto.setStaffName(staff.getStaffName());
dto.setWxEnterpriseId(wxEnterpriseId);
dto.setStatusFlag(1);
dto.setDepartmentId(departmentDTO.getDepartmentId());
dto.setNationCode(staff.getNationCode());
dto.setStaffName(user.getName());
staffDepartmentRelatedService.add(dto);
}
}
......
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