Commit b3deb6ac authored by 廖旭伟's avatar 廖旭伟

Merge remote-tracking branch 'origin/qionglai' into qionglai

parents fbacf05f e7290ffa
...@@ -113,7 +113,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U ...@@ -113,7 +113,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
} }
data.put("id", userEntity.getId()); data.put("id", userEntity.getId());
if(userEntity!=null) { if (userEntity != null) {
StaffEntity staffEntity = null; StaffEntity staffEntity = null;
if (userEntity.getCustomerId() != null) { if (userEntity.getCustomerId() != null) {
staffEntity = staffService.getCache(userEntity.getCustomerId().toString()); staffEntity = staffService.getCache(userEntity.getCustomerId().toString());
...@@ -181,23 +181,37 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U ...@@ -181,23 +181,37 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
if (ObjectUtils.isEmpty(req.getOpenId())) if (ObjectUtils.isEmpty(req.getOpenId()))
throw new AppException("openId不能为空!"); throw new AppException("openId不能为空!");
StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(req.getPhone()).name(req.getUserName())); StaffEntity staffEntity = staffService.selectOne(new StaffQuery().phoneNumber(req.getPhone()));
if (ObjectUtils.isEmpty(staffEntity)) if (ObjectUtils.isEmpty(staffEntity))
throw new AppException(String.format("系统未找到当前用户,姓名:%s,手机:%s,请联系管理员!", req.getUserName(), req.getPhone())); throw new AppException(String.format("系统未找到当前用户,姓名:%s,手机:%s,请联系管理员!", req.getUserName(), req.getPhone()));
UserQuery userQuery = new UserQuery(); UserQuery userQuery = new UserQuery();
userQuery.setLoginName(req.getUserName());
userEntity = userService.selectOne(userQuery);
if (!ObjectUtils.isEmpty(userEntity))
throw new AppException(String.format("登录用户名已经存在!"));
userQuery = new UserQuery();
userQuery.setCustomerId(staffEntity.getId()); userQuery.setCustomerId(staffEntity.getId());
userEntity = userService.selectOne(userQuery); userEntity = userService.selectOne(userQuery);
if (ObjectUtils.isEmpty(userEntity)) if (ObjectUtils.isEmpty(userEntity))
throw new AppException(String.format("员工未与系统用户绑定,staffId:%s", staffEntity.getId())); throw new AppException(String.format("员工未与系统用户绑定,staffId:%s", staffEntity.getId()));
userEntity.setDingUserId(req.getOpenId()); userEntity.setDingUserId(req.getOpenId());
userEntity.setLoginName(req.getUserName());
// userService.update(userEntity); // userService.update(userEntity);
Map<String, Object> condition = new HashMap<>(1); Map<String, Object> condition = new HashMap<>(1);
condition.put("id", userEntity.getId()); condition.put("id", userEntity.getId());
Map<String, Object> data1 = new HashMap<>(1); /* Map<String, Object> data1 = new HashMap<>(1);
data1.put("dingUserId", req.getOpenId()); data1.put("dingUserId", req.getOpenId());*/
userService.getUserDao().update(data1, condition); UserEntity userData = new UserEntity();
userData.setDingUserId(req.getOpenId());
userData.setLoginName(req.getUserName());
userService.getUserDao().update(userData, condition);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
...@@ -239,7 +253,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U ...@@ -239,7 +253,7 @@ public class DingTalkLoginController extends BaseCRUDJsonBodyMappingController<U
String token = authTokenService.getToken(request); String token = authTokenService.getToken(request);
data.put("id", user.getId()); data.put("id", user.getId());
data.put("token", token); data.put("token", token);
if(userEntity!=null) { if (userEntity != null) {
StaffEntity staffEntity = null; StaffEntity staffEntity = null;
if (userEntity.getCustomerId() != null) { if (userEntity.getCustomerId() != null) {
staffEntity = staffService.getCache(userEntity.getCustomerId().toString()); staffEntity = staffService.getCache(userEntity.getCustomerId().toString());
......
...@@ -150,34 +150,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService { ...@@ -150,34 +150,6 @@ public class SyncUserTaskImpl implements ITaskExcuteService {
} }
} }
private void syncDingDingLocalUserIds() {
try {
List<UserEntity> userList = userService.getCacheList().stream()
.filter(f -> !ObjectUtils.isEmpty(f.getCustomerId()))
.filter(f -> ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
List<UserEntity> updateUserList = userList.stream().map(item -> {
UserEntity userEntity = new UserEntity();
userEntity.setId(item.getId());
StaffEntity staffCache = staffService.getCache(item.getCustomerId().toString());
if (!ObjectUtils.isEmpty(staffCache)) {
userEntity.setDingUserId(staffCache.getWorkNum());
}
userEntity.setUpdateTime(new Date());
userEntity.setUpdateUserId(1L);
return userEntity;
}).filter(f -> !ObjectUtils.isEmpty(f.getDingUserId())).collect(Collectors.toList());
if (!ObjectUtils.isEmpty(updateUserList)) {
log.info("更新用户钉钉id信息数量:{}", updateUserList.size());
userService.getUserDao().updateBatch(updateUserList);
}
} catch (Exception e) {
log.error("同步钉钉usreId失败");
}
}
@Override @Override
public void stopTask(ITask task) throws AppException { public void stopTask(ITask task) throws AppException {
......
...@@ -398,7 +398,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -398,7 +398,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
protected void updateAfter(StaffEntity entity, Context context) throws AppException { protected void updateAfter(StaffEntity entity, Context context) throws AppException {
super.updateAfter(entity, context); super.updateAfter(entity, context);
//更新登录名 /* //更新登录名
UserQuery userQuery = new UserQuery(); UserQuery userQuery = new UserQuery();
userQuery.setCustomerId(entity.getId()); userQuery.setCustomerId(entity.getId());
...@@ -412,7 +412,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -412,7 +412,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
user.setLoginName(PinYinUtils.getHanziPinYin(entity.getName())); user.setLoginName(PinYinUtils.getHanziPinYin(entity.getName()));
userService.getUserDao().update(user, condition); userService.getUserDao().update(user, condition);
} }
*/
} }
@Override @Override
...@@ -772,9 +772,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta ...@@ -772,9 +772,7 @@ public class StaffServiceImpl extends AbstractCRUDCacheServiceImpl<StaffDao, Sta
} }
}); });
} }
} }
log.info("部门{}获取人员信息:{}", deptCode, JSON.toJSONString(collect)); log.info("部门{}获取人员信息:{}", deptCode, JSON.toJSONString(collect));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment