diff --git a/src/main/java/com/lz/common/utils/DingTalkUtil.java b/src/main/java/com/lz/common/utils/DingTalkUtil.java index 45ce1bde..5ad039d0 100644 --- a/src/main/java/com/lz/common/utils/DingTalkUtil.java +++ b/src/main/java/com/lz/common/utils/DingTalkUtil.java @@ -8,6 +8,8 @@ import com.dingtalk.api.DingTalkClient; import com.dingtalk.api.request.*; import com.dingtalk.api.response.*; import com.lz.modules.app.entity.StaffEntity; +import com.lz.modules.app.entity.StaffOccupationEntity; +import com.lz.modules.app.service.StaffOccupationService; import com.lz.modules.app.service.StaffService; import com.lz.modules.job.model.responseBo.DepartmentInfosBo; import com.lz.modules.job.model.responseBo.DepartmentStaffBo; @@ -55,6 +57,9 @@ public class DingTalkUtil { @Autowired private SysUserTokenService sysUserTokenService; + @Autowired + StaffOccupationService staffOccupationService; + CloseableHttpClient getHttpClient(){ @@ -325,20 +330,26 @@ public class DingTalkUtil { if(json.getIntValue("errcode") == 0){ String employeeId = json.getString("userid"); StaffEntity staffEntity = staffService.selectStaffByEmployeeId(employeeId); + if(staffEntity != null){ - //登录操作 - SysUserEntity user = new SysUserEntity(); - user.setPassword(staffEntity.getPassword()); - user.setMobile(staffEntity.getMobile()); - user.setUserId(staffEntity.getId()); - user.setEmail(staffEntity.getEmail()); - user.setSalt(staffEntity.getSalt()); - user.setStatus(1); - user.setType(1); - user.setRealName(staffEntity.getName()); - user.setUsername(staffEntity.getMobile()); - user.setUserNo(staffEntity.getMobile()); - return sysUserTokenService.createTokenSetTokenCode(user, code); + StaffOccupationEntity staffOccupationEntity = + staffOccupationService.getStaffOccupationByStaffId(staffEntity.getId()); + if(staffOccupationEntity != null && staffOccupationEntity.getStaffStatus() == 0){ + //登录操作 + SysUserEntity user = new SysUserEntity(); + user.setPassword(staffEntity.getPassword()); + user.setMobile(staffEntity.getMobile()); + user.setUserId(staffEntity.getId()); + user.setEmail(staffEntity.getEmail()); + user.setSalt(staffEntity.getSalt()); + user.setStatus(1); + user.setType(1); + user.setRealName(staffEntity.getName()); + user.setUsername(staffEntity.getMobile()); + user.setUserNo(staffEntity.getMobile()); + return sysUserTokenService.createTokenSetTokenCode(user, code); + } + } return R.error("用户不存在"); }