余额列表接口
This commit is contained in:
@@ -4,6 +4,7 @@ import com.czg.market.service.MkShopRechargeService;
|
|||||||
import com.czg.market.vo.MemberDetailVO;
|
import com.czg.market.vo.MemberDetailVO;
|
||||||
import com.czg.market.vo.MemberListVO;
|
import com.czg.market.vo.MemberListVO;
|
||||||
import com.czg.market.vo.MkShopRechargeVO;
|
import com.czg.market.vo.MkShopRechargeVO;
|
||||||
|
import com.czg.market.vo.RechargeListVO;
|
||||||
import com.czg.resp.CzgResult;
|
import com.czg.resp.CzgResult;
|
||||||
import com.czg.sa.StpKit;
|
import com.czg.sa.StpKit;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
@@ -34,4 +35,9 @@ public class URechargeController {
|
|||||||
return CzgResult.success(shopRechargeService.detail(shopId));
|
return CzgResult.success(shopRechargeService.detail(shopId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/list")
|
||||||
|
public List<RechargeListVO> getList() {
|
||||||
|
return CzgResult.success(shopRechargeService.getList(StpKit.USER.getLoginIdAsLong()));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,4 +25,7 @@ public interface MkShopRechargeService extends IService<MkShopRecharge> {
|
|||||||
BigDecimal checkRecharge(Long mainShopId, @NotNull(message = "店铺不能为空") Long shopId, Long userId, Long rechargeDetailId, @DecimalMin("0.01") BigDecimal money);
|
BigDecimal checkRecharge(Long mainShopId, @NotNull(message = "店铺不能为空") Long shopId, Long userId, Long rechargeDetailId, @DecimalMin("0.01") BigDecimal money);
|
||||||
|
|
||||||
void recharge(Long shopId, Long shopUserId, Long relatedId, BigDecimal amount, Long paymentId, String payType, ShopUserFlowBizEnum bizEnum);
|
void recharge(Long shopId, Long shopUserId, Long relatedId, BigDecimal amount, Long paymentId, String payType, ShopUserFlowBizEnum bizEnum);
|
||||||
|
|
||||||
|
Object getList(long loginIdAsLong);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.czg.market.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class RechargeListVO {
|
||||||
|
/**
|
||||||
|
* 店铺id
|
||||||
|
*/
|
||||||
|
private Long shopId;
|
||||||
|
/**
|
||||||
|
* 店铺名称
|
||||||
|
*/
|
||||||
|
private String shopName;
|
||||||
|
/**
|
||||||
|
* 金额
|
||||||
|
*/
|
||||||
|
private BigDecimal amount;
|
||||||
|
/**
|
||||||
|
* 店铺logo
|
||||||
|
*/
|
||||||
|
private String logo;
|
||||||
|
}
|
||||||
@@ -23,6 +23,7 @@ import com.czg.market.service.ShopCouponService;
|
|||||||
import com.czg.market.vo.CouponInfoVO;
|
import com.czg.market.vo.CouponInfoVO;
|
||||||
import com.czg.market.vo.MkShopRechargeDetailVO;
|
import com.czg.market.vo.MkShopRechargeDetailVO;
|
||||||
import com.czg.market.vo.MkShopRechargeVO;
|
import com.czg.market.vo.MkShopRechargeVO;
|
||||||
|
import com.czg.market.vo.RechargeListVO;
|
||||||
import com.czg.order.entity.OrderInfo;
|
import com.czg.order.entity.OrderInfo;
|
||||||
import com.czg.service.market.enums.OrderStatusEnums;
|
import com.czg.service.market.enums.OrderStatusEnums;
|
||||||
import com.czg.utils.AssertUtil;
|
import com.czg.utils.AssertUtil;
|
||||||
@@ -186,4 +187,23 @@ public class MkShopRechargeServiceImpl extends ServiceImpl<MkShopRechargeMapper,
|
|||||||
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
shopUserService.updateMoney(shopUserMoneyEditDTO);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getList(long loginIdAsLong) {
|
||||||
|
ArrayList<RechargeListVO> rechargeListVOS = new ArrayList<>();
|
||||||
|
List<ShopUser> shopUserList = shopUserService.list(new QueryWrapper().eq(ShopUser::getUserId, loginIdAsLong));
|
||||||
|
if (shopUserList.isEmpty()) {
|
||||||
|
return rechargeListVOS;
|
||||||
|
}
|
||||||
|
Set<Long> shopIdList = shopUserList.stream().map(ShopUser::getSourceShopId).collect(Collectors.toSet());
|
||||||
|
Map<Long, ShopInfo> shopInfoMap = shopInfoService.list(new QueryWrapper().eq(ShopInfo::getId, shopIdList)).stream().collect(Collectors.toMap(ShopInfo::getId, item -> item));
|
||||||
|
shopUserList.forEach(item -> {
|
||||||
|
ShopInfo shopInfo = shopInfoMap.getOrDefault(item.getSourceShopId(), new ShopInfo());
|
||||||
|
rechargeListVOS.add(new RechargeListVO().setShopName(shopInfo.getShopName())
|
||||||
|
.setShopId(shopInfo.getId())
|
||||||
|
.setAmount(item.getAmount())
|
||||||
|
.setLogo(shopInfo.getLogo()));
|
||||||
|
});
|
||||||
|
return rechargeListVOS;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user