|
@@ -1,10 +1,13 @@
|
|
|
package org.dromara.backstage.payment.service.impl;
|
|
package org.dromara.backstage.payment.service.impl;
|
|
|
|
|
|
|
|
import cn.hutool.core.convert.Convert;
|
|
import cn.hutool.core.convert.Convert;
|
|
|
|
|
+import cn.hutool.core.date.DateUtil;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
+import org.dromara.backstage.cardCenter.domain.PtCard;
|
|
|
import org.dromara.backstage.payment.domain.PtBag;
|
|
import org.dromara.backstage.payment.domain.PtBag;
|
|
|
import org.dromara.backstage.payment.domain.bo.PtBagBo;
|
|
import org.dromara.backstage.payment.domain.bo.PtBagBo;
|
|
|
import org.dromara.backstage.payment.domain.vo.PtBagVo;
|
|
import org.dromara.backstage.payment.domain.vo.PtBagVo;
|
|
@@ -75,7 +78,6 @@ public class PtBagServiceImpl implements IPtBagService {
|
|
|
lqw.eq(bo.getUserId() != null, PtBag::getUserId, bo.getUserId());
|
|
lqw.eq(bo.getUserId() != null, PtBag::getUserId, bo.getUserId());
|
|
|
lqw.eq(StringUtils.isNotBlank(bo.getBagCode()), PtBag::getBagCode, bo.getBagCode());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getBagCode()), PtBag::getBagCode, bo.getBagCode());
|
|
|
lqw.eq(bo.getBalance() != null, PtBag::getBalance, bo.getBalance());
|
|
lqw.eq(bo.getBalance() != null, PtBag::getBalance, bo.getBalance());
|
|
|
- lqw.eq(StringUtils.isNotBlank(bo.getEncryptBalance()), PtBag::getEncryptBalance, bo.getEncryptBalance());
|
|
|
|
|
lqw.eq(bo.getConsumeTotal() != null, PtBag::getConsumeTotal, bo.getConsumeTotal());
|
|
lqw.eq(bo.getConsumeTotal() != null, PtBag::getConsumeTotal, bo.getConsumeTotal());
|
|
|
lqw.eq(bo.getConsumeCount() != null, PtBag::getConsumeCount, bo.getConsumeCount());
|
|
lqw.eq(bo.getConsumeCount() != null, PtBag::getConsumeCount, bo.getConsumeCount());
|
|
|
lqw.eq(bo.getRechargeTotal() != null, PtBag::getRechargeTotal, bo.getRechargeTotal());
|
|
lqw.eq(bo.getRechargeTotal() != null, PtBag::getRechargeTotal, bo.getRechargeTotal());
|
|
@@ -178,7 +180,7 @@ public class PtBagServiceImpl implements IPtBagService {
|
|
|
PtBagBo bo = new PtBagBo();
|
|
PtBagBo bo = new PtBagBo();
|
|
|
bo.setUserId(userId);
|
|
bo.setUserId(userId);
|
|
|
List<PtBagVo> listVo = SpringUtils.getAopProxy(this).queryList(bo);
|
|
List<PtBagVo> listVo = SpringUtils.getAopProxy(this).queryList(bo);
|
|
|
- if(listVo.isEmpty()){
|
|
|
|
|
|
|
+ if (listVo.isEmpty()) {
|
|
|
//没有钱包,初始化
|
|
//没有钱包,初始化
|
|
|
for (int i = 1; i < 7; i++) {
|
|
for (int i = 1; i < 7; i++) {
|
|
|
bo = new PtBagBo();
|
|
bo = new PtBagBo();
|
|
@@ -189,24 +191,37 @@ public class PtBagServiceImpl implements IPtBagService {
|
|
|
}
|
|
}
|
|
|
return true;
|
|
return true;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 账户钱包充值
|
|
* 账户钱包充值
|
|
|
*
|
|
*
|
|
|
* @param bo 账户钱包
|
|
* @param bo 账户钱包
|
|
|
- * @return 是否修改成功
|
|
|
|
|
|
|
+ * @return 是否充值成功
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
public Boolean rechargeByBo(PtBagBo bo) {
|
|
public Boolean rechargeByBo(PtBagBo bo) {
|
|
|
- return null;
|
|
|
|
|
|
|
+ return baseMapper.update(null, new LambdaUpdateWrapper<PtBag>()
|
|
|
|
|
+ .set(PtBag::getBalance, bo.getBalance())
|
|
|
|
|
+ .set(PtBag::getEncryptBalance, bo.getEncryptBalance())
|
|
|
|
|
+ .set(PtBag::getRechargeCount, bo.getRechargeTotal())
|
|
|
|
|
+ .set(PtBag::getRechargeTotal, bo.getRechargeTotal())
|
|
|
|
|
+ .eq(PtBag::getBagCode, bo.getBagCode())
|
|
|
|
|
+ .eq(PtBag::getUserId, bo.getUserId())) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
- * 账户钱包退款
|
|
|
|
|
|
|
+ * 账户钱包退款/直接更新余额
|
|
|
*
|
|
*
|
|
|
* @param bo 账户钱包
|
|
* @param bo 账户钱包
|
|
|
- * @return 是否修改成功
|
|
|
|
|
|
|
+ * @return 是否更新成功
|
|
|
*/
|
|
*/
|
|
|
@Override
|
|
@Override
|
|
|
- public Boolean refundByBo(PtBagBo bo) {
|
|
|
|
|
- return null;
|
|
|
|
|
|
|
+ public Boolean updateBalanceByBo(PtBagBo bo) {
|
|
|
|
|
+ return baseMapper.update(null, new LambdaUpdateWrapper<PtBag>()
|
|
|
|
|
+ .set(PtBag::getBalance, bo.getBalance())
|
|
|
|
|
+ .set(PtBag::getEncryptBalance, bo.getEncryptBalance())
|
|
|
|
|
+ .eq(PtBag::getBagCode, bo.getBagCode())
|
|
|
|
|
+ .eq(PtBag::getUserId, bo.getUserId())) > 0;
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
}
|
|
}
|