新增了子账号的功能(初版底层逻辑后期待完善) , 修改了充值待处理短信的发送步骤 , sys_user_expand 增加字段2个 , sub_user_ids varchar 2000 子账号ID集合 , main_user_id varchar 36 子账号关联的主账号ID 。 新增后需要更新sys_user_expand表的相关视图
This commit is contained in:
parent
603d5c8624
commit
dd56d1415f
@ -0,0 +1,104 @@
|
|||||||
|
package cn.com.tenlion.operator.controller.api.user;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
|
||||||
|
@ApiModel
|
||||||
|
public class SubUserDTO {
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "userId",
|
||||||
|
value = "用户ID"
|
||||||
|
)
|
||||||
|
private String userId;
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "username",
|
||||||
|
value = "用户名"
|
||||||
|
)
|
||||||
|
private String username;
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "name",
|
||||||
|
value = "昵称"
|
||||||
|
)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "phone",
|
||||||
|
value = "手机"
|
||||||
|
)
|
||||||
|
private String phone;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "status",
|
||||||
|
value = "状态"
|
||||||
|
)
|
||||||
|
private String status;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "mainUserId",
|
||||||
|
value = "主账号ID"
|
||||||
|
)
|
||||||
|
private String mainUserId;
|
||||||
|
|
||||||
|
@ApiModelProperty(
|
||||||
|
name = "subUserIds",
|
||||||
|
value = "子账号ID集"
|
||||||
|
)
|
||||||
|
private String subUserIds;
|
||||||
|
|
||||||
|
public String getSubUserIds() {
|
||||||
|
return subUserIds == null ? "" : subUserIds.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubUserIds(String subUserIds) {
|
||||||
|
this.subUserIds = subUserIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getStatus() {
|
||||||
|
return status == null ? "" : status.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStatus(String status) {
|
||||||
|
this.status = status;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainUserId() {
|
||||||
|
return mainUserId == null ? "" : mainUserId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainUserId(String mainUserId) {
|
||||||
|
this.mainUserId = mainUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUserId() {
|
||||||
|
return userId == null ? "" : userId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserId(String userId) {
|
||||||
|
this.userId = userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUsername() {
|
||||||
|
return username == null ? "" : username.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUsername(String username) {
|
||||||
|
this.username = username;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name == null ? "" : name.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone == null ? "" : phone.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,130 @@
|
|||||||
|
package cn.com.tenlion.operator.controller.api.user;
|
||||||
|
|
||||||
|
import cn.com.tenlion.operator.controller.api.user.SubUserDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.vos.user.UserRegisterVO;
|
||||||
|
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.exceptions.SaveException;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import ink.wgink.interfaces.role.IRoleBaseService;
|
||||||
|
import ink.wgink.module.sms.manager.VerifyCodeManager;
|
||||||
|
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||||
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
|
import ink.wgink.pojo.result.SuccessResult;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultData;
|
||||||
|
import ink.wgink.service.role.service.IRoleUserService;
|
||||||
|
import ink.wgink.service.user.enums.UserStateEnum;
|
||||||
|
import ink.wgink.service.user.enums.UserTypeEnum;
|
||||||
|
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||||
|
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||||
|
import ink.wgink.service.user.service.IUserService;
|
||||||
|
import ink.wgink.util.RegexUtil;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassName: UserInfoController
|
||||||
|
* Description:
|
||||||
|
* Author: wanggeng
|
||||||
|
* Date: 2024/7/23 上午10:09
|
||||||
|
* Version: 1.0
|
||||||
|
*/
|
||||||
|
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "企业用户创建员工接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.API_PREFIX + "/user-create")
|
||||||
|
public class UserCreateController extends DefaultBaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserService iUserService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleBaseService iRoleBaseService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleUserService iRoleUserService;
|
||||||
|
@Autowired
|
||||||
|
private UserExpandServiceImpl userExpandService;
|
||||||
|
private static final String REGEX_MOBILE_PHONE = "^1[3-9]\\d{9}$";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前账号的主账号ID或子账号ID集
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("get/{userId}")
|
||||||
|
public SubUserDTO get(@PathVariable("userId") String userId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||||
|
UserDTO userDTO = iUserService.get(userId);
|
||||||
|
SubUserDTO dto = new SubUserDTO();
|
||||||
|
dto.setUserId(userDTO.getUserId());
|
||||||
|
dto.setName(userDTO.getUserName());
|
||||||
|
dto.setUsername(userDTO.getUserUsername());
|
||||||
|
dto.setPhone(userDTO.getUserPhone());
|
||||||
|
dto.setStatus(userDTO.getUserState() + "");
|
||||||
|
dto.setMainUserId(userExpandDTO.getMainUserId());
|
||||||
|
dto.setSubUserIds(userExpandDTO.getSubUserIds());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封禁或解禁子账号
|
||||||
|
* @param mainUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("change-status/{mainUserId}/{userId}")
|
||||||
|
public SuccessResult changeStatus(@PathVariable("mainUserId") String mainUserId, @PathVariable("userId") String userId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(mainUserId);
|
||||||
|
if(userExpandDTO.getSubUserIds().contains(userId)) {
|
||||||
|
UserDTO userDTO = iUserService.get(userId);
|
||||||
|
iUserService.updateUserState(userId, userDTO.getUserState().equals(0) ? UserStateEnum.LOCK : UserStateEnum.NORMAL);
|
||||||
|
}
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账号的列表
|
||||||
|
* @param mainUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("list/{mainUserId}")
|
||||||
|
public List<SubUserDTO> list(@PathVariable("mainUserId") String mainUserId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(mainUserId);
|
||||||
|
if(StringUtils.isEmpty(userExpandDTO.getSubUserIds())) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<UserPO> list = iUserService.listPOByUserIds(Arrays.asList(userExpandDTO.getSubUserIds().split(",")));
|
||||||
|
List<SubUserDTO> listData = new ArrayList<>();
|
||||||
|
for(UserPO po : list) {
|
||||||
|
SubUserDTO dto = new SubUserDTO();
|
||||||
|
dto.setUserId(po.getUserId());
|
||||||
|
dto.setName(po.getUserName());
|
||||||
|
dto.setUsername(po.getUserUsername());
|
||||||
|
dto.setPhone(po.getUserPhone());
|
||||||
|
dto.setStatus(po.getUserState() + "");
|
||||||
|
dto.setMainUserId(mainUserId);
|
||||||
|
listData.add(dto);
|
||||||
|
}
|
||||||
|
return listData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账号的创建
|
||||||
|
* @param mainUserId
|
||||||
|
* @param userRegisterVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("register/{mainUserId}")
|
||||||
|
public SuccessResultData<String> register(@PathVariable("mainUserId") String mainUserId, @RequestBody UserRegisterVO userRegisterVO) {
|
||||||
|
String userId = userExpandService.saveSub(mainUserId, userRegisterVO);
|
||||||
|
VerifyCodeManager verifyCodeManager = VerifyCodeManager.getInstance();
|
||||||
|
verifyCodeManager.clearUsedVerifyCode(userRegisterVO.getPhone());
|
||||||
|
return new SuccessResultData<>(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -2,8 +2,10 @@ package cn.com.tenlion.operator.controller.resource.account;
|
|||||||
|
|
||||||
import cn.com.tenlion.operator.pojo.bos.account.AccountBO;
|
import cn.com.tenlion.operator.pojo.bos.account.AccountBO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO;
|
import cn.com.tenlion.operator.pojo.dtos.accountbank.AccountBankDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
||||||
import cn.com.tenlion.operator.service.accountbank.IAccountBankService;
|
import cn.com.tenlion.operator.service.accountbank.IAccountBankService;
|
||||||
|
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
import ink.wgink.common.base.DefaultBaseController;
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
@ -16,6 +18,7 @@ import cn.com.tenlion.operator.pojo.dtos.account.AccountDTO;
|
|||||||
import cn.com.tenlion.operator.pojo.vos.account.AccountVO;
|
import cn.com.tenlion.operator.pojo.vos.account.AccountVO;
|
||||||
import cn.com.tenlion.operator.service.account.IAccountService;
|
import cn.com.tenlion.operator.service.account.IAccountService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -41,6 +44,8 @@ public class AccountResourceController extends DefaultBaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IAccountBankService iAccountBankService;
|
private IAccountBankService iAccountBankService;
|
||||||
|
@Autowired
|
||||||
|
private UserExpandServiceImpl userExpandService;
|
||||||
|
|
||||||
@ApiOperation(value = "客户账户详情", notes = "客户账户详情接口")
|
@ApiOperation(value = "客户账户详情", notes = "客户账户详情接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ -50,6 +55,13 @@ public class AccountResourceController extends DefaultBaseController {
|
|||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("get/{userId}")
|
@GetMapping("get/{userId}")
|
||||||
public AccountDTO get(@PathVariable("userId") String userId) {
|
public AccountDTO get(@PathVariable("userId") String userId) {
|
||||||
|
/**
|
||||||
|
* 2025年3月13日16:59:39 增加子账号查询
|
||||||
|
*/
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
userId = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
AccountDTO dto = accountService.get(userId);
|
AccountDTO dto = accountService.get(userId);
|
||||||
return dto;
|
return dto;
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@ package cn.com.tenlion.operator.controller.resource.accountitem;
|
|||||||
|
|
||||||
import cn.com.tenlion.operator.enums.AccountItemTypeEnum;
|
import cn.com.tenlion.operator.enums.AccountItemTypeEnum;
|
||||||
import cn.com.tenlion.operator.pojo.bos.accountitem.AccountItemBO;
|
import cn.com.tenlion.operator.pojo.bos.accountitem.AccountItemBO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemOrderVO;
|
||||||
|
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
|
||||||
import cn.com.tenlion.operator.util.EncryptUtil;
|
import cn.com.tenlion.operator.util.EncryptUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
import ink.wgink.annotation.CheckRequestBodyAnnotation;
|
||||||
@ -18,6 +20,7 @@ import cn.com.tenlion.operator.pojo.dtos.accountitem.AccountItemDTO;
|
|||||||
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
import cn.com.tenlion.operator.pojo.vos.accountitem.AccountItemVO;
|
||||||
import cn.com.tenlion.operator.service.accountitem.IAccountItemService;
|
import cn.com.tenlion.operator.service.accountitem.IAccountItemService;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
@ -43,6 +46,8 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
protected SecurityComponent securityComponent;
|
protected SecurityComponent securityComponent;
|
||||||
|
@Autowired
|
||||||
|
private UserExpandServiceImpl userExpandService;
|
||||||
|
|
||||||
@ApiOperation(value = "代理商订单完成", notes = "代理商订单完成接口")
|
@ApiOperation(value = "代理商订单完成", notes = "代理商订单完成接口")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ -67,12 +72,22 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
||||||
throw new SaveException("鉴权失败");
|
throw new SaveException("鉴权失败");
|
||||||
}
|
}
|
||||||
|
String msg = "";
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
String userId1 = accountItemOrderVO.getUserId();
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(accountItemOrderVO.getUserId());
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
msg = " / 子账号" + userExpandDTO.getUserUsername();
|
||||||
|
userId1 = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
AccountItemVO accountItemVO = new AccountItemVO();
|
AccountItemVO accountItemVO = new AccountItemVO();
|
||||||
accountItemVO.setMode(1); // 入账
|
accountItemVO.setMode(1); // 入账
|
||||||
accountItemVO.setType(5); // 收入类型 订单收入
|
accountItemVO.setType(5); // 收入类型 订单收入
|
||||||
accountItemVO.setAccountId(accountItemOrderVO.getUserId());
|
accountItemVO.setAccountId(userId1);
|
||||||
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
||||||
accountItemVO.setDescription(accountItemOrderVO.getDescription());
|
accountItemVO.setDescription(accountItemOrderVO.getDescription() + msg);
|
||||||
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
||||||
accountItemVO.setOrderType("shop");
|
accountItemVO.setOrderType("shop");
|
||||||
accountItemService.saveShopReturnId(accountItemVO);
|
accountItemService.saveShopReturnId(accountItemVO);
|
||||||
@ -102,12 +117,22 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
||||||
throw new SaveException("鉴权失败");
|
throw new SaveException("鉴权失败");
|
||||||
}
|
}
|
||||||
|
String msg = "";
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
String userId1 = accountItemOrderVO.getUserId();
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(accountItemOrderVO.getUserId());
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
msg = " / 子账号" + userExpandDTO.getUserUsername();
|
||||||
|
userId1 = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
AccountItemVO accountItemVO = new AccountItemVO();
|
AccountItemVO accountItemVO = new AccountItemVO();
|
||||||
accountItemVO.setMode(1); // 入账
|
accountItemVO.setMode(1); // 入账
|
||||||
accountItemVO.setType(5); // 收入类型 订单收入
|
accountItemVO.setType(5); // 收入类型 订单收入
|
||||||
accountItemVO.setAccountId(accountItemOrderVO.getUserId());
|
accountItemVO.setAccountId(userId1);
|
||||||
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
||||||
accountItemVO.setDescription(accountItemOrderVO.getDescription());
|
accountItemVO.setDescription(accountItemOrderVO.getDescription() + msg);
|
||||||
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
||||||
accountItemVO.setOrderType("agent");
|
accountItemVO.setOrderType("agent");
|
||||||
accountItemService.saveAgentReturnId("agent", accountItemVO);
|
accountItemService.saveAgentReturnId("agent", accountItemVO);
|
||||||
@ -137,6 +162,16 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
||||||
throw new SaveException("鉴权失败");
|
throw new SaveException("鉴权失败");
|
||||||
}
|
}
|
||||||
|
String msg = "";
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
String userId1 = accountItemOrderVO.getUserId();
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(accountItemOrderVO.getUserId());
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
msg = " / 子账号" + userExpandDTO.getUserUsername();
|
||||||
|
userId1 = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
AccountItemVO accountItemVO = new AccountItemVO();
|
AccountItemVO accountItemVO = new AccountItemVO();
|
||||||
accountItemVO.setMode(1); // 入账
|
accountItemVO.setMode(1); // 入账
|
||||||
accountItemVO.setType((
|
accountItemVO.setType((
|
||||||
@ -144,9 +179,9 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
accountItemOrderVO.getType() == AccountItemTypeEnum.PAYMENT_SPLIT.getValue() ||
|
accountItemOrderVO.getType() == AccountItemTypeEnum.PAYMENT_SPLIT.getValue() ||
|
||||||
accountItemOrderVO.getType() == AccountItemTypeEnum.REFUND.getValue()
|
accountItemOrderVO.getType() == AccountItemTypeEnum.REFUND.getValue()
|
||||||
) ? accountItemOrderVO.getType() : AccountItemTypeEnum.PAYMENT_SPLIT.getValue()); // 收入类型 充值 | 分账入账 | 退款入账
|
) ? accountItemOrderVO.getType() : AccountItemTypeEnum.PAYMENT_SPLIT.getValue()); // 收入类型 充值 | 分账入账 | 退款入账
|
||||||
accountItemVO.setAccountId(accountItemOrderVO.getUserId());
|
accountItemVO.setAccountId(userId1);
|
||||||
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
||||||
accountItemVO.setDescription(accountItemOrderVO.getDescription());
|
accountItemVO.setDescription(accountItemOrderVO.getDescription() + msg);
|
||||||
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
||||||
accountItemVO.setOrderType(type);
|
accountItemVO.setOrderType(type);
|
||||||
accountItemService.saveReturnId(accountItemVO);
|
accountItemService.saveReturnId(accountItemVO);
|
||||||
@ -178,6 +213,16 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
if (!money.equals(accountItemOrderVO.getAccountMoney()) || !userId.equals(accountItemOrderVO.getUserId()) || !orderId.equals(accountItemOrderVO.getOrderId())) {
|
||||||
throw new SaveException("鉴权失败");
|
throw new SaveException("鉴权失败");
|
||||||
}
|
}
|
||||||
|
String msg = "";
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
String userId1 = accountItemOrderVO.getUserId();
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(accountItemOrderVO.getUserId());
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
msg = " / 子账号" + userExpandDTO.getUserUsername();
|
||||||
|
userId1 = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
AccountItemVO accountItemVO = new AccountItemVO();
|
AccountItemVO accountItemVO = new AccountItemVO();
|
||||||
accountItemVO.setMode(2); // 出账
|
accountItemVO.setMode(2); // 出账
|
||||||
accountItemVO.setType(
|
accountItemVO.setType(
|
||||||
@ -186,9 +231,9 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
accountItemOrderVO.getType() == AccountItemTypeEnum.SYSTEM_DEDUCTION.getValue() ||
|
accountItemOrderVO.getType() == AccountItemTypeEnum.SYSTEM_DEDUCTION.getValue() ||
|
||||||
accountItemOrderVO.getType() == AccountItemTypeEnum.REFUND_DEDUCTION.getValue()
|
accountItemOrderVO.getType() == AccountItemTypeEnum.REFUND_DEDUCTION.getValue()
|
||||||
) ? accountItemOrderVO.getType() : AccountItemTypeEnum.PAY_OUT.getValue()); // 支出类型 系统扣款 | 支出 | 提现 / 退款
|
) ? accountItemOrderVO.getType() : AccountItemTypeEnum.PAY_OUT.getValue()); // 支出类型 系统扣款 | 支出 | 提现 / 退款
|
||||||
accountItemVO.setAccountId(accountItemOrderVO.getUserId());
|
accountItemVO.setAccountId(userId1);
|
||||||
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
accountItemVO.setAccountMoney(accountItemOrderVO.getAccountMoney());
|
||||||
accountItemVO.setDescription(accountItemOrderVO.getDescription());
|
accountItemVO.setDescription(accountItemOrderVO.getDescription() + msg);
|
||||||
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
accountItemVO.setOrderId(accountItemOrderVO.getOrderId());
|
||||||
accountItemVO.setOrderType(type);
|
accountItemVO.setOrderType(type);
|
||||||
accountItemVO.setIsPostpaid(accountItemOrderVO.getIsPostpaid());
|
accountItemVO.setIsPostpaid(accountItemOrderVO.getIsPostpaid());
|
||||||
@ -203,6 +248,13 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("list/{userId}")
|
@GetMapping("list/{userId}")
|
||||||
public List<AccountItemBO> list(@PathVariable("userId") String userId) {
|
public List<AccountItemBO> list(@PathVariable("userId") String userId) {
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
userId = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
Map<String, Object> params = requestParams();
|
Map<String, Object> params = requestParams();
|
||||||
params.put("accountId", userId);
|
params.put("accountId", userId);
|
||||||
return accountItemService.listBO(params);
|
return accountItemService.listBO(params);
|
||||||
@ -218,6 +270,13 @@ public class AccountItemResourceController extends DefaultBaseController {
|
|||||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||||
@GetMapping("listpage/{userId}")
|
@GetMapping("listpage/{userId}")
|
||||||
public SuccessResultList<List<AccountItemDTO>> listPage(@PathVariable("userId") String userId, ListPage page) {
|
public SuccessResultList<List<AccountItemDTO>> listPage(@PathVariable("userId") String userId, ListPage page) {
|
||||||
|
/**
|
||||||
|
* 增加子账号 2025年3月13日17:02:07
|
||||||
|
*/
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||||
|
if(!StringUtils.isEmpty(userExpandDTO.getMainUserId())) {
|
||||||
|
userId = userExpandDTO.getMainUserId();
|
||||||
|
}
|
||||||
Map<String, Object> params = requestParams();
|
Map<String, Object> params = requestParams();
|
||||||
params.put("accountId", userId);
|
params.put("accountId", userId);
|
||||||
page.setParams(params);
|
page.setParams(params);
|
||||||
|
@ -0,0 +1,124 @@
|
|||||||
|
package cn.com.tenlion.operator.controller.resource.user;
|
||||||
|
|
||||||
|
import cn.com.tenlion.operator.controller.api.user.SubUserDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
||||||
|
import cn.com.tenlion.operator.pojo.vos.user.UserRegisterVO;
|
||||||
|
import cn.com.tenlion.operator.service.user.expand.UserExpandServiceImpl;
|
||||||
|
import ink.wgink.common.base.DefaultBaseController;
|
||||||
|
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||||
|
import ink.wgink.interfaces.role.IRoleBaseService;
|
||||||
|
import ink.wgink.module.sms.manager.VerifyCodeManager;
|
||||||
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
|
import ink.wgink.pojo.result.SuccessResult;
|
||||||
|
import ink.wgink.pojo.result.SuccessResultData;
|
||||||
|
import ink.wgink.service.role.service.IRoleUserService;
|
||||||
|
import ink.wgink.service.user.enums.UserStateEnum;
|
||||||
|
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||||
|
import ink.wgink.service.user.service.IUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassName: UserInfoController
|
||||||
|
* Description:
|
||||||
|
* Author: wanggeng
|
||||||
|
* Date: 2024/7/23 上午10:09
|
||||||
|
* Version: 1.0
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping(ISystemConstant.RESOURCE_PREFIX + "/user-create")
|
||||||
|
public class UserCreateResourceController extends DefaultBaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserService iUserService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleBaseService iRoleBaseService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleUserService iRoleUserService;
|
||||||
|
@Autowired
|
||||||
|
private UserExpandServiceImpl userExpandService;
|
||||||
|
private static final String REGEX_MOBILE_PHONE = "^1[3-9]\\d{9}$";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取当前账号的主账号ID或子账号ID集
|
||||||
|
* @param userId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("get/{userId}")
|
||||||
|
public SubUserDTO get(@PathVariable("userId") String userId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(userId);
|
||||||
|
UserDTO userDTO = iUserService.get(userId);
|
||||||
|
SubUserDTO dto = new SubUserDTO();
|
||||||
|
dto.setUserId(userDTO.getUserId());
|
||||||
|
dto.setName(userDTO.getUserName());
|
||||||
|
dto.setUsername(userDTO.getUserUsername());
|
||||||
|
dto.setPhone(userDTO.getUserPhone());
|
||||||
|
dto.setStatus(userDTO.getUserState() + "");
|
||||||
|
dto.setMainUserId(userExpandDTO.getMainUserId());
|
||||||
|
dto.setSubUserIds(userExpandDTO.getSubUserIds());
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 封禁或解禁子账号
|
||||||
|
* @param mainUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("change-status/{mainUserId}/{userId}")
|
||||||
|
public SuccessResult changeStatus(@PathVariable("mainUserId") String mainUserId, @PathVariable("userId") String userId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(mainUserId);
|
||||||
|
if(userExpandDTO.getSubUserIds().contains(userId)) {
|
||||||
|
UserDTO userDTO = iUserService.get(userId);
|
||||||
|
iUserService.updateUserState(userId, userDTO.getUserState().equals(0) ? UserStateEnum.LOCK : UserStateEnum.NORMAL);
|
||||||
|
}
|
||||||
|
return new SuccessResult();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账号的列表
|
||||||
|
* @param mainUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("list/{mainUserId}")
|
||||||
|
public List<SubUserDTO> list(@PathVariable("mainUserId") String mainUserId) {
|
||||||
|
UserExpandDTO userExpandDTO = userExpandService.get(mainUserId);
|
||||||
|
if(StringUtils.isEmpty(userExpandDTO.getSubUserIds())) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<UserPO> list = iUserService.listPOByUserIds(Arrays.asList(userExpandDTO.getSubUserIds().split(",")));
|
||||||
|
List<SubUserDTO> listData = new ArrayList<>();
|
||||||
|
for(UserPO po : list) {
|
||||||
|
SubUserDTO dto = new SubUserDTO();
|
||||||
|
dto.setUserId(po.getUserId());
|
||||||
|
dto.setName(po.getUserName());
|
||||||
|
dto.setUsername(po.getUserUsername());
|
||||||
|
dto.setPhone(po.getUserPhone());
|
||||||
|
dto.setStatus(po.getUserState() + "");
|
||||||
|
dto.setMainUserId(mainUserId);
|
||||||
|
listData.add(dto);
|
||||||
|
}
|
||||||
|
return listData;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账号的创建
|
||||||
|
* @param mainUserId
|
||||||
|
* @param userRegisterVO
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PutMapping("register/{mainUserId}")
|
||||||
|
public SuccessResultData<String> register(@PathVariable("mainUserId") String mainUserId, @RequestBody UserRegisterVO userRegisterVO) {
|
||||||
|
String userId = userExpandService.saveSub(mainUserId, userRegisterVO);
|
||||||
|
VerifyCodeManager verifyCodeManager = VerifyCodeManager.getInstance();
|
||||||
|
verifyCodeManager.clearUsedVerifyCode(userRegisterVO.getPhone());
|
||||||
|
return new SuccessResultData<>(userId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -36,6 +36,30 @@ public class UserExpandDTO extends UserDTO {
|
|||||||
private Integer relationIcRebateRatio;
|
private Integer relationIcRebateRatio;
|
||||||
private String relationIcTime;
|
private String relationIcTime;
|
||||||
private String relationIcUserId;
|
private String relationIcUserId;
|
||||||
|
/**
|
||||||
|
* 子账号ID集合
|
||||||
|
*/
|
||||||
|
private String subUserIds;
|
||||||
|
/**
|
||||||
|
* 子账号关联的主账号ID
|
||||||
|
*/
|
||||||
|
private String mainUserId;
|
||||||
|
|
||||||
|
public String getSubUserIds() {
|
||||||
|
return subUserIds == null ? "" : subUserIds.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubUserIds(String subUserIds) {
|
||||||
|
this.subUserIds = subUserIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainUserId() {
|
||||||
|
return mainUserId == null ? "" : mainUserId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainUserId(String mainUserId) {
|
||||||
|
this.mainUserId = mainUserId;
|
||||||
|
}
|
||||||
|
|
||||||
public Long getPriceAdditionalPkg() {
|
public Long getPriceAdditionalPkg() {
|
||||||
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
|
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
|
||||||
|
@ -0,0 +1,68 @@
|
|||||||
|
package cn.com.tenlion.operator.pojo.vos.user;
|
||||||
|
|
||||||
|
import cn.com.tenlion.operator.enums.ApplyStatusEnum;
|
||||||
|
import ink.wgink.annotation.CheckEmptyAnnotation;
|
||||||
|
import ink.wgink.annotation.CheckNullAnnotation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ClassName: UserIcApplyVO
|
||||||
|
* Description:
|
||||||
|
* Author: wanggeng
|
||||||
|
* Date: 2024/8/8 下午3:53
|
||||||
|
* Version: 1.0
|
||||||
|
*/
|
||||||
|
public class UserRegisterVO {
|
||||||
|
|
||||||
|
@CheckEmptyAnnotation(name = "手机号")
|
||||||
|
private String phone;
|
||||||
|
@CheckEmptyAnnotation(name = "姓名")
|
||||||
|
private String name;
|
||||||
|
@CheckEmptyAnnotation(name = "验证码")
|
||||||
|
private String verifyCode;
|
||||||
|
@CheckEmptyAnnotation(name = "密码")
|
||||||
|
private String password;
|
||||||
|
@CheckEmptyAnnotation(name = "角色")
|
||||||
|
private String userRole;
|
||||||
|
|
||||||
|
public String getUserRole() {
|
||||||
|
return userRole == null ? "" : userRole.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUserRole(String userRole) {
|
||||||
|
this.userRole = userRole;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name == null ? "" : name.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPhone() {
|
||||||
|
return phone == null ? "" : phone.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPhone(String phone) {
|
||||||
|
this.phone = phone;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getVerifyCode() {
|
||||||
|
return verifyCode == null ? "" : verifyCode.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVerifyCode(String verifyCode) {
|
||||||
|
this.verifyCode = verifyCode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getPassword() {
|
||||||
|
return password == null ? "" : password.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -40,6 +40,31 @@ public class UserExpandVO {
|
|||||||
private Double icPriceMaterial;
|
private Double icPriceMaterial;
|
||||||
private Integer icRebateRatio;
|
private Integer icRebateRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 子账号ID集合
|
||||||
|
*/
|
||||||
|
private String subUserIds;
|
||||||
|
/**
|
||||||
|
* 子账号关联的主账号ID
|
||||||
|
*/
|
||||||
|
private String mainUserId;
|
||||||
|
|
||||||
|
public String getSubUserIds() {
|
||||||
|
return subUserIds == null ? "" : subUserIds.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSubUserIds(String subUserIds) {
|
||||||
|
this.subUserIds = subUserIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getMainUserId() {
|
||||||
|
return mainUserId == null ? "" : mainUserId.trim();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setMainUserId(String mainUserId) {
|
||||||
|
this.mainUserId = mainUserId;
|
||||||
|
}
|
||||||
|
|
||||||
public Double getPriceAdditionalPkg() {
|
public Double getPriceAdditionalPkg() {
|
||||||
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
|
return priceAdditionalPkg == null ? 0 : priceAdditionalPkg;
|
||||||
}
|
}
|
||||||
|
@ -472,22 +472,7 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
throw new SaveException(result.getData());
|
throw new SaveException(result.getData());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ThirdPartyEnum.DGZZ.getValue().equals(thirdParty)) {
|
|
||||||
/**
|
|
||||||
* 向系统人员发送信息
|
|
||||||
*/
|
|
||||||
JSONArray phoneArray = new JSONArray();
|
|
||||||
String[] phones = ProjectConfigUtil.getText("HandleRechargePhones").split(",");
|
|
||||||
for(String phone : phones) {
|
|
||||||
com.alibaba.fastjson.JSONObject obj1 = new JSONObject();
|
|
||||||
obj1.put("phone", phone);
|
|
||||||
phoneArray.add(obj1);
|
|
||||||
}
|
|
||||||
Map<String, String> templateParams = new HashMap<>();
|
|
||||||
templateParams.put("count", 1 + "");
|
|
||||||
templateParams.put("money", PayUtil.buiderMoney(totalMoney) + "");
|
|
||||||
TenlionSMS.sendMessage(UUIDUtil.getUUID(), "M00005", templateParams, phoneArray);
|
|
||||||
}
|
|
||||||
// }
|
// }
|
||||||
return payDTO;
|
return payDTO;
|
||||||
}
|
}
|
||||||
@ -569,6 +554,23 @@ public class AccountRechargeServiceImpl extends DefaultBaseService implements IA
|
|||||||
" <p style=\"text-align: center;\"><span style=\"color: rgb(194, 79, 74);\">备注内容 : <span style=\"text-decoration: underline;\" id=\"bankRemark\">" + bankDTO.getBankRemark() + "</span></span></p>";
|
" <p style=\"text-align: center;\"><span style=\"color: rgb(194, 79, 74);\">备注内容 : <span style=\"text-decoration: underline;\" id=\"bankRemark\">" + bankDTO.getBankRemark() + "</span></span></p>";
|
||||||
params.put("selfData", selfData);
|
params.put("selfData", selfData);
|
||||||
params.put("rechargeRemark", accountRechargeVO.getRechargeRemark());
|
params.put("rechargeRemark", accountRechargeVO.getRechargeRemark());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 向系统人员发送信息
|
||||||
|
*/
|
||||||
|
AccountRechargeDTO accountRechargeDTO = get(accountRechargeId);
|
||||||
|
JSONArray phoneArray = new JSONArray();
|
||||||
|
String[] phones = ProjectConfigUtil.getText("HandleRechargePhones").split(",");
|
||||||
|
for(String phone : phones) {
|
||||||
|
com.alibaba.fastjson.JSONObject obj1 = new JSONObject();
|
||||||
|
obj1.put("phone", phone);
|
||||||
|
phoneArray.add(obj1);
|
||||||
|
}
|
||||||
|
Map<String, String> templateParams = new HashMap<>();
|
||||||
|
templateParams.put("count", 1 + "");
|
||||||
|
templateParams.put("money", accountRechargeDTO.getRechargeMoney() + "");
|
||||||
|
TenlionSMS.sendMessage(UUIDUtil.getUUID(), "M00005", templateParams, phoneArray);
|
||||||
|
|
||||||
accountRechargeDao.update(params);
|
accountRechargeDao.update(params);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,21 +5,32 @@ import cn.com.tenlion.operator.enums.IcWayToGetEnum;
|
|||||||
import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO;
|
import cn.com.tenlion.operator.pojo.dtos.ic.UsericDTO;
|
||||||
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
import cn.com.tenlion.operator.pojo.dtos.user.expand.UserExpandDTO;
|
||||||
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
|
import cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO;
|
||||||
|
import cn.com.tenlion.operator.pojo.vos.user.UserRegisterVO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO;
|
import cn.com.tenlion.operator.pojo.vos.user.expand.UserExpandVO;
|
||||||
import cn.com.tenlion.operator.pojo.vos.user.expand.ic.UserExpandRelationIcVO;
|
import cn.com.tenlion.operator.pojo.vos.user.expand.ic.UserExpandRelationIcVO;
|
||||||
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
import cn.com.tenlion.operator.properties.SystemApiPathProperties;
|
||||||
import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService;
|
import cn.com.tenlion.operator.remote.IOperatorPluginRemoteService;
|
||||||
|
import cn.com.tenlion.operator.util.pay.PayUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import ink.wgink.app.AppTokenManager;
|
import ink.wgink.app.AppTokenManager;
|
||||||
import ink.wgink.common.base.DefaultBaseService;
|
import ink.wgink.common.base.DefaultBaseService;
|
||||||
|
import ink.wgink.exceptions.SaveException;
|
||||||
import ink.wgink.exceptions.SearchException;
|
import ink.wgink.exceptions.SearchException;
|
||||||
|
import ink.wgink.interfaces.role.IRoleBaseService;
|
||||||
import ink.wgink.interfaces.user.IUserExpandBaseService;
|
import ink.wgink.interfaces.user.IUserExpandBaseService;
|
||||||
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
import ink.wgink.module.oauth2.manager.OAuth2ClientTokenManager;
|
||||||
|
import ink.wgink.module.sms.manager.VerifyCodeManager;
|
||||||
import ink.wgink.pojo.ListPage;
|
import ink.wgink.pojo.ListPage;
|
||||||
|
import ink.wgink.pojo.dtos.role.RoleDTO;
|
||||||
import ink.wgink.pojo.dtos.user.UserDTO;
|
import ink.wgink.pojo.dtos.user.UserDTO;
|
||||||
import ink.wgink.pojo.result.SuccessResultList;
|
import ink.wgink.pojo.result.SuccessResultList;
|
||||||
|
import ink.wgink.service.role.service.IRoleUserService;
|
||||||
|
import ink.wgink.service.user.enums.UserStateEnum;
|
||||||
|
import ink.wgink.service.user.enums.UserTypeEnum;
|
||||||
import ink.wgink.service.user.pojo.pos.UserPO;
|
import ink.wgink.service.user.pojo.pos.UserPO;
|
||||||
|
import ink.wgink.service.user.pojo.vos.UserVO;
|
||||||
import ink.wgink.service.user.service.IUserService;
|
import ink.wgink.service.user.service.IUserService;
|
||||||
|
import ink.wgink.util.RegexUtil;
|
||||||
import ink.wgink.util.date.DateUtil;
|
import ink.wgink.util.date.DateUtil;
|
||||||
import ink.wgink.util.map.HashMapUtil;
|
import ink.wgink.util.map.HashMapUtil;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -150,6 +161,69 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
|||||||
redisTemplate.opsForValue().set("user:expand:" + userExpandPO.getUserId(), JSON.toJSONString(userExpandPO));
|
redisTemplate.opsForValue().set("user:expand:" + userExpandPO.getUserId(), JSON.toJSONString(userExpandPO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IUserService iUserService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleBaseService iRoleBaseService;
|
||||||
|
@Autowired
|
||||||
|
private IRoleUserService iRoleUserService;
|
||||||
|
|
||||||
|
public String saveSub(String mainUserId, UserRegisterVO userRegisterVO) {
|
||||||
|
VerifyCodeManager verifyCodeManager = VerifyCodeManager.getInstance();
|
||||||
|
String code = verifyCodeManager.getVerifyCode(userRegisterVO.getPhone());
|
||||||
|
/* if(!userRegisterVO.getVerifyCode().equals(code)) {
|
||||||
|
throw new SaveException("验证码错误");
|
||||||
|
}*/
|
||||||
|
UserVO userVO = new UserVO();
|
||||||
|
userVO.setUserUsername(userRegisterVO.getPhone());
|
||||||
|
userVO.setUserPassword(userRegisterVO.getPassword());
|
||||||
|
userVO.setUserName(userRegisterVO.getName());
|
||||||
|
if (RegexUtil.isPhone(userRegisterVO.getPhone())) {
|
||||||
|
userVO.setUserPhone(userRegisterVO.getPhone());
|
||||||
|
}
|
||||||
|
userVO.setUserState(UserStateEnum.NORMAL.getValue());
|
||||||
|
userVO.setUserType(UserTypeEnum.SYSTEM.getValue());
|
||||||
|
String userId = iUserService.saveAndReturnId(userVO, true);
|
||||||
|
|
||||||
|
RoleDTO roleDTO = iRoleBaseService.get(userRegisterVO.getUserRole());
|
||||||
|
if (roleDTO == null) {
|
||||||
|
throw new SaveException("子账号角色不存在");
|
||||||
|
}
|
||||||
|
String roleName = roleDTO.getRoleName();
|
||||||
|
// 1.修改用户的角色
|
||||||
|
iRoleUserService.save(roleDTO.getRoleId(), userId);
|
||||||
|
|
||||||
|
|
||||||
|
Map<String, Object> params2 = getHashMap(2);
|
||||||
|
params2.put("userId", mainUserId);
|
||||||
|
UserExpandDTO userExpandDTO = userExpandDao.get(params2);
|
||||||
|
params2.put("subUserIds", userId + "," + userExpandDTO.getSubUserIds());
|
||||||
|
userExpandDao.update(params2);
|
||||||
|
|
||||||
|
UserExpandVO userExpandVO = new UserExpandVO();
|
||||||
|
userExpandVO.setPriceAdditionalPkg(userExpandDTO.getPriceAdditionalPkg() * 1.0);
|
||||||
|
userExpandVO.setPriceAdditionalVideoDemo(userExpandDTO.getPriceAdditionalVideoDemo() * 1.0);
|
||||||
|
userExpandVO.setPriceAdditionalUrgent(userExpandDTO.getPriceAdditionalUrgent() * 1.0);
|
||||||
|
userExpandVO.setPriceAll(userExpandDTO.getPriceAll() * 1.0);
|
||||||
|
userExpandVO.setPriceMaterial(userExpandDTO.getPriceMaterial() * 1.0);
|
||||||
|
userExpandVO.setPriceMaterialAgent(userExpandDTO.getPriceMaterialAgent() * 1.0);
|
||||||
|
userExpandVO.setPriceMaterialAgentUrgent(userExpandDTO.getPriceMaterialAgentUrgent() * 1.0);
|
||||||
|
userExpandVO.setIcPriceAll(userExpandDTO.getIcPriceAll() * 1.0);
|
||||||
|
userExpandVO.setIcPriceMaterial(userExpandDTO.getIcPriceMaterial() * 1.0);
|
||||||
|
userExpandVO.setIcRebateRatio(userExpandDTO.getIcRebateRatio());
|
||||||
|
Map<String, Object> params = HashMapUtil.beanToMap(userExpandVO);
|
||||||
|
params.put("userId", userId);
|
||||||
|
params.put("mainUserId", mainUserId);
|
||||||
|
userExpandDao.save(params);
|
||||||
|
|
||||||
|
updateRedis(userId);
|
||||||
|
updateRedis(mainUserId);
|
||||||
|
|
||||||
|
updateBatchRelationRebateRatio(userId, userExpandVO.getIcRebateRatio(), userExpandVO.getIcRebateRatio());
|
||||||
|
return userId;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public void saveOrUpdate(String userId, UserExpandVO userExpandVO) {
|
public void saveOrUpdate(String userId, UserExpandVO userExpandVO) {
|
||||||
userExpandVO.setPriceAdditionalPkg(userExpandVO.getPriceAdditionalPkg() * 100);
|
userExpandVO.setPriceAdditionalPkg(userExpandVO.getPriceAdditionalPkg() * 100);
|
||||||
userExpandVO.setPriceAdditionalVideoDemo(userExpandVO.getPriceAdditionalVideoDemo() * 100);
|
userExpandVO.setPriceAdditionalVideoDemo(userExpandVO.getPriceAdditionalVideoDemo() * 100);
|
||||||
@ -167,36 +241,43 @@ public class UserExpandServiceImpl extends DefaultBaseService implements IUserEx
|
|||||||
|
|
||||||
params = HashMapUtil.beanToMap(userExpandVO);
|
params = HashMapUtil.beanToMap(userExpandVO);
|
||||||
params.put("userId", userId);
|
params.put("userId", userId);
|
||||||
if (StringUtils.isNotBlank(userExpandVO.getIc())) {
|
|
||||||
params.put("icAssignUserId", securityComponent.getCurrentUser().getUserId());
|
if (!StringUtils.isEmpty(userExpandVO.getMainUserId())) {
|
||||||
params.put("icWayToGet", IcWayToGetEnum.ASSIGN);
|
if (StringUtils.isNotBlank(userExpandVO.getIc())) {
|
||||||
params.put("icGetTime", DateUtil.getTime());
|
params.put("icAssignUserId", securityComponent.getCurrentUser().getUserId());
|
||||||
}
|
params.put("icWayToGet", IcWayToGetEnum.ASSIGN);
|
||||||
if (userExpandDTO == null) {
|
params.put("icGetTime", DateUtil.getTime());
|
||||||
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
|
|
||||||
throw new SearchException("邀请码已存在,请重新生成");
|
|
||||||
}
|
}
|
||||||
userExpandDao.save(params);
|
if (userExpandDTO == null) {
|
||||||
} else {
|
|
||||||
if (StringUtils.isNotBlank(userExpandDTO.getRelationIc()) &&
|
|
||||||
StringUtils.equals("ACTIVE", userExpandVO.getPostpaid())) {
|
|
||||||
throw new SearchException("已经绑定邀请码的用户不能设置为后付费用户");
|
|
||||||
}
|
|
||||||
if (StringUtils.isNotBlank(userExpandDTO.getIc())) {
|
|
||||||
params.remove("ic");
|
|
||||||
params.remove("icGetTime");
|
|
||||||
params.remove("icAssignUserId");
|
|
||||||
params.remove("icPriceAll");
|
|
||||||
params.remove("icPriceMaterial");
|
|
||||||
} else {
|
|
||||||
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
|
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
|
||||||
throw new SearchException("邀请码已存在,请重新生成");
|
throw new SearchException("邀请码已存在,请重新生成");
|
||||||
}
|
}
|
||||||
|
userExpandDao.save(params);
|
||||||
|
} else {
|
||||||
|
if (StringUtils.isNotBlank(userExpandDTO.getRelationIc()) &&
|
||||||
|
StringUtils.equals("ACTIVE", userExpandVO.getPostpaid())) {
|
||||||
|
throw new SearchException("已经绑定邀请码的用户不能设置为后付费用户");
|
||||||
|
}
|
||||||
|
if (StringUtils.isNotBlank(userExpandDTO.getIc())) {
|
||||||
|
params.remove("ic");
|
||||||
|
params.remove("icGetTime");
|
||||||
|
params.remove("icAssignUserId");
|
||||||
|
params.remove("icPriceAll");
|
||||||
|
params.remove("icPriceMaterial");
|
||||||
|
} else {
|
||||||
|
if (StringUtils.isNotBlank(userExpandVO.getIc()) && countIc(userExpandVO.getIc()) > 0) {
|
||||||
|
throw new SearchException("邀请码已存在,请重新生成");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userExpandDao.update(params);
|
||||||
}
|
}
|
||||||
userExpandDao.update(params);
|
updateRedis(userId);
|
||||||
|
updateBatchRelationRebateRatio(userId, userExpandDTO == null ? 0 : userExpandDTO.getIcRebateRatio(), userExpandVO.getIcRebateRatio());
|
||||||
|
}else{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
updateRedis(userId);
|
|
||||||
updateBatchRelationRebateRatio(userId, userExpandDTO == null ? 0 : userExpandDTO.getIcRebateRatio(), userExpandVO.getIcRebateRatio());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void saveOrUpdateWithIc(String userId, UserExpandVO userExpandVO) {
|
public void saveOrUpdateWithIc(String userId, UserExpandVO userExpandVO) {
|
||||||
|
@ -27,6 +27,8 @@
|
|||||||
<result column="relation_ic_rebate_ratio" property="relationIcRebateRatio"/>
|
<result column="relation_ic_rebate_ratio" property="relationIcRebateRatio"/>
|
||||||
<result column="relation_ic_time" property="relationIcTime"/>
|
<result column="relation_ic_time" property="relationIcTime"/>
|
||||||
<result column="relation_ic_user_id" property="relationIcUserId"/>
|
<result column="relation_ic_user_id" property="relationIcUserId"/>
|
||||||
|
<result column="sub_user_ids" property="subUserIds"/>
|
||||||
|
<result column="main_user_id" property="mainUserId"/>
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<resultMap id="userExpandPO" type="cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO">
|
<resultMap id="userExpandPO" type="cn.com.tenlion.operator.pojo.pos.user.expand.UserExpandPO">
|
||||||
@ -77,7 +79,9 @@
|
|||||||
ic_rebate_ratio,
|
ic_rebate_ratio,
|
||||||
ic_way_to_get,
|
ic_way_to_get,
|
||||||
ic_get_time,
|
ic_get_time,
|
||||||
ic_assign_user_id
|
ic_assign_user_id,
|
||||||
|
sub_user_ids,
|
||||||
|
main_user_id
|
||||||
) VALUES (
|
) VALUES (
|
||||||
#{userId},
|
#{userId},
|
||||||
#{priceAdditionalPkg},
|
#{priceAdditionalPkg},
|
||||||
@ -98,7 +102,9 @@
|
|||||||
#{icRebateRatio},
|
#{icRebateRatio},
|
||||||
#{icWayToGet},
|
#{icWayToGet},
|
||||||
#{icGetTime},
|
#{icGetTime},
|
||||||
#{icAssignUserId}
|
#{icAssignUserId},
|
||||||
|
#{subUserIds},
|
||||||
|
#{mainUserId}
|
||||||
)
|
)
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -124,6 +130,12 @@
|
|||||||
<if test="icPriceMaterial != null">
|
<if test="icPriceMaterial != null">
|
||||||
ic_price_material = #{icPriceMaterial},
|
ic_price_material = #{icPriceMaterial},
|
||||||
</if>
|
</if>
|
||||||
|
<if test="subUserIds != null">
|
||||||
|
sub_user_ids = #{subUserIds},
|
||||||
|
</if>
|
||||||
|
<if test="mainUserId != null">
|
||||||
|
main_user_id = #{mainUserId},
|
||||||
|
</if>
|
||||||
price_additional_pkg = #{priceAdditionalPkg},
|
price_additional_pkg = #{priceAdditionalPkg},
|
||||||
price_additional_video_demo = #{priceAdditionalVideoDemo},
|
price_additional_video_demo = #{priceAdditionalVideoDemo},
|
||||||
price_additional_urgent = #{priceAdditionalUrgent},
|
price_additional_urgent = #{priceAdditionalUrgent},
|
||||||
@ -202,7 +214,9 @@
|
|||||||
relation_ic,
|
relation_ic,
|
||||||
relation_ic_rebate_ratio,
|
relation_ic_rebate_ratio,
|
||||||
relation_ic_time,
|
relation_ic_time,
|
||||||
relation_ic_user_id
|
relation_ic_user_id,
|
||||||
|
sub_user_ids,
|
||||||
|
main_user_id
|
||||||
FROM
|
FROM
|
||||||
sys_user_expand
|
sys_user_expand
|
||||||
WHERE
|
WHERE
|
||||||
@ -236,7 +250,9 @@
|
|||||||
relation_ic,
|
relation_ic,
|
||||||
relation_ic_rebate_ratio,
|
relation_ic_rebate_ratio,
|
||||||
relation_ic_time,
|
relation_ic_time,
|
||||||
relation_ic_user_id
|
relation_ic_user_id,
|
||||||
|
sub_user_ids,
|
||||||
|
main_user_id
|
||||||
FROM
|
FROM
|
||||||
sys_user_expand
|
sys_user_expand
|
||||||
WHERE
|
WHERE
|
||||||
|
Loading…
Reference in New Issue
Block a user