钉钉免登增加判断是否离职

This commit is contained in:
wulin 2020-09-22 16:45:25 +08:00
parent 22fb25d890
commit 2131e63ed1

View File

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