From 0508482e0c67102acfdc73ea681c6962f045d471 Mon Sep 17 00:00:00 2001 From: DB <2502523450@qq.com> Date: Wed, 10 Jan 2024 11:57:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BA=91=E5=87=BD=E6=95=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/dto/CloudCourseStudentDto.java | 18 -- .../core/dto/CloudCourseStudentListDto.java | 40 +++ .../cloudDb/core/dto/CloudCustomerDto.java | 19 +- .../api/cloudDb/core/dto/CloudStudentDto.java | 3 +- .../handler/CloudClassCardHandler.java | 134 +++++++++ .../cloudDb/handler/CloudClassHandler.java | 118 ++++++++ .../cloudDb/handler/CloudCourseHandler.java | 58 +++- .../cloudDb/handler/CloudOrderHandler.java | 86 ++++++ .../cloudDb/handler/CloudStaffHandler.java | 72 +++++ .../com/cpop/core/base/entity/ExtendPage.java | 31 +++ .../com/cpop/oam/web/CpopCloudDbTests.java | 29 ++ .../backstage/CloudDataController.java | 257 ++++++++++++++++-- 12 files changed, 826 insertions(+), 39 deletions(-) create mode 100644 Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentListDto.java create mode 100644 Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java create mode 100644 Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java create mode 100644 Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java create mode 100644 Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java create mode 100644 Cpop-Core/src/main/java/com/cpop/core/base/entity/ExtendPage.java diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java index c2996a9..000ef89 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java @@ -96,24 +96,6 @@ public class CloudCourseStudentDto { @SerializedName("_periodid") private String cardId; - /** - * 总余额 - */ - @SerializedName("allAmount") - private BigDecimal deductionTotalBalance; - - /** - * 总课时 - */ - @SerializedName("allNumber") - private Long deductionTotalPeriod; - - /** - * 总课消 - */ - @SerializedName("number") - private Long classTotalDepletion; - /** * 状态操作时间 */ diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentListDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentListDto.java new file mode 100644 index 0000000..a00d83a --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentListDto.java @@ -0,0 +1,40 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 18:26 + */ +@Data +public class CloudCourseStudentListDto { + + /** + * 课程学员列表 + */ + @SerializedName("list") + List records; + + /** + * 总余额 + */ + @SerializedName("allAmount") + private BigDecimal deductionTotalBalance; + + /** + * 总课时 + */ + @SerializedName("allNumber") + private Long deductionTotalPeriod; + + /** + * 总课消 + */ + @SerializedName("allPeriodIncome") + private Long classTotalDepletion; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCustomerDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCustomerDto.java index 6c1e489..50a16d5 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCustomerDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCustomerDto.java @@ -31,6 +31,23 @@ public class CloudCustomerDto { @SerializedName("name") private String customerName; + /** + * 学员名 + */ + private String studentName; + + /** + * 顾问 + */ + @SerializedName("staffName") + private String counselor; + + /** + * 生效课卡数 + */ + @SerializedName("periodNum") + private String activeCardNum; + /** * 手机号 */ @@ -51,5 +68,5 @@ public class CloudCustomerDto { * 顾问id */ @SerializedName("_staffId") - private String counselor; + private String counselorId; } diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStudentDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStudentDto.java index 53875b9..dedf655 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStudentDto.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStudentDto.java @@ -26,7 +26,8 @@ public class CloudStudentDto { /** * 学员名 */ - private String name; + @SerializedName("name") + private String studentName; /** * 生日 diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java new file mode 100644 index 0000000..9878639 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassCardHandler.java @@ -0,0 +1,134 @@ +package com.cpop.api.cloudDb.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.cloudDb.core.constant.CloudDbUrl; +import com.cpop.api.cloudDb.core.dto.CloudClassCardDto; +import com.cpop.api.cloudDb.core.dto.CloudClassCardRecordDto; +import com.cpop.api.cloudDb.core.dto.CloudClassStudentDto; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.exception.UtilException; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.List; + +/** + * 云课卡工具类 + * @author DB + * @version 1.0.0 + * @since 2024-01-10 11:08 + */ +@Component +public class CloudClassCardHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取课卡分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param customerId 客户id + * @param cardId 课卡id + * @param cardType 课卡类型 + * @param cardStatus 课卡状态 + * @return Page + */ + public Page getClassCardPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String customerId, String cardId, String cardType, Integer cardStatus) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "period"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(customerId)) { + jsonBody.put("customerId", customerId); + } + if (StringUtils.isNotBlank(cardId)) { + jsonBody.put("cardId", cardId); + } + if (StringUtils.isNotBlank(cardType)) { + jsonBody.put("cardType", cardType); + } + if (cardStatus != null) { + jsonBody.put("cardStatus", cardStatus); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + Page page = Page.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudClassCardDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } + + /** + * 获取课卡记录分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param customerId 客户id + * @param cardId 课卡id + * @return Page + */ + public Page getClassCardRecordPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String customerId, String cardId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "periodLog"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(customerId)) { + jsonBody.put("customerId", customerId); + } + if (StringUtils.isNotBlank(cardId)) { + jsonBody.put("cardId", cardId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + Page page = Page.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudClassCardRecordDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java new file mode 100644 index 0000000..ad21ce0 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudClassHandler.java @@ -0,0 +1,118 @@ +package com.cpop.api.cloudDb.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.cloudDb.core.constant.CloudDbUrl; +import com.cpop.api.cloudDb.core.dto.CloudClassDto; +import com.cpop.api.cloudDb.core.dto.CloudClassStudentDto; +import com.cpop.api.cloudDb.core.dto.CloudCourseDto; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.exception.UtilException; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.List; + +/** + * 云班级工具类 + * @author DB + * @version 1.0.0 + * @since 2024-01-10 10:05 + */ +@Component +public class CloudClassHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取班级分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param classId 云班级id + * @return Page + */ + public Page getClassPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String classId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "classes"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(classId)){ + jsonBody.put("classId", classId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + Page page = Page.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudClassDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } + + /** + * 获取班级学员分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param classId 云班级id + * @return Page + */ + public Page getClassStudentPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String classId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "classesStudent"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(classId)){ + jsonBody.put("classId", classId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + Page page = Page.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudClassStudentDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java index f03abc5..c04119b 100644 --- a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.java @@ -3,14 +3,18 @@ package com.cpop.api.cloudDb.handler; import com.alibaba.fastjson.JSONObject; import com.cpop.api.cloudDb.core.constant.CloudDbUrl; import com.cpop.api.cloudDb.core.dto.CloudCourseDto; +import com.cpop.api.cloudDb.core.dto.CloudCourseStudentDto; +import com.cpop.api.cloudDb.core.dto.CloudCourseStudentListDto; import com.cpop.api.cloudDb.core.dto.CloudCustomerDto; import com.cpop.common.utils.StringUtils; import com.cpop.core.base.exception.UtilException; import com.mybatisflex.core.paginate.Page; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.web.client.RestTemplate; +import java.util.ArrayList; import java.util.List; /** @@ -20,6 +24,7 @@ import java.util.List; * @since 2024-01-09 15:29 */ @Component +@Slf4j public class CloudCourseHandler { @Autowired @@ -37,7 +42,7 @@ public class CloudCourseHandler { * @param courseId 云课程id * @return Page */ - public Page getCustomerPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String courseId) { + public Page getCoursePage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String courseId) { JSONObject jsonBody = new JSONObject(); jsonBody.put("_type", "courseContent"); //分页参数 @@ -69,4 +74,55 @@ public class CloudCourseHandler { return page; } } + + /** + * 上课情况 + * @author DB + * @since 2024/1/9 + * @param customerId 客户id + * @param studentId 学员id + * @param cardId 课卡id + * @param classId 班级id + * @param startDate 开始时间 + * @param endDate 接受时间 + * @param storeId 校区id + * @param courseId 课程id + * @return List + */ + public CloudCourseStudentListDto getCourseStudentList(String customerId, String studentId, String cardId, String classId, String startDate, String endDate, String storeId, String courseId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "courseStudent"); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(courseId)){ + jsonBody.put("courseId", courseId); + } + if (StringUtils.isNotBlank(customerId)){ + jsonBody.put("customerId", customerId); + } + if (StringUtils.isNotBlank(studentId)){ + jsonBody.put("studentId", studentId); + } + if (StringUtils.isNotBlank(cardId)){ + jsonBody.put("cardId", cardId); + } + if (StringUtils.isNotBlank(classId)){ + jsonBody.put("classId", classId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + return jsonObject.toJavaObject(CloudCourseStudentListDto.class); + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return new CloudCourseStudentListDto(); + } + } } diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java new file mode 100644 index 0000000..1761e28 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudOrderHandler.java @@ -0,0 +1,86 @@ +package com.cpop.api.cloudDb.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.cloudDb.core.constant.CloudDbUrl; +import com.cpop.api.cloudDb.core.dto.CloudOrderDto; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.entity.ExtendPage; +import com.cpop.core.base.exception.UtilException; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +/** + * 云账单工具类 + * @author DB + * @version 1.0.0 + * @since 2024-01-10 10:32 + */ +@Component +public class CloudOrderHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取班级学员分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param customerId 云客户id + * @param cardId 云课卡id + * @param orderId 云订单id + * @return Page + */ + public Page getOrderPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String customerId, String cardId, String orderId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "daybook"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(customerId)) { + jsonBody.put("customerId", customerId); + } + if (StringUtils.isNotBlank(cardId)) { + jsonBody.put("cardId", cardId); + } + if (StringUtils.isNotBlank(orderId)) { + jsonBody.put("ticketId", orderId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + ExtendPage page = ExtendPage.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudOrderDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + Map extendParams = new HashMap<>(); + extendParams.put("totalRevenue", jsonObject.getString("totalRevenue")); + extendParams.put("totalExpenditure", jsonObject.getString("totalExpenditure")); + page.setExtendParams(extendParams); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java new file mode 100644 index 0000000..7e47771 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudStaffHandler.java @@ -0,0 +1,72 @@ +package com.cpop.api.cloudDb.handler; + +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.cloudDb.core.constant.CloudDbUrl; +import com.cpop.api.cloudDb.core.dto.CloudClassDto; +import com.cpop.api.cloudDb.core.dto.CloudStaffDto; +import com.cpop.common.utils.StringUtils; +import com.cpop.core.base.exception.UtilException; +import com.mybatisflex.core.paginate.Page; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.client.RestTemplate; + +import java.util.List; + +/** + * 云员工工具类 + * @author DB + * @version 1.0.0 + * @since 2024-01-10 11:29 + */ +@Component +public class CloudStaffHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取班级分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param staffId 员工id + * @return Page + */ + public Page getStoreStaffPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String staffId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "staff"); + //分页参数 + jsonBody.put("page", pageNum); + jsonBody.put("limit", pageSize); + //开始日期结束日期 + if (StringUtils.isNotBlank(startDate) && StringUtils.isNotBlank(endDate)) { + jsonBody.put("startTime", startDate); + jsonBody.put("endTime", endDate); + } + if (StringUtils.isNotBlank(staffId)){ + jsonBody.put("staffId", staffId); + } + //校区id + jsonBody.put("storeId", storeId); + JSONObject jsonObject = restTemplate.postForObject(CloudDbUrl.DATA_CLOUD, jsonBody, JSONObject.class); + Page page = Page.of(pageNum, pageSize); + if (jsonObject != null) { + if (jsonObject.getBoolean("success")) { + List courseDtoList = jsonObject.getJSONArray("list").toJavaList(CloudStaffDto.class); + page.setRecords(courseDtoList); + page.setTotalPage(jsonObject.getInteger("total")); + page.setTotalRow(jsonObject.getInteger("total")); + return page; + } else { + throw new UtilException(jsonObject.getString("error")); + } + } else { + return page; + } + } +} diff --git a/Cpop-Core/src/main/java/com/cpop/core/base/entity/ExtendPage.java b/Cpop-Core/src/main/java/com/cpop/core/base/entity/ExtendPage.java new file mode 100644 index 0000000..cc32af2 --- /dev/null +++ b/Cpop-Core/src/main/java/com/cpop/core/base/entity/ExtendPage.java @@ -0,0 +1,31 @@ +package com.cpop.core.base.entity; + +import com.mybatisflex.core.paginate.Page; +import lombok.Getter; +import lombok.Setter; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-10 10:37 + */ +@Getter +@Setter +public class ExtendPage extends Page { + + /** + * 额外拓展参数 + */ + private Map extendParams; + + public ExtendPage(Number pageNumber, Number pageSize) { + super(pageNumber, pageSize); + } + + public static ExtendPage of(Number pageNumber, Number pageSize) { + return new ExtendPage<>(pageNumber, pageSize); + } +} diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCloudDbTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCloudDbTests.java index 769a224..fd78776 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCloudDbTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCloudDbTests.java @@ -1,12 +1,21 @@ package com.cpop.oam.web; +import com.alibaba.fastjson.JSONObject; +import com.cpop.api.cloudDb.core.dto.CloudCourseStudentDto; +import com.cpop.api.cloudDb.core.dto.CloudCourseStudentListDto; import com.cpop.api.cloudDb.core.dto.CloudCustomerDto; +import com.cpop.api.cloudDb.core.dto.CloudOrderDto; +import com.cpop.api.cloudDb.handler.CloudCourseHandler; import com.cpop.api.cloudDb.handler.CloudCustomerStudentHandler; +import com.cpop.api.cloudDb.handler.CloudOrderHandler; import com.cpop.core.utils.SpringUtils; +import com.google.gson.JsonObject; import com.mybatisflex.core.paginate.Page; import org.junit.jupiter.api.Test; import org.springframework.boot.test.context.SpringBootTest; +import java.util.List; + /** * @author DB * @version 1.0.0 @@ -26,4 +35,24 @@ public class CpopCloudDbTests { "f4a7f4c892934490a7550ed1e2f0opiu", null); System.out.println(page); } + + /** + * 获取课程学员 + */ + @Test + public void getCourseStudentList(){ + CloudCourseStudentListDto studentListDto = SpringUtils.getBean(CloudCourseHandler.class).getCourseStudentList(null, null, null, + null, null, null, "f4a7f4c892934490a7550ed1e2f0opiu", "382dd55065937692003606af55d38c6f"); + System.out.println(JSONObject.toJSONString(studentListDto)); + } + + /** + * 获取云订单分页 + */ + @Test + public void getOrderPageTest() { + Page orderPage = SpringUtils.getBean(CloudOrderHandler.class).getOrderPage(1, 10, null, + null, "f4a7f4c892934490a7550ed1e2f0opiu", null, null, null); + System.out.println(JSONObject.toJSONString(orderPage)); + } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/CloudDataController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/CloudDataController.java index b4f827c..fcf81bc 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/CloudDataController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/CloudDataController.java @@ -1,17 +1,13 @@ package com.cpop.oam.business.controller.backstage; -import com.cpop.api.cloudDb.core.dto.CloudCustomerDto; -import com.cpop.api.cloudDb.core.dto.CloudStudentDto; -import com.cpop.api.cloudDb.handler.CloudCustomerStudentHandler; +import com.cpop.api.cloudDb.core.dto.*; +import com.cpop.api.cloudDb.handler.*; import com.cpop.core.base.R; -import com.cpop.oam.business.bo.BrandManagerPageBo; -import com.cpop.oam.business.vo.BrandManagePageVo; import com.mybatisflex.core.paginate.Page; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; @@ -23,13 +19,28 @@ import org.springframework.web.bind.annotation.RestController; * @since 2024-01-09 16:01 */ @RestController -@Api(tags = "数据导入接口") +@Api(tags = "云数据查询接口") @RequestMapping("/cloudData") public class CloudDataController { @Autowired private CloudCustomerStudentHandler cloudCustomerStudentHandler; + @Autowired + private CloudCourseHandler cloudCourseHandler; + + @Autowired + private CloudClassHandler cloudClassHandler; + + @Autowired + private CloudOrderHandler cloudOrderHandler; + + @Autowired + private CloudClassCardHandler cloudClassCardHandler; + + @Autowired + private CloudStaffHandler cloudStaffHandler; + /** * 获取客户分页 * @author DB @@ -45,11 +56,11 @@ public class CloudDataController { @ApiOperation("获取客户分页") @GetMapping("/getCustomerPage") public R> getCustomerPage(@ApiParam("分页参数") @RequestParam("page") Integer page, - @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, - @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, - @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, - @ApiParam("校区Id") @RequestParam("storeId") String storeId, - @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId) { + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId) { Page pageList = cloudCustomerStudentHandler.getCustomerPage(page, pageSize, startDate, endDate, storeId, customerId); return R.ok(pageList); } @@ -69,13 +80,223 @@ public class CloudDataController { @ApiOperation("获取学员分页") @GetMapping("/getStudentPage") public R> getStudentPage(@ApiParam("分页参数") @RequestParam("page") Integer page, - @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, - @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, - @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, - @ApiParam("校区Id") @RequestParam("storeId") String storeId, - @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, - @ApiParam("学员id") @RequestParam(value = "studentId", required = false) String studentId) { + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, + @ApiParam("学员id") @RequestParam(value = "studentId", required = false) String studentId) { Page studentPage = cloudCustomerStudentHandler.getStudentPage(page, pageSize, startDate, endDate, storeId, customerId, studentId); return R.ok(studentPage); } + + /** + * 获取课程分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param courseId 课程id + * @return R> + */ + @ApiOperation("获取课程分页") + @GetMapping("/getCoursePage") + public R> getCoursePage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("课程id") @RequestParam(value = "courseId", required = false) String courseId) { + Page coursePage = cloudCourseHandler.getCoursePage(page, pageSize, startDate, endDate, storeId, courseId); + return R.ok(coursePage); + } + + /** + * 获取学员上课 + * @author DB + * @since 2024/1/10 + * @param customerId 客户id + * @param studentId 学员id + * @param cardId 课卡id + * @param classId 教室id + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param courseId 课程id + * @return R + */ + @ApiOperation("获取学员上课") + @GetMapping("/getCourseStudentList") + public R getCourseStudentList(@ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, + @ApiParam("学员id") @RequestParam(value = "studentId", required = false) String studentId, + @ApiParam("课卡id") @RequestParam(value = "cardId", required = false) String cardId, + @ApiParam("教室id") @RequestParam(value = "classId", required = false) String classId, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("课程id") @RequestParam(value = "courseId", required = false) String courseId) { + CloudCourseStudentListDto studentListDto = cloudCourseHandler.getCourseStudentList(customerId, studentId, cardId, classId, startDate, endDate, storeId, courseId); + return R.ok(studentListDto); + } + + /** + * 获取班级分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param classId 教室id + * @return R> + */ + @ApiOperation("获取班级分页") + @GetMapping("/getClassPage") + public R> getClassPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("教室id") @RequestParam(value = "classId", required = false) String classId) { + Page classPage = cloudClassHandler.getClassPage(page, pageSize, startDate, endDate, storeId, classId); + return R.ok(classPage); + } + + + /** + * 获取班级学员分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param classId 教室id + * @return R> + */ + @ApiOperation("获取班级学员分页") + @GetMapping("/getClassStudentPage") + public R> getClassStudentPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("教室id") @RequestParam(value = "classId", required = false) String classId) { + Page classStudentPage = cloudClassHandler.getClassStudentPage(page, pageSize, startDate, endDate, storeId, classId); + return R.ok(classStudentPage); + } + + /** + * 获取订单分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param customerId 客户id + * @param cardId 课卡id + * @param orderId 订单id + * @return R> + */ + @ApiOperation("获取订单分页") + @GetMapping("/getOrderPage") + public R> getOrderPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, + @ApiParam("课卡id") @RequestParam(value = "cardId", required = false) String cardId, + @ApiParam("订单id") @RequestParam(value = "orderId", required = false) String orderId) { + Page orderPage = cloudOrderHandler.getOrderPage(page, pageSize, startDate, endDate, storeId, customerId, cardId, orderId); + return R.ok(orderPage); + } + + /** + * 获取订单分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param customerId 客户id + * @param cardId 课卡id + * @param cardType 课卡类型 + * @param cardStatus 课卡状态 + * @return R> + */ + @ApiOperation("获取课卡分页") + @GetMapping("/getClassCardPage") + public R> getClassCardPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, + @ApiParam("课卡id") @RequestParam(value = "cardId", required = false) String cardId, + @ApiParam("课卡类型") @RequestParam(value = "cardType", required = false) String cardType, + @ApiParam("课卡状态") @RequestParam(value = "cardStatus", required = false) Integer cardStatus) { + Page classCardPage = cloudClassCardHandler.getClassCardPage(page, pageSize, startDate, endDate, storeId, customerId, cardId, cardType, cardStatus); + return R.ok(classCardPage); + } + + /** + * 获取订单分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param customerId 客户id + * @param cardId 课卡id + * @return R> + */ + @ApiOperation("获取课卡记录分页") + @GetMapping("/getClassCardRecordPage") + public R> getClassCardRecordPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("客户id") @RequestParam(value = "customerId", required = false) String customerId, + @ApiParam("课卡id") @RequestParam(value = "cardId", required = false) String cardId) { + Page classCardRecordPage = cloudClassCardHandler.getClassCardRecordPage(page, pageSize, startDate, endDate, storeId, customerId, cardId); + return R.ok(classCardRecordPage); + } + + /** + * 获取订单分页 + * @author DB + * @since 2024/1/10 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param staffId 员工id + * @return R> + */ + @ApiOperation("获取班级分页") + @GetMapping("/getStoreStaffPage") + public R> getStoreStaffPage(@ApiParam("分页参数") @RequestParam("page") Integer page, + @ApiParam("分页参数") @RequestParam("pageSize") Integer pageSize, + @ApiParam("开始日期") @RequestParam(value = "startDate", required = false) String startDate, + @ApiParam("结束日期") @RequestParam(value = "endDate", required = false) String endDate, + @ApiParam("校区Id") @RequestParam("storeId") String storeId, + @ApiParam("员工id") @RequestParam(value = "staffId", required = false) String staffId) { + Page storeStaffPage = cloudStaffHandler.getStoreStaffPage(page, pageSize, startDate, endDate, storeId, staffId); + return R.ok(storeStaffPage); + } + }