|
|
@@ -180,30 +180,39 @@ public class GroupRelationController {
|
|
|
return GatewayResponse.SUCCESS.newBuilder().toResult(orderDon);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 邀请制绑定账号
|
|
|
+ */
|
|
|
@PutMapping("/update/set/account")
|
|
|
- public Result<String> setAccount(@RequestBody GroupsRelation relation) {
|
|
|
+ public Result<String> setAccount(@RequestBody @Validated InviteBindAccountReq req) {
|
|
|
long userId = StpUserUtil.getLoginIdAsLong();
|
|
|
+ Long relationId = req.getId();
|
|
|
List<Long> userIds = userBindRelationService.getRelationUserIdList(userId, null);
|
|
|
- GroupsRelation re = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
- .eq(GroupsRelation::getId, relation.getId())
|
|
|
+ GroupsRelation relation = relationMapper.selectOne(Wrappers.lambdaQuery(GroupsRelation.class)
|
|
|
+ .eq(GroupsRelation::getId, relationId)
|
|
|
.in(GroupsRelation::getUserId, userIds)
|
|
|
.last(" limit 1"));
|
|
|
- if (re == null) {
|
|
|
+ if (relation == null) {
|
|
|
throw new BusinessRuntimeException("该车票不存在,请联系客服.");
|
|
|
}
|
|
|
+ String account = req.getAccount();
|
|
|
+ String password = req.getPassword();
|
|
|
+ String contact = req.getContact();
|
|
|
+ String bpVerifyCode = req.getBpVerifyCode();
|
|
|
LambdaUpdateWrapper<GroupsRelation> updateWrapper = Wrappers.lambdaUpdate(GroupsRelation.class)
|
|
|
- .set(GroupsRelation::getAccount, relation.getAccount())
|
|
|
- .set(GroupsRelation::getPassword, relation.getPassword())
|
|
|
- .set(GroupsRelation::getContact, relation.getContact())
|
|
|
- .eq(GroupsRelation::getId, relation.getId());
|
|
|
- if (re.getRechargeStatus() != null) {
|
|
|
- if (re.getRechargeStatus() == GroupsRelation.RechargeStatus.complete) {
|
|
|
+ .set(GroupsRelation::getAccount, account)
|
|
|
+ .set(GroupsRelation::getPassword, password)
|
|
|
+ .set(GroupsRelation::getContact, contact)
|
|
|
+ .set(GroupsRelation::getBpVerifyCode, bpVerifyCode)
|
|
|
+ .eq(GroupsRelation::getId, relationId);
|
|
|
+ if (relation.getRechargeStatus() != null) {
|
|
|
+ if (relation.getRechargeStatus() == GroupsRelation.RechargeStatus.complete) {
|
|
|
throw BusinessRuntimeException.getInstance("代充账号已充值");
|
|
|
}
|
|
|
- if (StrUtil.isEmpty(relation.getAccount())) {
|
|
|
+ if (StrUtil.isEmpty(account)) {
|
|
|
throw BusinessRuntimeException.getInstance("请输入正确的账号信息");
|
|
|
}
|
|
|
- if (re.getRechargeStatus() == GroupsRelation.RechargeStatus.error) {
|
|
|
+ if (relation.getRechargeStatus() == GroupsRelation.RechargeStatus.error) {
|
|
|
updateWrapper.set(GroupsRelation::getRechargeStatus, GroupsRelation.RechargeStatus.waiting);
|
|
|
}
|
|
|
relationMapper.update(relation, updateWrapper);
|