修改增加减少用户资金接口

This commit is contained in:
牛叉闪闪 2024-08-20 14:46:12 +08:00
parent a90c441988
commit d6b8919294
1 changed files with 8 additions and 7 deletions

View File

@ -196,7 +196,7 @@ public class TbShopUserServiceImpl implements TbShopUserService {
public void modfiyAccount(Map<String, Object> map) {
if(ObjectUtil.isNull(map)||ObjectUtil.isEmpty(map)||!map.containsKey("id")||!map.containsKey("type")||!map.containsKey("amount")
||ObjectUtil.isEmpty(map.get("id"))||ObjectUtil.isNull(map.get("id"))||ObjectUtil.isNull(map.get("type"))||ObjectUtil.isEmpty(map.get("type"))
||ObjectUtil.isEmpty(map.get("amount"))||ObjectUtil.isNull(map.get("amount"))
||ObjectUtil.isEmpty(map.get("amount"))||ObjectUtil.isNull(map.get("amount"))||!map.containsKey("operationType")||ObjectUtil.isEmpty(map.get("operationType"))||ObjectUtil.isNull(map.get("operationType"))
){
throw new BadRequestException("参数错误");
@ -220,17 +220,18 @@ public class TbShopUserServiceImpl implements TbShopUserService {
throw new BadRequestException("账户余额不足,请输入正确的金额");
}
String operationType=map.get("operationType").toString();
String type=map.get("type").toString();
TbShopUserFlow flow=new TbShopUserFlow();
if("in".equals(type)){
if("in".equals(operationType)){
flow.setType("+");
flow.setBizName("充值退款");
flow.setBizCode("manualIn");
flow.setBizName("inMoney".equals(type)?"充值退款":"消费退款");
flow.setBizCode("inMoney".equals(type)?"inMoneyIn":"consumeIn");
tbShopUser.setAmount(tbShopUser.getAmount().add(amount));
}else if("out".equals(type)){
flow.setBizCode("manualOut");
flow.setBizName("消费");
}else if("out".equals(operationType)){
flow.setBizName("inMoney".equals(type)?"充值退款扣除":"消费扣除");
flow.setBizCode("inMoney".equals(type)?"inMoneyOut":"consumeOut");
flow.setType("-");
tbShopUser.setAmount(tbShopUser.getAmount().subtract(amount));
}else {