From 7bb22a32cf85b16dee6ac6acb6b1e0e241ab89f1 Mon Sep 17 00:00:00 2001
From: 无关风月 <443237572@qq.com>
Date: 星期五, 30 八月 2024 17:04:37 +0800
Subject: [PATCH] 代码提交
---
ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java | 39 ++++++++++++++++++++++++++++++++++++++-
1 files changed, 38 insertions(+), 1 deletions(-)
diff --git a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
index 4526dc4..d15b333 100644
--- a/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
+++ b/ruoyi-service/ruoyi-other/src/main/java/com/ruoyi/other/service/impl/TVipServiceImpl.java
@@ -1,10 +1,20 @@
package com.ruoyi.other.service.impl;
-import com.ruoyi.other.model.TVip;
+import com.alibaba.fastjson.JSONArray;
+import com.alibaba.fastjson.JSONObject;
+import com.ruoyi.common.core.web.page.PageInfo;
+import com.ruoyi.other.api.domain.TCoupon;
+import com.ruoyi.other.api.domain.TVip;
+import com.ruoyi.other.mapper.TCouponMapper;
import com.ruoyi.other.mapper.TVipMapper;
import com.ruoyi.other.service.TVipService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.apache.poi.util.StringUtil;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
+import org.springframework.util.StringUtils;
+
+import java.util.List;
/**
* <p>
@@ -17,4 +27,31 @@
@Service
public class TVipServiceImpl extends ServiceImpl<TVipMapper, TVip> implements TVipService {
+ @Autowired
+ private TCouponMapper tCouponMapper;
+ @Override
+ public PageInfo<TVip> pageList(Integer pageCurr,Integer pageSize) {
+ PageInfo<TVip> pageInfo = new PageInfo<>(pageCurr,pageSize);
+ List<TVip> list = this.baseMapper.pageList(pageInfo);
+
+ for (TVip tVip : list) {
+ String coupon = tVip.getCoupon();
+ if (StringUtils.hasLength(coupon)){
+ JSONArray jsonArray = JSONObject.parseArray(coupon);
+ StringBuilder stringBuilder = new StringBuilder();
+ for (int i = 0; i < jsonArray.size(); i++) {
+ JSONObject jsonObject = jsonArray.getJSONObject(i);
+ Integer id = jsonObject.getInteger("id");
+ Integer number = jsonObject.getInteger("number");
+ TCoupon tCoupon = tCouponMapper.selectById(id);
+ if (tCoupon!=null){
+ stringBuilder.append(tCoupon.getName()).append("*").append(number).append(";");
+ }
+ }
+ tVip.setCouponName(stringBuilder.toString());
+ }
+ }
+ pageInfo.setRecords(list);
+ return pageInfo;
+ }
}
--
Gitblit v1.7.1