init
This commit is contained in:
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.service.AccountCashService;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||
@@ -15,6 +16,7 @@ import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.core.validate.AddGroup;
|
||||
import com.ruoyi.common.core.validate.EditGroup;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -23,8 +25,11 @@ import org.springframework.web.bind.annotation.*;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 用户提现记录
|
||||
@@ -76,38 +81,54 @@ public class AccountCashController extends BaseController {
|
||||
return R.ok(accountCashService.getById(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户提现记录
|
||||
*/
|
||||
@SaCheckPermission("cai:accountCash:add")
|
||||
@Log(title = "用户提现记录", businessType = BusinessType.INSERT)
|
||||
// @SaCheckPermission("cai:accountCash:edit")
|
||||
@Log(title = "用户提现通过", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PostMapping()
|
||||
public R<Void> add(@Validated(AddGroup.class) @RequestBody AccountCash bo) {
|
||||
return toAjax(accountCashService.save(bo));
|
||||
@GetMapping("/success")
|
||||
public R<Void> success(Long id) {
|
||||
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.SUCCESS.getCode())
|
||||
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
|
||||
.eq(AccountCash::getId,id));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户提现记录
|
||||
*/
|
||||
@SaCheckPermission("cai:accountCash:edit")
|
||||
@Log(title = "用户提现记录", businessType = BusinessType.UPDATE)
|
||||
@Log(title = "用户提现不通过", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@PutMapping()
|
||||
public R<Void> edit(@Validated(EditGroup.class) @RequestBody AccountCash bo) {
|
||||
return toAjax(accountCashService.updateById(bo));
|
||||
@GetMapping("/fail")
|
||||
public R<Void> fail(Long id) {
|
||||
accountCashService.fail(id);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除用户提现记录
|
||||
*
|
||||
* @param ids 主键串
|
||||
*/
|
||||
@SaCheckPermission("cai:accountCash:remove")
|
||||
@Log(title = "用户提现记录", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||
@PathVariable Integer[] ids) {
|
||||
return toAjax(accountCashService.removeBatchByIds(Arrays.asList(ids)));
|
||||
|
||||
@Log(title = "用户提现取消", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@GetMapping("/close")
|
||||
public R<Void> close(Long id) {
|
||||
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.CLOSE.getCode())
|
||||
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
|
||||
.eq(AccountCash::getId,id));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@Log(title = "用户提现批量通过", businessType = BusinessType.UPDATE)
|
||||
@RepeatSubmit()
|
||||
@GetMapping("/batchSuccess")
|
||||
public R<Void> batchSuccess(String ids) {
|
||||
List<String> idList = Arrays.stream(ids.split(",")).collect(Collectors.toList());
|
||||
accountCashService.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.SUCCESS.getCode())
|
||||
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
|
||||
.in(AccountCash::getId,idList));
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ public enum AccountChangeEnum {
|
||||
USER_GUARD(105,"送出守护","送出守护","GUARD",""),
|
||||
USER_VIDEO(106,"视频支出","视频支出","VIDEO",""),
|
||||
USER_IM(107,"聊天支出","聊天支出","IM",""),
|
||||
WITHDRAW(108,"提现","提现","","WITHDRAW"),
|
||||
WITHDRAW(108,"提现","提现","WITHDRAW",""),
|
||||
WITHDRAW_ROLLBACK(109,"提现失败","提现失败","WITHDRAW",""),
|
||||
|
||||
// 主播端
|
||||
ANCHOR_GIFT(201,"收到礼物","收到礼物","GIFT",""),
|
||||
|
||||
@@ -18,4 +18,6 @@ public interface AccountCashService extends IService<AccountCash> {
|
||||
void withdraw(WithdrawReq res);
|
||||
|
||||
Page<AccountCashAdminVo> pageAdmin(PageQuery pageQuery, AccountCashAdminVo bo);
|
||||
|
||||
void fail(Long id);
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ruoyi.cai.enums.AccountBusinessEnum;
|
||||
import com.ruoyi.cai.enums.AccountChangeEnum;
|
||||
import com.ruoyi.cai.ws.bean.Room;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 用户账户Service接口
|
||||
@@ -29,6 +30,9 @@ public interface AccountService extends IService<Account> {
|
||||
|
||||
void withdraw(Long userId, Long incomeCoin, Long traceId);
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
void withdrawFail(Long userId, Long incomeCoin, Long traceId);
|
||||
|
||||
void recharge(ConsumeLog consumeLog);
|
||||
|
||||
Page<AccountAdminVo> pageAdmin(PageQuery pageQuery, AccountAdminVo bo);
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.ruoyi.cai.domain.AccountCash;
|
||||
import com.ruoyi.cai.domain.WithdrawExchange;
|
||||
import com.ruoyi.cai.dto.admin.vo.AccountCashAdminVo;
|
||||
import com.ruoyi.cai.dto.app.query.WithdrawReq;
|
||||
import com.ruoyi.cai.enums.AccountCashStatusEnum;
|
||||
import com.ruoyi.cai.manager.IdManager;
|
||||
import com.ruoyi.cai.mapper.AccountCashMapper;
|
||||
import com.ruoyi.cai.service.AccountCashService;
|
||||
@@ -16,10 +17,12 @@ import com.ruoyi.cai.service.AccountService;
|
||||
import com.ruoyi.cai.service.WithdrawExchangeService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
import com.ruoyi.common.exception.ServiceException;
|
||||
import com.ruoyi.common.utils.ServletUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Service
|
||||
public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, AccountCash> implements AccountCashService {
|
||||
@@ -61,4 +64,25 @@ public class AccountCashServiceImpl extends ServiceImpl<AccountCashMapper, Accou
|
||||
public Page<AccountCashAdminVo> pageAdmin(PageQuery pageQuery, AccountCashAdminVo bo) {
|
||||
return baseMapper.pageAdmin(pageQuery.build(),bo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fail(Long id) {
|
||||
AccountCash accountCash = this.getById(id);
|
||||
if(accountCash == null){
|
||||
return;
|
||||
}
|
||||
boolean update = this.update(Wrappers.lambdaUpdate(AccountCash.class)
|
||||
.set(AccountCash::getVerifyTime, LocalDateTime.now())
|
||||
.set(AccountCash::getOperateIp, ServletUtils.getClientIP())
|
||||
.set(AccountCash::getStatus, AccountCashStatusEnum.FAIL.getCode())
|
||||
.eq(AccountCash::getStatus, AccountCashStatusEnum.READY.getCode())
|
||||
.eq(AccountCash::getId, id));
|
||||
if(!update){
|
||||
return;
|
||||
}
|
||||
accountService.withdrawFail(accountCash.getUserId(),accountCash.getWithdrawCoin(),accountCash.getTraceId());
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@ import com.ruoyi.cai.util.NumCaUtil;
|
||||
import com.ruoyi.cai.ws.bean.Room;
|
||||
import com.ruoyi.cai.ws.bean.RoomData;
|
||||
import com.ruoyi.cai.ws.bean.UserData;
|
||||
import com.ruoyi.cai.ws.cache.RoomDataCache;
|
||||
import com.ruoyi.cai.ws.constant.RoomStatusEnums;
|
||||
import com.ruoyi.cai.ws.service.RoomService;
|
||||
import com.ruoyi.common.core.domain.PageQuery;
|
||||
@@ -184,6 +183,18 @@ public class AccountServiceImpl extends ServiceImpl<AccountMapper, Account> impl
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountChangeEnum.WITHDRAW,incomeCoin,traceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void withdrawFail(Long userId, Long incomeCoin, Long traceId){
|
||||
User user = userService.getById(userId);
|
||||
Account account = this.getByUserId(userId);
|
||||
if(account == null || user == null){
|
||||
throw new ServiceException("无效账号");
|
||||
}
|
||||
baseMapper.incsIncomeCoin(userId, incomeCoin);
|
||||
accountChangeLogService.saveLogNoAdmin(user.getId(),user.getUsercode(), RechargeTypeEnum.COIN_INCOME,AccountChangeEnum.WITHDRAW_ROLLBACK,incomeCoin,traceId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void recharge(ConsumeLog consumeLog){
|
||||
|
||||
@@ -8,7 +8,7 @@ import java.util.Base64;
|
||||
public class AES {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
String jsonData ="zTmtrzE4t6jFriRIde3X+C3rgTo2LdYZSgiP8yg6cXY/0/05hSvBlfa97rZKGrDfVWWqcKdnivwnvoAzzUnxsr5YDkYPgoFHVSzcsBFXTCbPJfMkinjtY5nFsf4oXMATOe1WTHOpcAqfQ9bHcEB1oAVSt5SQvIFiw9uUPTS6IgS6waZtJT5/h9SJElisYboJ/47YavVUz8j4oDrUcwzB2KyJqJrjBlV0YSkT1/OAtlau1yJIuNX3THeN6BBA9dpmhn8f3YC/sqzsmGl7p2nbV4WxQxdI8bV855/fUn0/7lOAQM+s82hEal79J+3VQ+cexhWejit3uR0/l0T+p+u5WlICW/V0O65LGiZYNL2MGotVai1Tjog5G223VrWwf3VDOLlOuKK1HbH8MEXM6kahJ5EnxgIi4hKa0k63r7WOgJKLMxFzJsxRRy6lQfems3NOELwNCHzKaMa1ZgHTRzkOUvcPdYj1JuLIRZkMyPgKJbW10QJJbkeGuqr5YN9kl7zdA2omJFVL/0l9v0i1TC6WV7yME+2YU04OCSNWYDISPeDw4D9k1XurHbD1iQDFjPaDiBA/euhgKDUz4V7MeDqUsMUKq0G9mrXHwJx2Euf7yWoaKr0N4v5a9dsqf+yHQm/Iww1VWRGL+qW2ko265rpH+cDyhZia9r2ovvgbXgjW07GQGEXW7i4BbF27bdNRXz6Zl0eLAfgSHM4uLEVYLnahCM3qZc2d2mWpo3oQWp3Hs/CaeUAbFstBfZTCUB28PunGVA7XRMXqU/1fV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cLTmCzVyuTIEvmp5lVzfMYG79hYSpjEHTqlD41NMuJkI/EhzPKaNdi5RP+DlIpS5sAwPQmyR+nGxgeejCoAZ1qRIoS7f7F9cHNFcgnSsjgsrHt83S7A5qyb6LNy5RnxFxrM144bvysB0e6RawUp2im5cIN3UH9h1dulg6/mIxibK/amgpzcBxwEjGxFH5AbsikBGsOFNEfJOeYw1WPe08N/w2nvxOubTXah3TpiogVpl3Lf1tntuF3tFu8n3z/YMSuKWe4bPLOTTcUN65L7z41iod+7EqzfRqMfL/4MwBR2ZxAkX/BLIasOXLpa/uFQMiAjU747VUnDKqty+ymLDI5y9F+LO4is+hiXRtqou07z+nqE+Vnlu6l3MXHn3k/K0VlmVk63S0Uu4WZv4MAE1DZxpXTA8oPRtQS7uBnWgS47f5NoGD2kxIRaGYM3EGNX/RtmQ4KvUZ0hCVs9Z/0YTq+iEUskTsw4vSRJrRYndHWbyXRZ7hs8s5NNxQ3rkvvPjWKhh7FhEF6Hqbbr/1vt4CQsUiRf8Eshqw5culr+4VAyICNTvjtVScMqq3L7KYsMjnL0X4s7iKz6GJdG2qi7TvP6eoT5WeW7qXcxcefeT8rRWWZWTrdLRS7hZm/gwATUNnGlTMYMdW/5icrsjddgU9zCsTcCfjYArCAQnjzEjkzOm6s9A6iET/P0LetlyupSe+zH";
|
||||
String jsonData ="zTmtrzE4t6jFriRIde3X+AFG9PQPSTQb5GrZcsBZySFUne3NGpRbb19LUbcKKLaRXj31TSE6nrVz3jLD7nCH+ArJzZwEgMb3hLXZPh53Xluk1Rkq/8wUMsDhAWjPRG012dhoaINUggAJwDKvKDqRgA==";
|
||||
// String jsonData = "123";
|
||||
String key = "K2AwvosrwtoAgOEP";
|
||||
String encod = encrypt(jsonData, key);
|
||||
|
||||
Reference in New Issue
Block a user