|
|
@@ -12,6 +12,7 @@ import com.ningdatech.pmapi.common.constant.RegionConst; |
|
|
|
import com.ningdatech.pmapi.common.helper.RegionCacheHelper; |
|
|
|
import com.ningdatech.pmapi.common.helper.UserInfoHelper; |
|
|
|
import com.ningdatech.pmapi.common.util.BizUtils; |
|
|
|
import com.ningdatech.pmapi.common.util.StrUtils; |
|
|
|
import com.ningdatech.pmapi.ding.constants.DingOrganizationContant; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingEmployeeInfo; |
|
|
|
import com.ningdatech.pmapi.organization.model.entity.DingOrganization; |
|
|
@@ -37,6 +38,7 @@ import com.ningdatech.zwdd.ZwddIntegrationProperties; |
|
|
|
import com.ningdatech.zwdd.client.ZwddClient; |
|
|
|
import com.wflow.workflow.bean.dto.ProcessInstanceUserDto; |
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.aop.framework.AopContext; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
@@ -85,7 +87,7 @@ public class UserInfoManage { |
|
|
|
.like(StringUtils.isNotBlank(phoneNo), UserInfo::getMobile, phoneNo) |
|
|
|
.like(StringUtils.isNotBlank(name), UserInfo::getRealName, name) |
|
|
|
.in(Objects.nonNull(userIdList), UserInfo::getId, userIdList) |
|
|
|
.eq(Objects.nonNull(regionId), UserInfo::getRegionCode,regionId) |
|
|
|
.eq(Objects.nonNull(regionId), UserInfo::getRegionCode, regionId) |
|
|
|
.like(StringUtils.isNotBlank(orgName), UserInfo::getEmpPosUnitName, orgName) |
|
|
|
.eq(StringUtils.isNotBlank(orgCode), UserInfo::getEmpPosUnitCode, orgCode) |
|
|
|
.orderByDesc(UserInfo::getUpdateOn); |
|
|
@@ -188,7 +190,7 @@ public class UserInfoManage { |
|
|
|
* @param userRoleList |
|
|
|
*/ |
|
|
|
private List<Long> getRoleCompliantUserIdList(List<UserRoleVO> userRoleList) { |
|
|
|
if(CollUtil.isNotEmpty(userRoleList)){ |
|
|
|
if (CollUtil.isNotEmpty(userRoleList)) { |
|
|
|
userRoleList = userRoleList.stream().filter(r -> Objects.nonNull(r.getId())).collect(Collectors.toList()); |
|
|
|
} |
|
|
|
if (CollUtil.isEmpty(userRoleList)) { |
|
|
@@ -250,12 +252,21 @@ public class UserInfoManage { |
|
|
|
return userRoleInfoList; |
|
|
|
} |
|
|
|
|
|
|
|
public void disableOrEnable(ReqUserDisableOrEnablePO reqUserDisableOrEnablePO) { |
|
|
|
Long userId = generateUserId(reqUserDisableOrEnablePO.getEmployeeCode()); |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void disableOrEnable(ReqUserDisableOrEnablePO req) { |
|
|
|
Long userId; |
|
|
|
if (req.getUserId() != null) { |
|
|
|
userId = req.getUserId(); |
|
|
|
} else if (StrUtils.isNotBlank(req.getEmployeeCode())) { |
|
|
|
UserInfoManage proxy = (UserInfoManage) AopContext.currentProxy(); |
|
|
|
userId = proxy.generateUserId(req.getEmployeeCode()); |
|
|
|
} else { |
|
|
|
throw BizException.wrap("用户参数缺失"); |
|
|
|
} |
|
|
|
UserInfo userInfo = iUserInfoService.getById(userId); |
|
|
|
userInfo.setAvailable(reqUserDisableOrEnablePO.getOperation()); |
|
|
|
userInfo.setAvailable(req.getOperation()); |
|
|
|
iUserInfoService.updateById(userInfo); |
|
|
|
if (userInfo.getAvailable().equals("DISABLE")) { |
|
|
|
if ("DISABLE".equals(userInfo.getAvailable())) { |
|
|
|
userAuthManage.kickOff(userId); |
|
|
|
} |
|
|
|
|
|
|
@@ -353,24 +364,24 @@ public class UserInfoManage { |
|
|
|
String mobile = userInfo.getMobile(); |
|
|
|
Long userId = userInfo.getId(); |
|
|
|
// if (StringUtils.isBlank(mobile)) { |
|
|
|
// 校验手机号是否重复 |
|
|
|
UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); |
|
|
|
if (Objects.nonNull(repeatMobileUserInfo)) { |
|
|
|
throw new BizException("该手机号码已被绑定,请问重复绑定"); |
|
|
|
} |
|
|
|
|
|
|
|
String phoneNo = reqUserDetailEditPO.getPhoneNo(); |
|
|
|
userInfo.setMobile(phoneNo); |
|
|
|
// 更新浙政钉相关数据 |
|
|
|
if (StringUtils.isNotBlank(phoneNo)) { |
|
|
|
iDingEmployeeInfoService |
|
|
|
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) |
|
|
|
.eq(DingEmployeeInfo::getMainJob, "true") |
|
|
|
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) |
|
|
|
.set(DingEmployeeInfo::getBindUserMobile, phoneNo)); |
|
|
|
iUserInfoService.updateById(userInfo); |
|
|
|
} |
|
|
|
// 校验手机号是否重复 |
|
|
|
UserInfo repeatMobileUserInfo = iUserInfoService.getOne(Wrappers.lambdaQuery(UserInfo.class) |
|
|
|
.eq(UserInfo::getMobile, reqUserDetailEditPO.getPhoneNo()).ne(UserInfo::getId, userId)); |
|
|
|
if (Objects.nonNull(repeatMobileUserInfo)) { |
|
|
|
throw new BizException("该手机号码已被绑定,请问重复绑定"); |
|
|
|
} |
|
|
|
|
|
|
|
String phoneNo = reqUserDetailEditPO.getPhoneNo(); |
|
|
|
userInfo.setMobile(phoneNo); |
|
|
|
// 更新浙政钉相关数据 |
|
|
|
if (StringUtils.isNotBlank(phoneNo)) { |
|
|
|
iDingEmployeeInfoService |
|
|
|
.update(Wrappers.lambdaUpdate(DingEmployeeInfo.class) |
|
|
|
.eq(DingEmployeeInfo::getMainJob, "true") |
|
|
|
.eq(DingEmployeeInfo::getEmployeeCode, employeeCode) |
|
|
|
.set(DingEmployeeInfo::getBindUserMobile, phoneNo)); |
|
|
|
iUserInfoService.updateById(userInfo); |
|
|
|
} |
|
|
|
// } |
|
|
|
|
|
|
|
} |
|
|
@@ -450,13 +461,14 @@ public class UserInfoManage { |
|
|
|
|
|
|
|
//生成头像 链接 |
|
|
|
private String makeAvatar(String avatar) { |
|
|
|
try{ |
|
|
|
try { |
|
|
|
GenericResult<String> accessToken = zwddClient.getAccessToken(); |
|
|
|
String token = accessToken.getData(); |
|
|
|
String res = "https://" + zwddIntegrationProperties.getDomain() + "/media/download?" + |
|
|
|
"access_token=" + token + "&media_id=" + avatar; |
|
|
|
return res; |
|
|
|
}catch (Exception e){} |
|
|
|
} catch (Exception e) { |
|
|
|
} |
|
|
|
return org.apache.commons.lang3.StringUtils.EMPTY; |
|
|
|
} |
|
|
|
|
|
|
|