trade: 分销业务后台功能:清除推广员、修改推广员

This commit is contained in:
owen 2023-09-09 01:54:48 +08:00
parent f97c7a0f6e
commit 259734964d
5 changed files with 19 additions and 7 deletions

View File

@ -46,7 +46,7 @@ public class BrokerageUserController {
@Operation(summary = "修改推广员")
@PreAuthorize("@ss.hasPermission('trade:brokerage-user:update-brokerage-user')")
public CommonResult<Boolean> updateBrokerageUser(@Valid @RequestBody BrokerageUserUpdateBrokerageUserReqVO updateReqVO) {
brokerageUserService.updateBrokerageUserId(updateReqVO.getId(), updateReqVO.getBrokerageUserId());
brokerageUserService.updateBrokerageUserId(updateReqVO.getId(), updateReqVO.getBindUserId());
return success(true);
}

View File

@ -17,6 +17,6 @@ public class BrokerageUserUpdateBrokerageUserReqVO {
@Schema(description = "推广员编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "4587")
@NotNull(message = "推广员编号不能为空")
private Long brokerageUserId;
private Long bindUserId;
}

View File

@ -100,4 +100,9 @@ public interface BrokerageUserMapper extends BaseMapperX<BrokerageUserDO> {
return update(null, lambdaUpdateWrapper);
}
default void updateBindUserIdAndBindUserTimeToNull(Long id) {
update(null, new LambdaUpdateWrapper<BrokerageUserDO>()
.eq(BrokerageUserDO::getId, id)
.set(BrokerageUserDO::getBindUserId, null).set(BrokerageUserDO::getBindUserTime, null));
}
}

View File

@ -41,10 +41,10 @@ public interface BrokerageUserService {
/**
* 修改推广员编号
*
* @param id 用户编号
* @param brokerageUserId 推广员编号
* @param id 用户编号
* @param bindUserId 推广员编号
*/
void updateBrokerageUserId(Long id, Long brokerageUserId);
void updateBrokerageUserId(Long id, Long bindUserId);
/**
* 修改推广资格

View File

@ -54,10 +54,17 @@ public class BrokerageUserServiceImpl implements BrokerageUserService {
}
@Override
public void updateBrokerageUserId(Long id, Long brokerageUserId) {
public void updateBrokerageUserId(Long id, Long bindUserId) {
// 校验存在
validateBrokerageUserExists(id);
// TODO @疯狂貌似没实现完
if (bindUserId == null) {
// 清除推广员
brokerageUserMapper.updateBindUserIdAndBindUserTimeToNull(id);
} else {
// 修改推广员
brokerageUserMapper.updateById(new BrokerageUserDO().setId(id)
.setBindUserId(bindUserId).setBindUserTime(LocalDateTime.now()));
}
}
@Override