Commit c0737f61 by 墨竹

Merge branch 'feature_03_11' of http://git.gicdev.com/haoban3.0/haoban-manage3.0

parents fc4c3601 34fa8ef6
......@@ -27,15 +27,13 @@ import com.gic.haoban.manage.api.service.DepartmentApiService;
import com.gic.haoban.manage.api.service.StaffApiService;
import com.gic.haoban.manage.service.dao.mapper.StaffDepartmentRelatedMapper;
import com.gic.haoban.manage.service.dao.mapper.StaffMapper;
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.entity.*;
import com.gic.haoban.manage.service.service.*;
import com.gic.haoban.manage.service.util.EmojiFilterUtil;
import com.gic.redis.data.util.RedisUtil;
import com.gic.thirdparty.api.dto.PicUploadResDTO;
import com.gic.thirdparty.api.service.QQCloudPicService;
import com.gic.wechat.api.dto.qywx.QywxNewUseridDTO;
import com.gic.wechat.api.dto.qywx.UserDTO;
import com.gic.wechat.api.service.qywx.QywxUserApiService;
import com.github.pagehelper.PageHelper;
......@@ -100,6 +98,8 @@ public class StaffApiServiceImpl implements StaffApiService {
private SecretSettingService secretSettingService;
@Autowired
private StaffPrivacyUseLogService staffPrivacyUseLogService;
@Autowired
private WxApplicationService wxApplicationService;
@Override
public StaffDTO selectById(String staffId) {
......@@ -367,7 +367,7 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setCode(2);
return res;
}
String corpid = enterpriseDTO.getCorpid();
SecretSettingDTO secretSetting = secretSettingService.getSecretSetting(enterpriseDTO.getWxEnterpriseId(), SecretTypeEnum.HAOBAN_HELP.getVal());
if (null == secretSetting || secretSetting.getCheckFlag() == 0) {
logger.info("没有配置secret:{}", JSONObject.toJSONString(enterpriseDTO));
......@@ -375,7 +375,7 @@ public class StaffApiServiceImpl implements StaffApiService {
res.setCode(4);
return res;
}
UserDTO user = qywxUserApiService.getSelfWorkWxUser(enterpriseDTO.getCorpid(), secretSetting.getSecretVal(), userId);
UserDTO user = qywxUserApiService.getSelfWorkWxUser(corpid, secretSetting.getSecretVal(), userId);
if (null == user) {
logger.info("企业微信用户不存在:{}:{}", wxEnterpriseId, userId);
res.setMessage("企业微信用户不存在");
......@@ -416,6 +416,10 @@ public class StaffApiServiceImpl implements StaffApiService {
if (StringUtils.isNotBlank(qr_code)) {
staff.setQrCode(qr_code);
}
String openUserid = getOpenUserid(userId, corpid);
if (StringUtils.isNotBlank(openUserid)) {
staff.setWxOpenUseId(openUserid);
}
//成员更改或更新
if (StringUtils.isBlank(staff.getStaffId())) {
logger.info("新增成员");
......@@ -432,6 +436,21 @@ public class StaffApiServiceImpl implements StaffApiService {
return res;
}
/**
* 获取wxopenid
* @param userId
* @param corpid
* @return
*/
private String getOpenUserid(String userId, String corpid) {
TabHaobanWxApplication tabHaobanWxApplication = wxApplicationService.selectByCorpId(corpid);
List<QywxNewUseridDTO> qywxNewUseridDTOS = qywxUserApiService.useridToOpenuserid(corpid, tabHaobanWxApplication.getSiteId(), Collections.singletonList(userId));
if (CollectionUtils.isEmpty(qywxNewUseridDTOS)) {
return "";
}
return qywxNewUseridDTOS.get(0).getOpen_userid();
}
private String[] getNationCodeAndPhoneNumber(String phoneNumber) {
String[] arr = new String[2];
if (StringUtils.isBlank(phoneNumber)) {
......
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