From 2131e63ed1bfe30a264849d65f7c35231d22ac6a Mon Sep 17 00:00:00 2001 From: wulin Date: Tue, 22 Sep 2020 16:45:25 +0800 Subject: [PATCH] =?UTF-8?q?=E9=92=89=E9=92=89=E5=85=8D=E7=99=BB=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E5=88=A4=E6=96=AD=E6=98=AF=E5=90=A6=E7=A6=BB=E8=81=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/lz/common/utils/DingTalkUtil.java | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) 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("用户不存在"); }