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

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.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("用户不存在");
}