Compare commits
5 Commits
bbd063c4cd
...
yyt
Author | SHA1 | Date | |
---|---|---|---|
78403af455 | |||
f51d42230c | |||
5c6b502c1e | |||
e880431e07 | |||
1513ea51dc |
7
pom.xml
7
pom.xml
@ -214,6 +214,13 @@
|
||||
<version>2.6.9</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-crypto</artifactId>
|
||||
<version>5.8.7</version> <!-- 换成你项目里使用的 Spring Security 版本 -->
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum ErrorCode {
|
||||
|
||||
// private static final SUCESS = new ErrorCode(1, "ok");
|
||||
SUCCESS(1,"ok"),
|
||||
PARAMS_ERROR(40000,"请求参数错误"),
|
||||
NOT_LOGIN_ERROR(40100,"未登录"),
|
||||
|
@ -0,0 +1,15 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class IdCardNumRequest {
|
||||
private String idcardnum;
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.checkerframework.checker.units.qual.A;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Project_commission {
|
||||
private Long userid;
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Promo_code_apply {
|
||||
private Long userid;
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
//有get,set方法,to-string方法
|
||||
@Data
|
||||
//无参构造函数
|
||||
@NoArgsConstructor
|
||||
//全参构造函数
|
||||
@AllArgsConstructor
|
||||
public class QueryRequest {
|
||||
private Long pagesize;
|
||||
|
||||
|
||||
private Long pagenum;
|
||||
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
|
||||
public class Toselect {
|
||||
private String phoneNumber;
|
||||
private String bankNumber;
|
||||
}
|
@ -0,0 +1,223 @@
|
||||
package com.greenorange.promotion.controller.practice;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountAddRequest;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountUpdateRequest;
|
||||
import com.greenorange.promotion.model.entity.ProjectCommission;
|
||||
import com.greenorange.promotion.model.entity.PromoCodeApply;
|
||||
import com.greenorange.promotion.model.entity.UserAccount;
|
||||
import com.greenorange.promotion.service.project.ProjectCommissionService;
|
||||
import com.greenorange.promotion.service.project.PromoCodeApplyService;
|
||||
import com.greenorange.promotion.service.project.impl.PromoCodeApplyServiceImpl;
|
||||
import com.greenorange.promotion.service.settle.UserAccountService;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.checkerframework.common.util.report.qual.ReportWrite;
|
||||
import org.jacoco.agent.rt.internal_f3994fa.IExceptionLogger;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import java.util.*;
|
||||
|
||||
//@ResponseBody 把返回值传到浏览器上
|
||||
//@Controller 把当前类的对象创建出来,存放到SpringIOC容器,
|
||||
//@RestController = @Controller + @ResponseBody
|
||||
@RestController
|
||||
// ip + 端口号用于运行这个服务
|
||||
// ip + 端口号 + /test/hello
|
||||
// @Controller @Service @Mapper 把当前类的对象创建出来,存放到SpringIOC容器,
|
||||
@RequestMapping("test")
|
||||
public class UserAccountTestController {
|
||||
|
||||
// 对userAccount表实现功能
|
||||
// 1.插入,删除,修改,全部查询,根据id查询
|
||||
@Resource
|
||||
// 从容器中取出名字为userAccountService的对象
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
@PostMapping("/add")
|
||||
public BaseResponse<String> add(@RequestBody UserAccountAddRequest userAccountAddRequest){
|
||||
if (userAccountAddRequest == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数不能为空");
|
||||
}
|
||||
if (userAccountAddRequest.getBankCardNumber() == null ||
|
||||
userAccountAddRequest.getPhoneNumber() == null ||
|
||||
userAccountAddRequest.getIdCardNumber() == null ||
|
||||
userAccountAddRequest.getCardHolder() == null ||
|
||||
userAccountAddRequest.getOpenBank() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "必填字段不能为空");
|
||||
}
|
||||
UserAccount userAccount = new UserAccount();
|
||||
// userAccount.setId(null);
|
||||
// userAccount.setBankCardNumber(userAccountAddRequest.getBankCardNumber());
|
||||
// userAccount.setOpenBank(userAccountAddRequest.getOpenBank());
|
||||
// userAccount.setPhoneNumber(userAccountAddRequest.getPhoneNumber());
|
||||
// userAccount.setIdCardNumber(userAccountAddRequest.getIdCardNumber());
|
||||
// userAccount.setCardHolder(userAccountAddRequest.getCardHolder());
|
||||
// userAccount.setUserId(1L);
|
||||
BeanUtils.copyProperties(userAccountAddRequest, userAccount);
|
||||
boolean result = userAccountService.save(userAccount);
|
||||
if (!result) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "新增用户账户失败");
|
||||
}
|
||||
return ResultUtils.success("插入成功");
|
||||
}
|
||||
|
||||
// @GetMapping("/delete")
|
||||
// public String delete(@RequestParam Long id) {
|
||||
// boolean removed = userAccountService.removeById(id);
|
||||
// return removed ? "删除成功" : "删除失败";
|
||||
|
||||
|
||||
// @GetMapping("/delete/{id}")
|
||||
// public String delete(@PathVariable Long id) {
|
||||
// boolean removed = userAccountService.removeById(id);
|
||||
// return removed ? "删除成功" : "删除失败";
|
||||
// }
|
||||
|
||||
|
||||
@PostMapping("/delete")
|
||||
public BaseResponse<String> delete(@RequestBody CommonRequest commonRequest){
|
||||
Long id = commonRequest.getId();
|
||||
if(id == null) throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数 id 不能为空");
|
||||
boolean removed = userAccountService.removeById(id);
|
||||
return ResultUtils.success(removed ? "删除成功" : "删除失败");
|
||||
}
|
||||
|
||||
@PostMapping("/update")
|
||||
public BaseResponse<String> update(@RequestBody UserAccountUpdateRequest userAccountUpdateRequest){
|
||||
if (userAccountUpdateRequest == null || userAccountUpdateRequest.getId() == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "更新操作必须提供 ID");
|
||||
}
|
||||
UserAccount existing = userAccountService.getById(userAccountUpdateRequest.getId());
|
||||
if (existing == null) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "要更新的用户账户不存在");
|
||||
}
|
||||
UserAccount userAccount = new UserAccount();
|
||||
// userAccount.setId(userAccountUpdateRequest.getId());
|
||||
// userAccount.setOpenBank(userAccountUpdateRequest.getOpenBank());
|
||||
// userAccount.setPhoneNumber(userAccountUpdateRequest.getPhoneNumber());
|
||||
// userAccount.setCardHolder(userAccountUpdateRequest.getCardHolder());
|
||||
// userAccount.setIdCardNumber(userAccountUpdateRequest.getIdCardNumber());
|
||||
// userAccount.setUserId(1L);
|
||||
BeanUtils.copyProperties(userAccountUpdateRequest, userAccount);
|
||||
userAccountService.updateById(userAccount);
|
||||
boolean result = userAccountService.updateById(userAccount);
|
||||
if (!result) {
|
||||
throw new BusinessException(ErrorCode.SYSTEM_ERROR, "更新失败,请稍后再试");
|
||||
}
|
||||
return ResultUtils.success("更新成功");
|
||||
}
|
||||
|
||||
//根据id查询
|
||||
@PostMapping("/select")
|
||||
public BaseResponse<UserAccount> select(@RequestBody CommonRequest commonRequest){
|
||||
Long id = commonRequest.getId();
|
||||
if (id == null) {
|
||||
throw new BusinessException(ErrorCode.PARAMS_ERROR, "请求参数 id 不能为空");
|
||||
}
|
||||
UserAccount selected = userAccountService.getById(id);
|
||||
if (selected == null) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "未找到对应的用户记录");
|
||||
}
|
||||
return ResultUtils.success(selected);
|
||||
}
|
||||
|
||||
@GetMapping("success")
|
||||
public BaseResponse<String> test() {
|
||||
for (int i = 0; i < 10; i ++ )
|
||||
System.out.println("运行了这个程序");
|
||||
String template = "运行程序";
|
||||
return ResultUtils.success(template);
|
||||
// return new BaseResponse<>(1, template, "ok");
|
||||
}
|
||||
|
||||
|
||||
//查询所有数据
|
||||
@PostMapping("/list")
|
||||
public BaseResponse<List<UserAccount>> list(){
|
||||
// 这里你可以根据 queryRequest 构造查询条件
|
||||
return ResultUtils.success(userAccountService.list());
|
||||
}
|
||||
|
||||
//分页查询
|
||||
// @PostMapping("/pagelist")
|
||||
// public BaseResponse<List<UserAccount>> pagelist(@RequestBody QueryRequest queryRequest){
|
||||
// System.out.println(queryRequest.toString());
|
||||
// Long start = queryRequest.getPagesize() * (queryRequest.getPagenum() - 1);
|
||||
// List<UserAccount> list = userAccountService.list();
|
||||
// List<UserAccount> newlist = list.subList(start.intValue(), start.intValue() + queryRequest.getPagesize().intValue());
|
||||
// return ResultUtils.success(newlist);
|
||||
// }
|
||||
@PostMapping("/pagelist")
|
||||
public BaseResponse<Page<UserAccount>> pagelist(@RequestBody QueryRequest queryRequest){
|
||||
Long pagesize = queryRequest.getPagesize();
|
||||
Long pagenum = queryRequest.getPagenum();
|
||||
Page<UserAccount> userAccountPage = new Page<>(pagenum, pagesize);//分页的规则
|
||||
Page<UserAccount> page = userAccountService.page(userAccountPage);//根据分页规则取出集合里对应的部分
|
||||
return ResultUtils.success(page);
|
||||
}
|
||||
|
||||
//根据IdCardnum查询
|
||||
@PostMapping("/idcardnumselect")
|
||||
public BaseResponse<UserAccount> idcardnumselect(@RequestBody IdCardNumRequest idCardNumRequest) throws Exception {
|
||||
String idcardnum = idCardNumRequest.getIdcardnum();
|
||||
// LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
QueryWrapper<UserAccount> queryWrapper = new QueryWrapper<>();
|
||||
// queryWrapper.eq(UserAccount::getIdCardNumber, idcardnum);
|
||||
queryWrapper.eq("idCardNumber", idcardnum);
|
||||
UserAccount userAccount = userAccountService.getOne(queryWrapper);
|
||||
if(userAccount == null) throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "这条记录不存在");
|
||||
// if(userAccount == null) ResultUtils.error(ErrorCode.NOT_FOUND_ERROR);
|
||||
return ResultUtils.success(userAccount);
|
||||
}
|
||||
|
||||
//根据phoneNumber,bankCardNumber
|
||||
@PostMapping("phonebankNumberselect")
|
||||
public BaseResponse<List<UserAccount>> phonebankselect(@RequestBody Toselect toselect){
|
||||
String phoneNumber = toselect.getPhoneNumber();
|
||||
String bankNumber = toselect.getBankNumber();
|
||||
LambdaQueryWrapper<UserAccount> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserAccount::getPhoneNumber, phoneNumber);
|
||||
queryWrapper.eq(UserAccount::getBankCardNumber, bankNumber);
|
||||
List<UserAccount> list = userAccountService.list(queryWrapper);
|
||||
if (list == null || list.isEmpty()) {
|
||||
throw new BusinessException(ErrorCode.NOT_FOUND_ERROR, "没有符合条件的用户账户信息");
|
||||
}
|
||||
return ResultUtils.success(list);
|
||||
}
|
||||
|
||||
@Resource
|
||||
private PromoCodeApplyService promoCodeApplyService;
|
||||
|
||||
@Resource
|
||||
private ProjectCommissionService projectCommissionService;
|
||||
|
||||
|
||||
@PostMapping("/queryByIds")
|
||||
public BaseResponse<List<ProjectCommission>> phonebankselectHello(){
|
||||
List<PromoCodeApply> list = promoCodeApplyService.list();
|
||||
List<Long> ids = list.stream().map(PromoCodeApply::getUserId).toList();
|
||||
LambdaQueryWrapper<ProjectCommission> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(ProjectCommission::getUserId, ids);
|
||||
List<ProjectCommission> projectCommissions = projectCommissionService.list(lambdaQueryWrapper);
|
||||
|
||||
return ResultUtils.success(projectCommissions);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// @GetMapping("error")
|
||||
// public BaseResponse<String> error() throws Exception {
|
||||
//// String error = "空指针异常";
|
||||
// String template = null;
|
||||
// if (template == null) throw new Exception("空指针异常");
|
||||
// return ResultUtils.success("error");
|
||||
// }
|
||||
|
||||
}
|
@ -33,8 +33,11 @@ import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.lang.reflect.GenericDeclaration;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
@ -138,6 +141,16 @@ public class ProjectCommissionController {
|
||||
return ResultUtils.success(projectCommissionVOList);
|
||||
}
|
||||
|
||||
|
||||
// public static void main(String[] args) {
|
||||
// PasswordEncoder passwordEncoder = new BCryptPasswordEncoder();
|
||||
// String encode = passwordEncoder.encode("123456");
|
||||
// System.out.println(encode);
|
||||
// boolean matches = passwordEncoder.matches("123456", "$2a$10$/yBGQqsHK78vlEtuMGTVY.bU/TamHQbr4wQIzj1B1H1ud/ZKPGICC");
|
||||
// System.out.println(matches);
|
||||
// }
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 小程序用户修改项目的抽佣比例
|
||||
|
@ -9,6 +9,7 @@ import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.promoCodeApply.PromoCodeApplyAddRequest;
|
||||
@ -82,6 +83,12 @@ public class PromoCodeApplyController {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
// 取出当前项目的推广码
|
||||
Long projectId = promoCodeApplyRequest.getProjectId();
|
||||
//项目状态如果不是运行中的话无法申请推广码
|
||||
LambdaQueryWrapper<Project> projectLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
projectLambdaQueryWrapper.eq(Project::getId, projectId);
|
||||
Project project2 = projectService.getOne(projectLambdaQueryWrapper);
|
||||
String projectStatus = project2.getProjectStatus();
|
||||
if(!projectStatus.equals("running")) throw new BusinessException(ErrorCode.OPERATION_ERROR,"该项目未处于运行状态,无法申请推广码");
|
||||
String phoneNumber = promoCodeApplyRequest.getSalespersonPhone();
|
||||
// 判断是否重复绑定了手机号
|
||||
Map<SFunction<PromoCodeApply, ?>, Object> applyConditions = Map.of(PromoCodeApply::getUserId, userId, PromoCodeApply::getProjectId, projectId, PromoCodeApply::getSalespersonPhone, phoneNumber);
|
||||
@ -100,6 +107,9 @@ public class PromoCodeApplyController {
|
||||
String promoCodeImage = promoCode.getPromoCodeImage();
|
||||
// 获取项目的参数信息
|
||||
Project project = projectService.getById(projectId);
|
||||
// 检查项目是否处于运行中
|
||||
// String projectStatus = project.getProjectStatus();
|
||||
// ThrowUtils.throwIf(!projectStatus.equals("running"), ErrorCode.OPERATION_ERROR, "该项目未处于运行状态,无法申请推广码");
|
||||
|
||||
// 更新项目的推广人数
|
||||
Map<SFunction<UserProject, ?>, Object> projectConditions = Map.of(UserProject::getProjectId, projectId, UserProject::getUserId, userId);
|
||||
@ -110,6 +120,8 @@ public class PromoCodeApplyController {
|
||||
String projectName = project.getProjectName();
|
||||
String projectImage = project.getProjectImage();
|
||||
Integer projectSettlementCycle = project.getProjectSettlementCycle();
|
||||
//判断项目推广人数是否满了
|
||||
|
||||
// 获取业务员信息
|
||||
String salespersonName = promoCodeApplyRequest.getSalespersonName();
|
||||
String salespersonPhone = promoCodeApplyRequest.getSalespersonPhone();
|
||||
|
@ -0,0 +1,17 @@
|
||||
package com.greenorange.promotion.controller.projectSettlement;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
|
||||
@NoArgsConstructor
|
||||
|
||||
@AllArgsConstructor
|
||||
public class Addqurrywithdraw {
|
||||
private Long userid;
|
||||
private BigDecimal payouts;
|
||||
}
|
@ -8,7 +8,9 @@ import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.userAccount.UserAccountQueryRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyAddRequest;
|
||||
import com.greenorange.promotion.model.dto.withdrawalApply.WithdrawalApplyQueryRequest;
|
||||
import com.greenorange.promotion.model.entity.*;
|
||||
@ -24,9 +26,11 @@ import com.greenorange.promotion.service.userInfo.UserInfoService;
|
||||
import com.greenorange.promotion.service.userInfo.UserMainInfoService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.annotation.Priority;
|
||||
import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -47,151 +51,46 @@ import java.util.List;
|
||||
@Slf4j
|
||||
@Tag(name = "提现申请记录管理")
|
||||
public class WithdrawalApplyController {
|
||||
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
@Resource
|
||||
private UserMainInfoService userMainInfoService;
|
||||
@Resource
|
||||
private WithdrawalApplyService withdrawalApplyService;
|
||||
|
||||
@Resource
|
||||
private FundsChangeService fundsChangeService;
|
||||
|
||||
@Resource
|
||||
private CommonService commonService;
|
||||
|
||||
@Resource
|
||||
private UserMainInfoService userMainInfoService;
|
||||
|
||||
@Resource
|
||||
private UserInfoService userInfoService;
|
||||
|
||||
@Resource
|
||||
private UserAccountService userAccountService;
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询账户提现状况
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("query/condition")
|
||||
@Operation(summary = "小程序端用户查询账户提现状况", description = "参数:无,权限:管理员,方法名:queryWithdrawalCondition")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
public BaseResponse<UserAccountConditionVO> queryWithdrawalCondition(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
||||
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
||||
String bankCardNumber = userAccount == null ? "" : userAccount.getBankCardNumber();
|
||||
UserAccountConditionVO userAccountConditionVO = UserAccountConditionVO.builder()
|
||||
.currentBalance(userMainInfo.getCurrentBalance())
|
||||
.bankCardNumber(bankCardNumber)
|
||||
.build();
|
||||
return ResultUtils.success(userAccountConditionVO);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户申请提现
|
||||
* @param withdrawalApplyAddRequest 提现申请记录查添加请求体
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("add")
|
||||
@Operation(summary = "小程序端用户申请提现", description = "参数:提现申请记录查添加请求体,权限:管理员,方法名:addWithdrawalApply")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户申请提现")
|
||||
public BaseResponse<Long> addWithdrawalApply(@Valid @RequestBody WithdrawalApplyAddRequest withdrawalApplyAddRequest, HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserAccount> userAccountLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserAccount::getUserId, userId, userAccountService);
|
||||
UserAccount userAccount = userAccountService.getOne(userAccountLambdaQueryWrapper);
|
||||
ThrowUtils.throwIf(userAccount == null, ErrorCode.OPERATION_ERROR, "请先绑定银行卡");
|
||||
BigDecimal withdrawnAmount = withdrawalApplyAddRequest.getWithdrawnAmount();
|
||||
WithdrawalApply withdrawalApply = WithdrawalApply.builder()
|
||||
.withdrawnAmount(withdrawnAmount)
|
||||
.cardHolder(userAccount.getCardHolder())
|
||||
.idCardNumber(userAccount.getIdCardNumber())
|
||||
.phoneNumber(userAccount.getPhoneNumber())
|
||||
.bankCardNumber(userAccount.getBankCardNumber())
|
||||
.openBank(userAccount.getOpenBank())
|
||||
.userId(userId)
|
||||
.build();
|
||||
@PostMapping("addqurry")
|
||||
public BaseResponse<String> addqurry(@RequestBody Addqurrywithdraw addqurrywithdraw ){
|
||||
Long userid = addqurrywithdraw.getUserid();
|
||||
BigDecimal payouts = addqurrywithdraw.getPayouts();
|
||||
LambdaQueryWrapper<UserMainInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserMainInfo::getUserId, userid);
|
||||
UserMainInfo one = userMainInfoService.getOne(queryWrapper);
|
||||
BigDecimal currentBalance = one.getCurrentBalance();
|
||||
if(payouts.compareTo(currentBalance) > 0) throw new BusinessException(ErrorCode.OPERATION_ERROR,"提现金额超过当前的余额");
|
||||
LambdaQueryWrapper<UserAccount> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.eq(UserAccount::getUserId, userid);
|
||||
UserAccount two = userAccountService.getOne(queryWrapper2);
|
||||
WithdrawalApply withdrawalApply = new WithdrawalApply();
|
||||
BeanUtils.copyProperties(two, withdrawalApply);
|
||||
withdrawalApply.setId(null);
|
||||
withdrawalApply.setUpdateTime(null);
|
||||
withdrawalApply.setCreateTime(null);
|
||||
withdrawalApply.setWithdrawnAmount(payouts);
|
||||
withdrawalApply.setWithdrawalStatus("processing");
|
||||
withdrawalApplyService.save(withdrawalApply);
|
||||
// 修改个人主要信息
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
userMainInfo.setWithdrawalAmount(userMainInfo.getWithdrawalAmount().add(withdrawnAmount));
|
||||
userMainInfo.setCurrentBalance(userMainInfo.getCurrentBalance().subtract(withdrawnAmount));
|
||||
userMainInfoService.updateById(userMainInfo);
|
||||
// 添加资金明细记录
|
||||
FundsChange fundsChange = FundsChange.builder()
|
||||
.projectName("用户提现")
|
||||
.changeAmount(withdrawnAmount.negate())
|
||||
.currentAmount(userMainInfo.getCurrentBalance())
|
||||
.userId(userId)
|
||||
.projectSettlementId(0L)
|
||||
.build();
|
||||
BigDecimal subtract = currentBalance.subtract(payouts);
|
||||
one.setCurrentBalance(subtract);
|
||||
userMainInfoService.updateById(one);
|
||||
FundsChange fundsChange = new FundsChange();
|
||||
fundsChange.setUserId(userid);
|
||||
fundsChange.setChangeAmount(payouts);
|
||||
fundsChange.setProjectName("processing");
|
||||
fundsChange.setCurrentAmount(subtract);
|
||||
fundsChange.setProjectSettlementId(0L);
|
||||
fundsChangeService.save(fundsChange);
|
||||
return ResultUtils.success(withdrawalApply.getId());
|
||||
return ResultUtils.success("提现成功");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询提现申请记录
|
||||
* @return 提现申请记录列表
|
||||
*/
|
||||
@PostMapping("query")
|
||||
@Operation(summary = "小程序端用户查询提现申请记录", description = "参数:无,权限:管理员,方法名:queryWithdrawalApplyByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询提现申请记录")
|
||||
public BaseResponse<List<WithdrawalApplyVO>> queryWithdrawalApplyByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
List<WithdrawalApply> withdrawalApplyList = commonService.findByFieldEqTargetField(WithdrawalApply::getUserId, userId, withdrawalApplyService);
|
||||
List<WithdrawalApplyVO> withdrawalApplyVOS = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
||||
Collections.reverse(withdrawalApplyVOS);
|
||||
return ResultUtils.success(withdrawalApplyVOS);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 小程序端用户查询资金变动记录
|
||||
* @return 提现申请记录id
|
||||
*/
|
||||
@PostMapping("query/change")
|
||||
@Operation(summary = "小程序端用户查询资金变动记录", description = "参数:无,权限:管理员,方法名:queryFundsChangeByUserId")
|
||||
@RequiresPermission(mustRole = UserConstant.DEFAULT_ROLE)
|
||||
// @SysLog(title = "提现申请记录管理", content = "小程序端用户查询资金变动记录")
|
||||
public BaseResponse<FundsItemVO> queryFundsChangeByUserId(HttpServletRequest request) {
|
||||
Long userId = (Long) request.getAttribute("userId");
|
||||
LambdaQueryWrapper<UserMainInfo> userMainInfoLambdaQueryWrapper = commonService.buildQueryWrapperByField(UserMainInfo::getUserId, userId, userMainInfoService);
|
||||
UserMainInfo userMainInfo = userMainInfoService.getOne(userMainInfoLambdaQueryWrapper);
|
||||
FundsItemVO fundsItemVO = commonService.copyProperties(userMainInfo, FundsItemVO.class);
|
||||
List<FundsChange> fundsChangeList = commonService.findByFieldEqTargetField(FundsChange::getUserId, userId, fundsChangeService);
|
||||
List<FundsChangeVO> fundsChangeVOS = commonService.convertList(fundsChangeList, FundsChangeVO.class);
|
||||
Collections.reverse(fundsChangeVOS);
|
||||
fundsItemVO.setFundsChangeVOList(fundsChangeVOS);
|
||||
return ResultUtils.success(fundsItemVO);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Web端管理员分页查询提现申请记录
|
||||
* @param withdrawalApplyQueryRequest 提现申请记录查询请求体
|
||||
* @return 提现申请记录列表
|
||||
*/
|
||||
@PostMapping("page")
|
||||
@Operation(summary = "Web端管理员分页查询提现申请记录", description = "参数:提现申请记录查询请求体,权限:管理员,方法名:listWithdrawalApplyByPage")
|
||||
@RequiresPermission(mustRole = UserConstant.ADMIN_ROLE)
|
||||
@SysLog(title = "提现申请记录管理", content = "Web端管理员分页查询提现申请记录")
|
||||
public BaseResponse<Page<WithdrawalApplyVO>> listWithdrawalApplyByPage(@Valid @RequestBody WithdrawalApplyQueryRequest withdrawalApplyQueryRequest) {
|
||||
long current = withdrawalApplyQueryRequest.getCurrent();
|
||||
long pageSize = withdrawalApplyQueryRequest.getPageSize();
|
||||
QueryWrapper<WithdrawalApply> queryWrapper = withdrawalApplyService.getQueryWrapper(withdrawalApplyQueryRequest);
|
||||
Page<WithdrawalApply> page = withdrawalApplyService.page(new Page<>(current, pageSize), queryWrapper);
|
||||
List<WithdrawalApply> withdrawalApplyList = page.getRecords();
|
||||
List<WithdrawalApplyVO> withdrawalApplyVOList = commonService.convertList(withdrawalApplyList, WithdrawalApplyVO.class);
|
||||
Page<WithdrawalApplyVO> voPage = new Page<>(current, pageSize);
|
||||
voPage.setRecords(withdrawalApplyVOList);
|
||||
voPage.setPages(page.getPages());
|
||||
voPage.setTotal(page.getTotal());
|
||||
return ResultUtils.success(voPage);
|
||||
}
|
||||
}
|
@ -10,6 +10,7 @@ import com.greenorange.promotion.common.BaseResponse;
|
||||
import com.greenorange.promotion.common.ErrorCode;
|
||||
import com.greenorange.promotion.common.ResultUtils;
|
||||
import com.greenorange.promotion.constant.UserConstant;
|
||||
import com.greenorange.promotion.exception.BusinessException;
|
||||
import com.greenorange.promotion.exception.ThrowUtils;
|
||||
import com.greenorange.promotion.model.dto.CommonBatchRequest;
|
||||
import com.greenorange.promotion.model.dto.CommonRequest;
|
||||
@ -30,6 +31,7 @@ import jakarta.annotation.Resource;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.ibatis.io.JBoss6VFS;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@ -303,6 +305,14 @@ public class UserInfoController {
|
||||
@RequiresPermission(mustRole = UserConstant.BOSS_ROLE)
|
||||
@SysLog(title = "用户管理", content = "web端管理员添加用户")
|
||||
public BaseResponse<Boolean> addUserInfo(@Valid @RequestBody UserInfoAddRequest userInfoAddRequest) {
|
||||
String userAccount = userInfoAddRequest.getUserAccount();
|
||||
String userPassword = userInfoAddRequest.getUserPassword();
|
||||
LambdaQueryWrapper<UserInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(UserInfo::getUserRole,"boss");
|
||||
UserInfo one = userInfoService.getOne(queryWrapper);
|
||||
String userAccount2 = one.getUserAccount();
|
||||
String userPassword2 = one.getUserPassword();
|
||||
if(userAccount2.equals(userAccount) && userPassword2.equals(userPassword)) throw new BusinessException(ErrorCode.OPERATION_ERROR,"不能添加跟boss重名的账号和密码");
|
||||
UserInfo userInfo = commonService.copyProperties(userInfoAddRequest, UserInfo.class);
|
||||
userInfo.setParentUserId(-1L);
|
||||
userInfo.setUserRole(UserConstant.ADMIN_ROLE);
|
||||
|
@ -65,7 +65,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
public void updateProjectCommissionRate(ProjectCommissionUpdateRequest projectCommissionUpdateRequest) {
|
||||
Long id = projectCommissionUpdateRequest.getId();
|
||||
BigDecimal currentCommissionRate = projectCommissionUpdateRequest.getCurrentCommissionRate();
|
||||
// 获取当前项目明细信息
|
||||
// 获取当前项目明细抽佣信息
|
||||
ProjectCommission projectCommission = this.getById(id);
|
||||
ThrowUtils.throwIf(projectCommission == null, ErrorCode.OPERATION_ERROR, "项目明细抽佣信息不存在");
|
||||
Long projectDetailId = projectCommission.getProjectDetailId();
|
||||
@ -356,7 +356,7 @@ public class ProjectCommissionServiceImpl extends ServiceImpl<ProjectCommissionM
|
||||
|
||||
startTime = System.currentTimeMillis();
|
||||
|
||||
// 更新用户项目明细抽佣记录
|
||||
// 批量更新用户项目明细抽佣记录
|
||||
List<SubUserProjectCommission> proCommissions = subProjectCommissions.stream().filter(subProjectCommission -> subProjectCommission.getSubUserId() == -1L).toList();
|
||||
List<ProjectCommission> proCommissionList = commonService.convertList(proCommissions, ProjectCommission.class);
|
||||
// this.updateBatchById(proCommissionList);
|
||||
|
@ -68,4 +68,5 @@ public interface UserInfoService extends IService<UserInfo> {
|
||||
* 查询从 userId 一路到根节点的所有 id,按 depth 倒序(根先出)
|
||||
*/
|
||||
List<Long> findPathToRoot(Long userId);
|
||||
|
||||
}
|
||||
|
@ -1,15 +1,21 @@
|
||||
spring:
|
||||
datasource:
|
||||
# driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
# url: jdbc:mysql://27.30.77.229:3306/qingcheng_caozhe?serverTimezone=Asia/Shanghai
|
||||
# username: qingcheng
|
||||
# password: Qc@8ls2jf
|
||||
# hikari:
|
||||
# maximum-pool-size: 300
|
||||
# max-lifetime: 120000
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://27.30.77.229:3306/qingcheng_caozhe?serverTimezone=Asia/Shanghai
|
||||
username: qingcheng
|
||||
password: Qc@8ls2jf
|
||||
url: jdbc:mysql://43.143.28.121:3306/easybbs?serverTimezone=Asia/Shanghai
|
||||
username: easybbs
|
||||
password: root
|
||||
hikari:
|
||||
maximum-pool-size: 300
|
||||
max-lifetime: 120000
|
||||
|
||||
|
||||
|
||||
data:
|
||||
redis:
|
||||
port: 6379
|
||||
|
@ -1,4 +1,4 @@
|
||||
spring:
|
||||
profiles:
|
||||
active: test
|
||||
active: practice
|
||||
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user