feat(用户): 添加企业微信用户绑定时的余额初始化功能
在绑定企业微信用户时自动创建用户余额记录,默认初始余额为1000。修改了BindWxMpUserCommand以包含corpid字段,并在Ab98UserApplicationService中新增createAb98UserBalance方法实现余额初始化逻辑。
This commit is contained in:
parent
ca62ab0ae9
commit
52d1aea9f0
|
|
@ -227,6 +227,7 @@ public class Ab98UserApplicationService {
|
|||
model.insert();
|
||||
ab98UserEntity = model.selectById();
|
||||
saveQyUserInfoByAb98(qyUser, ab98UserEntity);
|
||||
createAb98UserBalance(ab98UserEntity.getAb98UserId(), qyUser.getCorpid(), 1000L);
|
||||
return ab98UserEntity;
|
||||
}
|
||||
}
|
||||
|
|
@ -268,4 +269,19 @@ public class Ab98UserApplicationService {
|
|||
sysUser.updateById();
|
||||
}
|
||||
}
|
||||
|
||||
public void createAb98UserBalance(Long ab98UserId, String corpid, Long defaultBalance) {
|
||||
UserBalanceEntity ab98UserBalanceEntity = userBalanceService.getByCorpidAndAb98UserId(corpid, ab98UserId);
|
||||
if (ab98UserBalanceEntity != null) {
|
||||
return;
|
||||
}
|
||||
ab98UserBalanceEntity = new UserBalanceEntity();
|
||||
ab98UserBalanceEntity.setAb98UserId(ab98UserId);
|
||||
ab98UserBalanceEntity.setCorpid(corpid);
|
||||
ab98UserBalanceEntity.setBalanceLimit(defaultBalance);
|
||||
ab98UserBalanceEntity.setBalance(defaultBalance);
|
||||
ab98UserBalanceEntity.setUseBalance(0L);
|
||||
ab98UserBalanceEntity.initBaseEntity();
|
||||
userBalanceService.insertOrUpdate(ab98UserBalanceEntity);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,6 +4,8 @@ import lombok.Data;
|
|||
|
||||
@Data
|
||||
public class BindWxMpUserCommand {
|
||||
private String corpid;
|
||||
|
||||
private String dynamicCode;
|
||||
|
||||
private String name;
|
||||
|
|
|
|||
|
|
@ -344,6 +344,8 @@ public class WxUserApplicationService {
|
|||
return true;
|
||||
}
|
||||
|
||||
ab98UserApplicationService.createAb98UserBalance(ab98UserEntity.getAb98UserId(), command.getCorpid(), 1000L);
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue