|
@@ -163,20 +163,28 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
|
|
|
throw new StatusException("学生信息不存在");
|
|
|
}
|
|
|
|
|
|
- if (StringUtils.isNotEmpty(stu.getOpenId())) {
|
|
|
- throw new StatusException("微信账号已绑定");
|
|
|
- }
|
|
|
-
|
|
|
if (StringUtils.isEmpty(req.getOpenId())) {
|
|
|
throw new StatusException("微信OID不能为空");
|
|
|
}
|
|
|
|
|
|
+ LambdaQueryWrapper<StudentEntity> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(StudentEntity::getApplyTaskId, stu.getApplyTaskId());
|
|
|
+ wrapper.eq(StudentEntity::getOpenId, req.getOpenId());
|
|
|
+ if (count(wrapper) > 0) {
|
|
|
+ throw new StatusException("微信号已被其他账号绑定");
|
|
|
+ }
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(stu.getOpenId()) && req.getOpenId().equals(stu.getOpenId())) {
|
|
|
+ log.warn("微信账号已绑定!studentId:{} openId:{} uid:{}", req.getStudentId(), req.getOpenId(), req.getUid());
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
LambdaUpdateWrapper<StudentEntity> updateWrapper = new LambdaUpdateWrapper<>();
|
|
|
updateWrapper.set(StudentEntity::getOpenId, req.getOpenId());
|
|
|
updateWrapper.set(StudentEntity::getUid, req.getUid());
|
|
|
updateWrapper.eq(StudentEntity::getId, req.getStudentId());
|
|
|
this.update(updateWrapper);
|
|
|
- log.info("[WECHAT_BINDING] studentId:{} openId:{} uid:{}", req.getStudentId(), req.getOpenId(), req.getUid());
|
|
|
+ log.warn("微信账号绑定成功!studentId:{} openId:{} uid:{}", req.getStudentId(), req.getOpenId(), req.getUid());
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
@@ -196,7 +204,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
|
|
|
updateWrapper.set(StudentEntity::getUid, null);
|
|
|
updateWrapper.eq(StudentEntity::getId, studentId);
|
|
|
this.update(updateWrapper);
|
|
|
- log.info("[WECHAT_UNBIND] studentId:{} openId:{} uid:{}", stu.getId(), stu.getOpenId(), stu.getUid());
|
|
|
+ log.warn("微信账号解绑成功!studentId:{} openId:{} uid:{}", stu.getId(), stu.getOpenId(), stu.getUid());
|
|
|
}
|
|
|
|
|
|
@Override
|