4 files modified
5 files added
| | |
| | | import com.ruoyi.system.domain.*; |
| | | import com.ruoyi.system.domain.dto.UserPolicyDto; |
| | | import com.ruoyi.system.mapper.UserPolicyMapper; |
| | | import com.ruoyi.system.service.FundsLogService; |
| | | import com.ruoyi.system.service.GroupWelcomeConfigService; |
| | | import com.ruoyi.system.service.PaymentRecordService; |
| | | import com.ruoyi.system.service.UserAccountService; |
| | |
| | | private UserKycService userKycService; |
| | | @Autowired |
| | | private GroupWelcomeConfigService groupWelcomeConfigService; |
| | | @Autowired |
| | | private FundsLogService fundsLogService; |
| | | |
| | | |
| | | @Override |
| | |
| | | paymentRecord.setProductName(insuranceProduct.getProductName()); |
| | | paymentRecord.setModePayment(3); |
| | | paymentRecordService.save(paymentRecord); |
| | | |
| | | fundsLogService.addLog(userAccount.getId(), userAccount.getAccount(), insuranceProduct.getPremium(), OperationType.USER_ORDER); |
| | | // 生成资金日志 |
| | | return Result.success(); |
| | | } |
| | | } |
| | |
| | | */ |
| | | @GetMapping("/getAccountPassword") |
| | | @Transactional |
| | | public AjaxResult getAccountPassword(@RequestParam(value = "account") String account) { |
| | | public AjaxResult getAccountPassword(@RequestParam(value = "account",required = false) String account) { |
| | | if(ObjectUtil.isEmpty(account)){ |
| | | return AjaxResult.error("请输入查询账号!"); |
| | | } |
| | | UserAccount userAccount = userAccountService.getOne(new LambdaQueryWrapper<>(UserAccount.class) |
| | | .eq(UserAccount::getAccount, account) |
| | | ); |
| | |
| | | import com.ruoyi.system.domain.dto.UserPolicyDto; |
| | | import com.ruoyi.im.service.UserPolicyService; |
| | | import com.ruoyi.system.domain.out.UserTeamAndPositionOut; |
| | | import com.ruoyi.system.service.FundsLogService; |
| | | import com.ruoyi.system.service.PaymentRecordService; |
| | | import com.ruoyi.system.service.UserAccountService; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | |
| | | @Autowired |
| | | PaymentRecordService paymentRecordService; |
| | | |
| | | @Autowired |
| | | FundsLogService fundsLogService; |
| | | |
| | | @Value("${pay.key}") |
| | | private String key; |
| | |
| | | |
| | | userAccount.setBalance(userAccount.getBalance().add(userPolicy.getPremium())); |
| | | userAccountService.updateById(userAccount); |
| | | fundsLogService.addLog(userAccount.getId(), userAccount.getAccount(), userPolicy.getPremium(), OperationType.REFUND); |
| | | |
| | | return AjaxResult.success("审批成功"); |
| | | } |
| | | |
| | |
| | | return AjaxResult.success("删除成功"); |
| | | } |
| | | |
| | | /** |
| | | * 保单列表 |
| | | */ |
| | | @GetMapping("/getFundsLogList") |
| | | public TableDataInfo getFundsLogList(@RequestParam(value = "account",required = false) String account,@RequestParam(value = "operationType",required = false) Integer operationType) { |
| | | startPage(); |
| | | |
| | | LambdaQueryWrapper<FundsLog> wrapper = new LambdaQueryWrapper<>(); |
| | | |
| | | if(StringUtils.isNotEmpty(account)){ |
| | | wrapper.eq(FundsLog::getAccount,account); |
| | | } |
| | | if (ObjectUtil.isNotEmpty(operationType)){ |
| | | wrapper.eq(FundsLog::getOperationType,operationType); |
| | | } |
| | | wrapper.orderByDesc(FundsLog::getCreateTime); |
| | | List<FundsLog> list = fundsLogService.list(wrapper); |
| | | return getDataTable(list); |
| | | } |
| | | } |
| | |
| | | import cn.hutool.core.util.ObjectUtil; |
| | | import com.ruoyi.common.core.domain.AjaxResult; |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.domain.OperationType; |
| | | import com.ruoyi.system.domain.UserAccount; |
| | | import com.ruoyi.system.domain.UserKyc; |
| | | import com.ruoyi.system.service.FundsLogService; |
| | | import com.ruoyi.system.service.UserAccountService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | |
| | | |
| | | @Autowired |
| | | UserAccountService userAccountService; |
| | | |
| | | @Autowired |
| | | FundsLogService fundsLogService; |
| | | |
| | | /** |
| | | * 用户资金操作 |
| | |
| | | return AjaxResult.success("充值类型错误"); |
| | | } |
| | | userAccountService.updateById(userAccount); |
| | | |
| | | fundsLogService.addLog(userAccount.getId(), userAccount.getAccount(), money, type == 1 ? OperationType.ADMIN_RECHARGE : OperationType.ADMIN_DEDUCTION); |
| | | |
| | | return AjaxResult.success("充值成功"); |
| | | }catch (Exception e){ |
| | | e.printStackTrace(); |
| New file |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | import lombok.Data; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.time.LocalDateTime; |
| | | |
| | | @Data |
| | | public class FundsLog { |
| | | |
| | | /** |
| | | * 主键ID |
| | | */ |
| | | private Long id; |
| | | |
| | | /** |
| | | * 用户ID |
| | | */ |
| | | private Integer userId; |
| | | |
| | | /** |
| | | * 账号 |
| | | */ |
| | | private String account; |
| | | |
| | | /** |
| | | * 操作类型 |
| | | * 1-后台充值 2-后台扣款 3-用户下单 4-退款 |
| | | */ |
| | | private Integer operationType; |
| | | |
| | | /** |
| | | * 操作金额 |
| | | */ |
| | | private BigDecimal amount; |
| | | |
| | | /** |
| | | * 创建时间 |
| | | */ |
| | | private LocalDateTime createTime; |
| | | |
| | | /** |
| | | * 更新时间 |
| | | */ |
| | | private LocalDateTime updateTime; |
| | | |
| | | // 构造方法 |
| | | public FundsLog() { |
| | | this.createTime = LocalDateTime.now(); |
| | | this.updateTime = LocalDateTime.now(); |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.domain; |
| | | |
| | | /** |
| | | * 资金操作类型枚举 |
| | | */ |
| | | public enum OperationType { |
| | | |
| | | /** |
| | | * 后台充值 - 1 |
| | | */ |
| | | ADMIN_RECHARGE(1, "后台充值"), |
| | | |
| | | /** |
| | | * 后台扣款 - 2 |
| | | */ |
| | | ADMIN_DEDUCTION(2, "后台扣款"), |
| | | |
| | | /** |
| | | * 用户下单 - 3 |
| | | */ |
| | | USER_ORDER(3, "用户下单"), |
| | | |
| | | /** |
| | | * 退款 - 4 |
| | | */ |
| | | REFUND(4, "退款"); |
| | | |
| | | private final int code; |
| | | private final String description; |
| | | |
| | | OperationType(int code, String description) { |
| | | this.code = code; |
| | | this.description = description; |
| | | } |
| | | |
| | | public int getCode() { |
| | | return code; |
| | | } |
| | | |
| | | public String getDescription() { |
| | | return description; |
| | | } |
| | | |
| | | /** |
| | | * 根据代码获取操作类型枚举 |
| | | * @param code 操作类型代码 |
| | | * @return 对应的枚举值,如果不存在返回null |
| | | */ |
| | | public static OperationType getByCode(int code) { |
| | | for (OperationType type : values()) { |
| | | if (type.getCode() == code) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * 根据描述获取操作类型枚举 |
| | | * @param description 操作类型描述 |
| | | * @return 对应的枚举值,如果不存在返回null |
| | | */ |
| | | public static OperationType getByDescription(String description) { |
| | | for (OperationType type : values()) { |
| | | if (type.getDescription().equals(description)) { |
| | | return type; |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import com.ruoyi.system.domain.FundsLog; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | |
| | | @Mapper |
| | | public interface FundsLogMapper extends BaseMapper<FundsLog> { |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.service; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.ruoyi.system.domain.FundsLog; |
| | | import com.ruoyi.system.domain.InvitationBlacklist; |
| | | import com.ruoyi.system.domain.OperationType; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | public interface FundsLogService extends IService<FundsLog> { |
| | | |
| | | |
| | | /** |
| | | * 后台充值 |
| | | * @param userId 用户ID |
| | | * @param account 账户标识 |
| | | * @param amount 充值金额 |
| | | * @return 记录成功的资金日志ID |
| | | */ |
| | | void addLog(Integer userId, String account, BigDecimal amount,OperationType operationType); |
| | | |
| | | } |
| New file |
| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.domain.FundsLog; |
| | | import com.ruoyi.system.domain.OperationType; |
| | | import com.ruoyi.system.mapper.FundsLogMapper; |
| | | import com.ruoyi.system.service.FundsLogService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class FundsLogServiceImpl extends ServiceImpl<FundsLogMapper, FundsLog> implements FundsLogService { |
| | | |
| | | |
| | | @Override |
| | | public void addLog(Integer userId, String account, BigDecimal amount, OperationType operationType) { |
| | | // 创建资金日志记录 |
| | | FundsLog fundsLog = new FundsLog(); |
| | | fundsLog.setUserId(userId); |
| | | fundsLog.setAccount(account); |
| | | fundsLog.setOperationType(operationType.getCode()); |
| | | fundsLog.setAmount(amount); |
| | | save(fundsLog); |
| | | } |
| | | } |