diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/constant/CloudDbUrl.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/constant/CloudDbUrl.java new file mode 100644 index 0000000..ed157d2 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/constant/CloudDbUrl.java @@ -0,0 +1,28 @@ +package com.cpop.api.cloudDb.core.constant; + +/** + * 果酱云地址 + * @author Lost + */ +public interface CloudDbUrl { + + /** + * 基础地址 + */ + String BASE_URL = "https://beibeike-qy-b33k4-1302318474.ap-shanghai.app.tcloudbase.com"; + + /** + * 课卡相关云函数 + */ + String COMMON_CARD_URL = BASE_URL + "/merchant_cloud"; + + /** + * 查询云数据专用 + */ + String DATA_CLOUD = BASE_URL + "/data_cloud"; + + /** + * 数据导入 + */ + String DATA_IMPORT = BASE_URL + "/dataImport"; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java new file mode 100644 index 0000000..e49c83c --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardDto.java @@ -0,0 +1,104 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 17:27 + */ +@Data +public class CloudClassCardDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 学员id + */ + @SerializedName("_studentid") + private String studentId; + + /** + * 学员名 + */ + private String studentName; + + /** + * 课卡名 + */ + @SerializedName("name") + private String cardName; + + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 到期时间 + */ + @SerializedName("periodExpire") + private String maturityTime; + + /** + * 剩余金额 + */ + @SerializedName("amount") + private double remainingAmount; + + /** + * 剩余课时 + */ + @SerializedName("number") + private Integer remainingClassHour; + + /** + * 课卡类型 + */ + @SerializedName("type") + private String cardType; + + /** + * 课时类型 + */ + @SerializedName("chargeType") + private String hourType; + + /** + * 停卡状态 + */ + @SerializedName("isStop") + private Boolean suspendCardStatus; + + /** + * 激活状态 + */ + @SerializedName("isActivated") + private String activityCardStatus; + + /** + * 是否引流卡 + */ + @SerializedName("isDrainage") + private boolean isDrainageCard; + +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardRecordDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardRecordDto.java new file mode 100644 index 0000000..a979ebe --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassCardRecordDto.java @@ -0,0 +1,86 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 17:35 + */ +@Data +public class CloudClassCardRecordDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 课卡行为 + */ + @SerializedName("type") + private String cardBehavior; + + /** + * 行为内容 + */ + @SerializedName("remarks") + private String behaviorContent; + + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 课卡名 + */ + private String cardName; + + /** + * 关联课时 + */ + @SerializedName("periodNumber") + private Integer relevanceClassHour; + + /** + * 关联有效期 + */ + @SerializedName("periodDay") + private String relevanceValidity; + + /** + * 关联到期时间 + */ + @SerializedName("periodExpire") + private String relevanceMaturityTime; + + /** + * 关联金额 + */ + @SerializedName("money") + private BigDecimal relevanceAmount; + + /** + * 关联员工 + */ + @SerializedName("_staffid") + private String relevanceStaffName; + +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassDto.java new file mode 100644 index 0000000..e5a82c8 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassDto.java @@ -0,0 +1,61 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.OffsetDateTime; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 16:54 + */ +@Data +public class CloudClassDto { + + /** + * 班级名 + */ + @SerializedName("classesName") + private String className; + + /** + * 班主任id + */ + @SerializedName("staffid") + private String classTeacher; + + /** + * 班主任 + */ + private String classTeacherName; + + /** + * 班类型 + */ + @SerializedName("periodTypeArr") + private List classType; + /** + * 录入时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 满班学员数 + */ + @SerializedName("studentMaxLimit") + private Integer fullClassStudentNum; + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 是否结班 + */ + @SerializedName("finish") + private Boolean isCloseClass; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassStudentDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassStudentDto.java new file mode 100644 index 0000000..30591bd --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudClassStudentDto.java @@ -0,0 +1,61 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 17:08 + */ +@Data +public class CloudClassStudentDto { + + + /** + * 班级名 + */ + private String className; + + /** + * 班级Id + */ + @SerializedName("_classesId") + private String classId; + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 学员id + */ + @SerializedName("_studentid") + private String studentId; + + /** + * 学员名 + */ + @SerializedName("name") + private String studentName; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java new file mode 100644 index 0000000..2449929 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseDto.java @@ -0,0 +1,70 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import io.swagger.models.auth.In; +import lombok.Data; + +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 15:20 + */ +@Data +public class CloudCourseDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 绑定班级 + */ + @SerializedName("_classesId") + private String bindClass; + + /** + * 课程名 + */ + @SerializedName("classesName") + private String courseName; + + /** + * 上课时间 + */ + @SerializedName("startTime") + private String classTime; + + /** + * 下课时间 + */ + @SerializedName("endTime") + private String quittingTime; + + /** + * 扣除课时 + */ + @SerializedName("periodCost") + private Integer deductionPeriod; + + /** + * 课程类型 + */ + @SerializedName("periodTypeArr") + private List classType; + + /** + * 导师 + */ + @SerializedName("_staffid") + private String supervisor; + + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; +} 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 new file mode 100644 index 0000000..c2996a9 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCourseStudentDto.java @@ -0,0 +1,122 @@ +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 15:32 + */ +@Data +public class CloudCourseStudentDto { + + /** + * 课程id + */ + @SerializedName("_courseContentId") + private String courseId; + + /** + * 学员id + */ + @SerializedName("_studentid") + private String studentId; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 班级id + */ + @SerializedName("_classesid") + private String classId; + + /** + * 课程名 + */ + private String name; + + /** + * 导师 + */ + @SerializedName("_staffid") + private String supervisor; + + /** + * 上课时间 + */ + @SerializedName("startTime") + private String classTime; + + /** + * 上课行为 + */ + @SerializedName("behavior") + private Integer classBehavior; + + /** + * 签到状态 + * 0(待操作) + * 1(已签到) + * 2(迟到) + * 3(旷课) + * 4(请假) + */ + @SerializedName("statu") + private Integer signStatus; + + /** + * 扣除余额 + */ + @SerializedName("amount") + private BigDecimal deductionBalance; + + /** + * 扣除课时 + */ + @SerializedName("number") + private Integer deductionPeriod; + + /** + * 产生课消 + */ + @SerializedName("periodIncome") + private Integer classDepletion; + + /** + * 扣除课卡id + */ + @SerializedName("_periodid") + private String cardId; + + /** + * 总余额 + */ + @SerializedName("allAmount") + private BigDecimal deductionTotalBalance; + + /** + * 总课时 + */ + @SerializedName("allNumber") + private Long deductionTotalPeriod; + + /** + * 总课消 + */ + @SerializedName("number") + private Long classTotalDepletion; + + /** + * 状态操作时间 + */ + @SerializedName("_createTime") + private String createTime; +} 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 new file mode 100644 index 0000000..6c1e489 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudCustomerDto.java @@ -0,0 +1,55 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.LocalDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 14:27 + */ +@Data +public class CloudCustomerDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * openId + */ + @SerializedName("_openid") + private String openId; + + /** + * 客户名 + */ + @SerializedName("name") + private String customerName; + + /** + * 手机号 + */ + private String phone; + + /** + * 生日 + */ + private String birthday; + + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 顾问id + */ + @SerializedName("_staffId") + private String counselor; +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudOrderDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudOrderDto.java new file mode 100644 index 0000000..34936c1 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudOrderDto.java @@ -0,0 +1,104 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 17:18 + */ +@Data +public class CloudOrderDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 课卡id + */ + @SerializedName("_periodid") + private String cardId; + + /** + * 关联课卡名 + */ + private String classCardName; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 客户名 + */ + private String customerName; + + /** + * 账单金额 + */ + @SerializedName("amount") + private Double orderAmount; + + /** + * 录入时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 账单内容 + */ + @SerializedName("name") + private String orderContent; + + /** + * 收入类型 + */ + @SerializedName("type") + private String incomeType; + + /** + * 账单类型 + * 0(所有) + * 1(课卡录入) + * 2(账单录入) + * 3(一次性付) + * 4(月付) + * 5(先学后付) + * 6(数币) + */ + @SerializedName("ticketType") + private String orderType; + + /** + * 是否是引流卡 + */ + @SerializedName("isDrainage") + private Boolean isDrainageCard; + + /** + * 是否续费单 + */ + @SerializedName("isRenewal") + private Boolean isRenewOrder; + + /** + * 顾问Id + */ + @SerializedName("_staffid") + private String counselorId; + + /** + * 顾问名 + */ + private String counselorName; + +} diff --git a/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStaffDto.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStaffDto.java new file mode 100644 index 0000000..ebb4632 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStaffDto.java @@ -0,0 +1,44 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +import java.time.OffsetDateTime; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 17:39 + */ +@Data +public class CloudStaffDto { + + /** + * 主键 + */ + @SerializedName("_id") + private String id; + + /** + * 录入时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 职务 + */ + @SerializedName("position") + private String job; + + /** + * 手机号 + */ + private String phone; + + /** + * 员工名 + */ + @SerializedName("name") + private String staffName; +} 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 new file mode 100644 index 0000000..53875b9 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/core/dto/CloudStudentDto.java @@ -0,0 +1,56 @@ +package com.cpop.api.cloudDb.core.dto; + +import com.google.gson.annotations.SerializedName; +import lombok.Data; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 15:12 + */ +@Data +public class CloudStudentDto { + + /** + * 学员id + */ + @SerializedName("_id") + private String id; + + /** + * 客户id + */ + @SerializedName("_customerid") + private String customerId; + + /** + * 学员名 + */ + private String name; + + /** + * 生日 + */ + private String birthday; + + /** + * 性别 + */ + private String sex; + + /** + * 创建时间 + */ + @SerializedName("_createTime") + private String createTime; + + /** + * 学员绑定课卡 + */ + private String studentBindCard; + + /** + * 学员绑定班级 + */ + private String studentBindClass; +} 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 new file mode 100644 index 0000000..f03abc5 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCourseHandler.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.CloudCourseDto; +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 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-09 15:29 + */ +@Component +public class CloudCourseHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取课程分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param courseId 云课程id + * @return Page + */ + public Page getCustomerPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String courseId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "courseContent"); + //分页参数 + 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(courseId)){ + jsonBody.put("courseId", courseId); + } + //校区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(CloudCourseDto.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/CloudCustomerStudentHandler.java b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java new file mode 100644 index 0000000..18a35f8 --- /dev/null +++ b/Cpop-Api/src/main/java/com/cpop/api/cloudDb/handler/CloudCustomerStudentHandler.java @@ -0,0 +1,123 @@ +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.CloudCustomerDto; +import com.cpop.api.cloudDb.core.dto.CloudStudentDto; +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.List; + +/** + * 云客户学员工具类 + * @author DB + * @version 1.0.0 + * @since 2024-01-09 14:30 + */ +@Component +@Slf4j +public class CloudCustomerStudentHandler { + + @Autowired + private RestTemplate restTemplate; + + /** + * 获取客户分页 + * @author DB + * @since 2024/1/9 + * @param pageNum 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 云校区id + * @param customerId 云客户id + * @return Page + */ + public Page getCustomerPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId,String customerId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "customer"); + //分页参数 + 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); + } + //校区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 customerDtoList = jsonObject.getJSONArray("list").toJavaList(CloudCustomerDto.class); + page.setRecords(customerDtoList); + 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 studentId 云学员id + * @return Page + */ + public Page getStudentPage(Integer pageNum, Integer pageSize, String startDate, String endDate, String storeId, String customerId, String studentId) { + JSONObject jsonBody = new JSONObject(); + jsonBody.put("_type", "student"); + //分页参数 + 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(studentId)) { + jsonBody.put("studentId", studentId); + } + //校区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 studentDtoList = jsonObject.getJSONArray("list").toJavaList(CloudStudentDto.class); + page.setRecords(studentDtoList); + 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-Generator/src/main/java/com/cpop/generator/CpopGenerator.java b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java index cfc90dd..56a42cf 100644 --- a/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java +++ b/Cpop-Generator/src/main/java/com/cpop/generator/CpopGenerator.java @@ -40,17 +40,17 @@ public class CpopGenerator { /** * 输出路径 */ - private static final String EXPORT_URL = "/Cpop-Jambox"; + private static final String EXPORT_URL = "/Cpop-System"; /** * 模块 */ - private static final String EXPORT_ITEM = "jambox"; + private static final String EXPORT_ITEM = "system"; /** * 表前缀 */ - private static final String TABLE_PREFIX = "cp_j_"; + private static final String TABLE_PREFIX = "cp_sys_"; /** * 主入口 diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnifiedPayBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnifiedPayBo.java new file mode 100644 index 0000000..4a82c9e --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnifiedPayBo.java @@ -0,0 +1,89 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.experimental.Accessors; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotNull; +import java.math.BigDecimal; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 9:15 + */ +@Data +@Accessors(chain = true) +@ApiModel(value = "EasyLearnUnifiedPayBo对象", description = "统一支付参数") +public class EasyLearnUnifiedPayBo { + + /** + * 品牌或校区id + */ + @NotBlank(message = "云品牌或云校区id不能为空") + @ApiModelProperty(value = "云品牌或云校区id",required = true) + private String brandOrStoreCloudId; + + /** + * 联合支付外部订单id + */ + @NotBlank(message = "联合支付外部订单id不能为空") + @ApiModelProperty(value = "联合支付外部订单id",required = true) + private String unionPayOutOrderId; + + /** + * 客户名 + */ + @NotBlank(message = "客户名不能为空") + @ApiModelProperty(value = "客户名",required = true) + private String customerName; + + /** + * 客户电话 + */ + @NotBlank(message = "客户电话不能为空") + @ApiModelProperty(value = "客户电话",required = true) + private String customerPhone; + + /** + * 总金额 + */ + @NotNull(message = "总金额不能为空") + @ApiModelProperty(value = "总金额",required = true) + private BigDecimal totalAmount; + + /** + * 总支付金额 + */ + @NotNull(message = "总支付金额不能为空") + @ApiModelProperty(value = "总支付金额",required = true) + private BigDecimal totalPayAmount; + + /** + * 订单类型 + */ + @NotNull(message = "联合支付类型不能为空") + @ApiModelProperty(value = "联合支付类型(PREPAYMENT:预付;REPAYMENT:还款;MEMBER:会员)",required = true) + private String easyLearnUnionPay; + + /** + * 分账比率 + */ + @ApiModelProperty(value = "分账比率(不传不分帐)") + private Double rate; + + /** + * openId + */ + @NotBlank(message = "openId不能为空") + @ApiModelProperty(value = "openId", required = true) + private String openId; + + /** + * 订单名 + */ + @ApiModelProperty("订单内容(课卡名/商品名)") + private String orderContent; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnionPayBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnionPayBo.java index 20bef40..6d616d1 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnionPayBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/EasyLearnUnionPayBo.java @@ -81,4 +81,11 @@ public class EasyLearnUnionPayBo { @ApiModelProperty(value = "openId", required = true) private String openId; + /** + * 订单名 + */ + @ApiModelProperty("订单内容(课卡名/商品名)") + private String orderContent; + + } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterOncePayDto.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterOncePayDto.java new file mode 100644 index 0000000..8d4f1a5 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterOncePayDto.java @@ -0,0 +1,114 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-08 9:23 + */ +@Data +@ApiModel(value = "先学后付次付") +public class LearnNowPayLaterOncePayDto { + + /** + * 支付分计划名称 + */ + @NotBlank(message = "支付分计划名称不能为空") + @ApiModelProperty(value = "支付分计划名称", required = true) + private String planName; + + /** + * 支付分计划有效期(单位天) + */ + @NotNull(message = "支付分计划有效期不能为空") + @ApiModelProperty(value = "支付分计划有效期(单位天)", required = true) + private Integer planDuration; + + /** + * 支付分计划扣费次数 + */ + @NotNull(message = "支付分计划扣费次数不能为空") + @ApiModelProperty(value = "支付分计划扣费次数", required = true) + private Integer deductionQuantity; + + /** + * 支付分计划原总金额(单位分) + */ + @NotNull(message = "支付分计划原总金额不能为空") + @ApiModelProperty(value = "支付分计划原总金额(单位分)", required = true) + private Integer totalOriginalPrice; + + public void setTotalOriginalPrice(String totalOriginalPrice) { + double price = Double.parseDouble(totalOriginalPrice) * 100; + this.totalOriginalPrice = (int) price; + } + + /** + * 支付分计划实际扣费总金额(单位分) + */ + @NotNull(message = "支付分计划实际扣费总金额不能为空") + @ApiModelProperty(value = "支付分计划实际扣费总金额(单位分)", required = true) + private Integer totalActualPrice; + + public void setTotalActualPrice(String totalActualPrice) { + double price = Double.parseDouble(totalActualPrice) * 100; + this.totalActualPrice = (int) price; + } + + + /** + * 支付分计划明细列表 + */ + @NotEmpty(message = "支付分计划明细列表不能为空") + @ApiModelProperty(value = "支付分计划明细列表", required = true) + private List planDetailList; + + @Data + public static class PlanDetail { + /** + * 计划明细原支付金额(单位分) + */ + @NotNull(message = "计划明细原支付金额不能为空") + @ApiModelProperty(value = "计划明细原支付金额(单位分)",required = true) + private Integer originalPrice; + + public void setOriginalPrice(String originalPrice) { + double price = Double.parseDouble(originalPrice) * 100; + this.originalPrice = (int) price; + } + + /** + * 计划明细优惠说明 + */ + @NotBlank(message = "计划明细优惠说明不能为空") + @ApiModelProperty(value = "计划明细优惠说明",required = true) + private String planDiscountDescription; + + /** + * 计划明细实际支付金额(单位分) + */ + @NotNull(message = "计划明细实际支付金额不能为空") + @ApiModelProperty(value = "计划明细实际支付金额(单位分)",required = true) + private Integer actualPrice; + + public void setActualPrice(String actualPrice) { + double price = Double.parseDouble(actualPrice) * 100; + this.actualPrice = (int) price; + } + + /** + * 计划明细名称 + */ + @NotBlank(message = "计划明细名称不能为空") + @ApiModelProperty(value = "计划明细名称",required = true) + private String planDetailName; + } +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java new file mode 100644 index 0000000..c60538a --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanBo.java @@ -0,0 +1,64 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; +import java.util.List; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-05 16:13 + */ +@Data +@ApiModel("先学后付计划") +public class LearnNowPayLaterPlanBo { + + /** + * 支付分计划名称 + */ + @ApiModelProperty("支付分计划名称") + private String planName; + + /** + * 支付分计划有效期(单位天) + */ + @ApiModelProperty("支付分计划有效期(单位天)") + private Integer planDuration; + + /** + * 支付分计划扣费次数 + */ + @ApiModelProperty("支付分计划扣费次数") + private Integer deductionQuantity; + + + /** + * 支付分计划原总金额(单位分) + */ + @ApiModelProperty("支付分计划原总金额") + private Integer totalOriginalPrice; + + public void setDeductionQuantity(BigDecimal deductionQuantity) { + this.deductionQuantity = deductionQuantity.scaleByPowerOfTen(2).intValue(); + } + + /** + * 支付分计划实际扣费总金额(单位分) + */ + @ApiModelProperty("支付分计划实际扣费总金额(单位分)") + private Integer totalActualPrice; + + public void setTotalOriginalPrice(BigDecimal totalOriginalPrice) { + this.totalOriginalPrice = totalOriginalPrice.scaleByPowerOfTen(2).intValue(); + } + + /** + * 支付分计划明细列表 + */ + @ApiModelProperty("支付分计划明细列表") + private List planDetailList; + +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanDetailBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanDetailBo.java new file mode 100644 index 0000000..890ec70 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/LearnNowPayLaterPlanDetailBo.java @@ -0,0 +1,49 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-08 9:54 + */ +@Data +@ApiModel(value = "先学后付计划详情") +public class LearnNowPayLaterPlanDetailBo { + + /** + * 计划明细优惠说明 + */ + @ApiModelProperty("计划明细优惠说明") + private String planDiscountDescription; + + /** + * 计划明细原支付金额(单位分) + */ + @ApiModelProperty("计划明细原支付金额(单位分)") + private Integer originalPrice; + + public void setOriginalPrice(BigDecimal originalPrice) { + this.originalPrice = originalPrice.scaleByPowerOfTen(2).intValue(); + } + + /** + * 计划明细实际支付金额(单位分) + */ + @ApiModelProperty("计划明细实际支付金额(单位分)") + private Long actualPrice; + + public void setActualPrice(BigDecimal actualPrice) { + this.actualPrice = actualPrice.scaleByPowerOfTen(2).longValue(); + } + + /** + * 计划明细名称 + */ + @ApiModelProperty("计划明细名称") + private String planDetailName; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/OncePlaceOrderBo.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/OncePlaceOrderBo.java index 8d62173..3f934d5 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/OncePlaceOrderBo.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/OncePlaceOrderBo.java @@ -68,16 +68,16 @@ public class OncePlaceOrderBo { @ApiModelProperty(value = "总支付金额",required = true) private BigDecimal totalPayAmount; - /** - * 校区/店铺员工云id - */ - @ApiModelProperty("校区/店铺员工云id") - private String storeStaffCloudId; - /** * openId */ @ApiModelProperty("openId") private String openId; + /** + * 订单名 + */ + @ApiModelProperty("订单内容(课卡名/商品名)") + private String orderContent; + } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/UnionPayDto.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/UnionPayDto.java new file mode 100644 index 0000000..e217902 --- /dev/null +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/bo/UnionPayDto.java @@ -0,0 +1,21 @@ +package com.cpop.jambox.business.bo; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-08 9:20 + */ +@Data +@ApiModel(value = "联合支付") +public class UnionPayDto { + + /** + * 先学后付次付 + */ + @ApiModelProperty("先学后付次付") + private LearnNowPayLaterOncePayDto learnNowPayLaterOncePayDto; +} diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java index e5ad979..7ba054f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/controller/backstage/EasyLearnController.java @@ -3,6 +3,7 @@ package com.cpop.jambox.business.controller.backstage; import com.alibaba.excel.EasyExcel; import com.cpop.core.base.R; import com.cpop.jambox.business.bo.EasyLearnPageBo; +import com.cpop.jambox.business.bo.EasyLearnUnifiedPayBo; import com.cpop.jambox.business.bo.EasyLearnUnionPayBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.dto.EasyLearnPageDto; @@ -107,9 +108,24 @@ public class EasyLearnController { * @param bo 请求参数 * @return R */ + @Deprecated @PostMapping("/unionPay") @ApiOperation("放心学统一支付") - public R unionPay(@RequestBody @Validated @ApiParam("一次性支付") EasyLearnUnionPayBo bo) { + public R unionPay(@RequestBody @Validated EasyLearnUnionPayBo bo) { return R.ok(easyLearnOrderService.unionPay(bo)); } + + /** + * 放心学统一支付 + * @author DB + * @since 2024/1/9 + * @param bo 请求参数 + * @return R + */ + @PostMapping("/unifiedPay") + @ApiOperation("放心学统一支付(测试)") + public R unifiedPay(@RequestBody @Validated @ApiParam("放心学统一支付") EasyLearnUnifiedPayBo bo) { + return R.ok(easyLearnOrderService.unifiedPay(bo)); + } + } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java index fe57dfd..ac8081f 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/entity/EasyLearnOrder.java @@ -33,6 +33,11 @@ public class EasyLearnOrder extends BaseEntity implements Serializable { @Id private String id; + /** + * 购买的商品信息 + */ + private String orderContent; + /** * 支付状态(0:未支付;1已支付) */ @@ -48,11 +53,6 @@ public class EasyLearnOrder extends BaseEntity implements Serializable { */ private String orderCloudId; - /** - * 校区/店铺员工云id - */ - private String storeStaffCloudId; - /** * 外部订单号 */ @@ -93,11 +93,6 @@ public class EasyLearnOrder extends BaseEntity implements Serializable { */ private BigDecimal totalPayAmount; - /** - * 员工id - */ - private String staffId; - /** * 订单类型(0:先学后付;1:月付;2:微信支付;3:数币支付;4:机构会员) */ diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/EasyLearnOrderService.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/EasyLearnOrderService.java index 2f7728e..0f16640 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/EasyLearnOrderService.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/EasyLearnOrderService.java @@ -1,6 +1,7 @@ package com.cpop.jambox.business.service; import com.cpop.jambox.business.bo.EasyLearnPageBo; +import com.cpop.jambox.business.bo.EasyLearnUnifiedPayBo; import com.cpop.jambox.business.bo.EasyLearnUnionPayBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.dto.EasyLearnPageDto; @@ -67,4 +68,13 @@ public interface EasyLearnOrderService extends IService { * @param xmlData 数据 */ void unionPayResult(String xmlData); + + /** + * 放心学统一支付 + * @author DB + * @since 2024/1/9 + * @param bo 请求参数 + * @return Object + */ + Object unifiedPay(EasyLearnUnifiedPayBo bo); } diff --git a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java index 73d7940..79f27c3 100644 --- a/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java +++ b/Cpop-Jambox/src/main/java/com/cpop/jambox/business/service/impl/EasyLearnOrderServiceImpl.java @@ -13,6 +13,7 @@ import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.sql.SqlUtils; import com.cpop.jambox.business.bo.EasyLearnPageBo; +import com.cpop.jambox.business.bo.EasyLearnUnifiedPayBo; import com.cpop.jambox.business.bo.EasyLearnUnionPayBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.dto.EasyLearnPageDto; @@ -632,6 +633,7 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl page = SpringUtils.getBean(CloudCustomerStudentHandler.class).getCustomerPage(1, 10, null, null, + "f4a7f4c892934490a7550ed1e2f0opiu", null); + System.out.println(page); + } +} diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java index 15532b8..d3837ad 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopCoreTests.java @@ -83,4 +83,6 @@ public class CpopCoreTests { String encode = SpringUtils.getBean(PasswordEncoder.class).encode("Admin@123"); System.out.println("encode加密:"+encode); } + + } diff --git a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java index 6c7d96d..acfe11b 100644 --- a/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java +++ b/Cpop-Oam/Cpop-Oam-Web/src/test/java/com/cpop/oam/web/CpopImportTests.java @@ -23,10 +23,7 @@ import com.cpop.system.business.entity.Store; import com.cpop.system.business.entity.StoreLicense; import com.cpop.system.business.entity.StoreRenew; import com.cpop.system.business.entity.StoreSign; -import com.cpop.system.business.service.StoreLicenseService; -import com.cpop.system.business.service.StoreRenewService; -import com.cpop.system.business.service.StoreService; -import com.cpop.system.business.service.StoreSignService; +import com.cpop.system.business.service.*; import com.mybatisflex.core.FlexGlobalConfig; import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.datasource.FlexDataSource; @@ -842,19 +839,14 @@ public class CpopImportTests { List stageRowList; try { DataSourceKey.use("jambox"); - /* - typeRowList = DbChain.table("OAM_finance_reimbursement_type") - .select("report_id as createUserId", "report_name as typeName") - .from("OAM_finance_reimbursement_type") - .where("deleted = 1") - .list();*/ + //报销记录 - /*recordRowList = DbChain.table("OAM_finance_reimbursement") - .select("ofr.id as createUserId", "os.phone", "ofr.status", "ofr.type_id", "ofr.report_date", "ofr.remarks", "ofr.price", "ofr.annex as attachmentUrl") + recordRowList = DbChain.table("OAM_finance_reimbursement") + .select("ofr.id as updateUserId", "os.phone", "ofr.status", "ofr.type_id", "ofr.report_date", "ofr.remarks", "ofr.price", "ofr.annex as attachmentUrl") .from("OAM_finance_reimbursement").as("ofr") .leftJoin("OAM_staff").as("os").on("os.staff_id = ofr.staff_id") .where("ofr.deleted = 1") - .list();*/ + .list(); //报销阶段 stageRowList = DbChain.table("OAM_finance_reimbursement_stage") .select("finance_reimbursement_id", "stage_amount", "payment_time") @@ -864,19 +856,33 @@ public class CpopImportTests { } finally { DataSourceKey.clear(); } - //List financeReimburseTypes = RowUtil.toEntityList(typeRowList, FinanceReimburseType.class); - //SpringUtils.getBean(FinanceReimburseTypeService.class).saveBatch(financeReimburseTypes); - //System.out.println(JSONArray.toJSONString(typeRowList)); - //Map oldTypeIdMap = SpringUtils.getBean(FinanceReimburseTypeService.class).list().stream().collect(Collectors.toMap(BaseEntity::getCreateUserId, item -> item)); - //获取所有员工 //获取现有所有员工 - /*Map staffMap = SpringUtils.getBean(StaffService.class).listAs(QueryWrapper.create() - .select(STAFF.ID, STAFF.NAME) + Map staffMap = SpringUtils.getBean(StaffService.class).listAs(QueryWrapper.create() + .select(STAFF.ID, STAFF.NAME, STAFF.USER_ID) .select(SYS_USER.PHONE_NUMBER.as(StaffInfoVo::getPhoneNumber)) .from(STAFF) .leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID)), - StaffInfoVo.class).stream().collect(Collectors.toMap(StaffInfoVo::getPhoneNumber, item -> item));*/ - Map oldReimburseIdMap = SpringUtils.getBean(FinanceReimburseService.class).list().stream().collect(Collectors.toMap(BaseEntity::getCreateUserId, item -> item)); + StaffInfoVo.class).stream().collect(Collectors.toMap(StaffInfoVo::getPhoneNumber, item -> item)); + List filterRecordRowList = recordRowList.stream() + .filter(item -> StringUtils.isNotBlank(item.getString("phone")) && staffMap.get(item.getString("phone")) != null) + .collect(Collectors.toList()); + filterRecordRowList.forEach(item->{ + //文件上传地址格式调整 + if (StringUtils.isNotBlank(item.getString("attachmentUrl"))) { + Map map = new HashMap<>(); + map.put("name", "旧数据无名字"); + map.put("url", item.getString("attachmentUrl")); + List> maps = new ArrayList<>(); + maps.add(map); + item.set("attachmentUrl", JSONArray.toJSONString(maps)); + } + StaffInfoVo staffInfoVo = staffMap.get(item.getString("phone")); + item.set("staffId", staffInfoVo.getId()); + }); + List financeReimburses = RowUtil.toEntityList(filterRecordRowList, FinanceReimburse.class); + SpringUtils.getBean(FinanceReimburseService.class).saveBatch(financeReimburses); + //获取所有员工 + Map oldReimburseIdMap = SpringUtils.getBean(FinanceReimburseService.class).list().stream().collect(Collectors.toMap(BaseEntity::getUpdateUserId, item -> item)); stageRowList.forEach(item -> { if (oldReimburseIdMap.get(item.getString("financeReimbursementId")) != null){ item.set("financeReimburseId", oldReimburseIdMap.get(item.getString("financeReimbursementId")).getId()); @@ -1578,9 +1584,28 @@ public class CpopImportTests { List entityList = RowUtil.toEntityList(cpSysUser, SysUser.class); //加密 PasswordEncoder passwordEncoder = SpringUtils.getBean(PasswordEncoder.class); - entityList.forEach(item->{ - item.setPassword(passwordEncoder.encode(item.getPhoneNumber())); + RsaUtils rsaUtils = SpringUtils.getBean(RsaUtils.class); + entityList.forEach(item -> { + if (!StringUtils.equals("1", item.getId())) { + String lastFourChars = "jambox" + item.getPhoneNumber().substring(item.getPhoneNumber().length() - 4); + item.setPassword(passwordEncoder.encode(lastFourChars)); + item.setRsaPassword(rsaUtils.encrypt(lastFourChars)); + } }); Db.executeBatch(entityList, CoreMapper.class, CoreMapper::updateSysUser); } + + /** + * 同步品牌与校区数据 + * @author DB + * @since 2024/1/8 + */ + @Test + public void syncBrandAndStoreData() { + BrandService brandService = SpringUtils.getBean(BrandService.class); + for (int i = 2207; i < 2317; i++) { + brandService.importJamboxBrand(String.valueOf(i)); + //导入营业执照相关信息 + } + } } 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 new file mode 100644 index 0000000..b4f827c --- /dev/null +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/CloudDataController.java @@ -0,0 +1,81 @@ +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.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; +import org.springframework.web.bind.annotation.RestController; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-09 16:01 + */ +@RestController +@Api(tags = "数据导入接口") +@RequestMapping("/cloudData") +public class CloudDataController { + + @Autowired + private CloudCustomerStudentHandler cloudCustomerStudentHandler; + + /** + * 获取客户分页 + * @author DB + * @since 2024/1/9 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param customerId 客户id + * @return R> + */ + @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) { + Page pageList = cloudCustomerStudentHandler.getCustomerPage(page, pageSize, startDate, endDate, storeId, customerId); + return R.ok(pageList); + } + + /** + * 获取客户分页 + * @author DB + * @since 2024/1/9 + * @param page 分页参数 + * @param pageSize 分页参数 + * @param startDate 开始日期 + * @param endDate 结束日期 + * @param storeId 校区Id + * @param customerId 客户id + * @return R> + */ + @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) { + Page studentPage = cloudCustomerStudentHandler.getStudentPage(page, pageSize, startDate, endDate, storeId, customerId, studentId); + return R.ok(studentPage); + } +} diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java index 0b16c8d..35298de 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/controller/backstage/TaskTechnologyController.java @@ -12,10 +12,12 @@ 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.format.annotation.DateTimeFormat; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import java.time.LocalDate; import java.util.List; /** @@ -191,8 +193,10 @@ public class TaskTechnologyController { @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-今日事务-个人任务分页列表") @GetMapping("/getPersonTaskPage") - public R> getPersonTaskPage() { - Page list = taskService.getPersonTaskPage(); + public R> getPersonTaskPage(@RequestParam(value = "staffId", required = false) @ApiParam("员工id") String staffId, + @RequestParam(value = "startDate", required = false) @ApiParam("开始日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate, + @RequestParam(value = "endDate", required = false) @ApiParam("结束日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate) { + Page list = taskService.getPersonTaskPage(staffId, startDate, endDate); return R.ok(list); } @@ -354,8 +358,10 @@ public class TaskTechnologyController { @PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @ApiOperation("技术模块-今日事务-个人绩点") @GetMapping("/getIndividualGpa") - public R getIndividualGpa() { - TaskIndividualGpaVo vo = taskService.getIndividualGpa(); + public R getIndividualGpa(@RequestParam(value = "staffId", required = false) @ApiParam("员工id") String staffId, + @RequestParam(value = "startDate", required = false) @ApiParam("开始日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate startDate, + @RequestParam(value = "endDate", required = false) @ApiParam("结束日期") @DateTimeFormat(pattern = "yyyy-MM-dd") LocalDate endDate) { + TaskIndividualGpaVo vo = taskService.getIndividualGpa(staffId, startDate, endDate); return R.ok(vo); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskService.java index 0d6a911..c7e8a36 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskService.java @@ -5,6 +5,10 @@ import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.service.IService; import com.cpop.oam.business.bo.*; import com.cpop.oam.business.entity.Task; +import io.swagger.annotations.ApiParam; +import org.springframework.web.bind.annotation.RequestParam; + +import java.time.LocalDate; /** * OAM-任务表 服务层。 @@ -70,7 +74,7 @@ public interface TaskService extends IService { * @since 2023/12/04 * @return Page */ - Page getPersonTaskPage(); + Page getPersonTaskPage(String staffId, LocalDate startDate, LocalDate endDate); /** * 技术模块-今日事务-转交任务 @@ -120,6 +124,6 @@ public interface TaskService extends IService { * @since 2023/12/05 * @return TaskIndividualGpaVo */ - TaskIndividualGpaVo getIndividualGpa(); + TaskIndividualGpaVo getIndividualGpa(String staffId, LocalDate startDate,LocalDate endDate); } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java index be1acbb..b76b795 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/TaskWorkOrderService.java @@ -12,6 +12,7 @@ import com.cpop.oam.business.entity.TaskWorkOrder; import com.cpop.oam.business.vo.TaskWorkOrderPageVo; import com.cpop.oam.business.vo.TaskWorkOrderRecordListVo; +import java.time.LocalDate; import java.util.List; /** diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java index 2c4b5ce..2567bc1 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/BusinessServiceImpl.java @@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.bean.BeanUtils; +import com.cpop.core.base.entity.LoginUser; import com.cpop.core.base.entity.PageDomain; import com.cpop.core.base.exception.ServiceException; import com.cpop.core.utils.SecurityUtils; @@ -363,9 +364,11 @@ public class BusinessServiceImpl extends ServiceImpl i } business.setAllSurplusQuantity(business.getAllSurplusQuantity() - 1); this.updateById(business); + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); SpringUtils.getBean(BusinessStaffService.class).updateChain() .setRaw(BUSINESS_STAFF.SURPLUS_QUANTITY, "surplus_quantity - 1") .where(BUSINESS_STAFF.BUSINESS_ID.eq(businessDetail.getBusinessId())) + .and(BUSINESS_STAFF.STAFF_ID.eq(loginUserInfo.getString("id"))) .update(); } } diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java index 02f6cd2..22cd726 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskServiceImpl.java @@ -29,6 +29,8 @@ import com.cpop.oam.framework.constant.WebHookKeyConstant; import com.cpop.oam.framework.enums.OamConfigEnum; import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.query.QueryWrapper; +import com.mybatisflex.core.row.Db; +import com.mybatisflex.core.row.Row; import com.mybatisflex.spring.service.impl.ServiceImpl; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; @@ -331,22 +333,40 @@ public class TaskServiceImpl extends ServiceImpl implements Ta * @since 2023/12/04 */ @Override - public Page getPersonTaskPage() { + public Page getPersonTaskPage(String staffId, LocalDate startDate, LocalDate endDate) { PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); - JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); String testStaffPhones = SpringUtils.getBean(RedisService.class).getCacheObject(OamConfigKey.OAM_CONFIG_KEY + OamConfigEnum.TEST_STAFF_PHONE.getKey()); if (StringUtils.isBlank(testStaffPhones)) { throw new ServiceException("测试员工手机号未配置,请联系相关人员配置"); } QueryWrapper queryWrapper = QueryWrapper.create(); - //对比当前员工是否是测试管理员 - if (!Arrays.asList(testStaffPhones.split(",")).contains(loginUserInfo.getString("phoneNumber"))) { - queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) - .and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))); + if (StringUtils.isNotBlank(staffId)){ + Row staff = Db.selectOneByQuery(SYS_USER.getTableName(), QueryWrapper.create().select(SYS_USER.PHONE_NUMBER) + .leftJoin(STAFF).on(STAFF.USER_ID.eq(SYS_USER.ID)) + .where(STAFF.ID.eq(staffId))); + //对比当前员工是否是测试管理员 + if (!Arrays.asList(testStaffPhones.split(",")).contains(staff.getString("phoneNumber"))) { + queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(staffId)); + } else { + //测试人员 + queryWrapper.and(TASK.TASK_STATUS.eq(3)) + .groupBy(TASK.ID); + } } else { - //测试人员 - queryWrapper.and(TASK.TASK_STATUS.eq(3)) - .groupBy(TASK.ID); + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + //对比当前员工是否是测试管理员 + if (!Arrays.asList(testStaffPhones.split(",")).contains(loginUserInfo.getString("phoneNumber"))) { + queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) + .and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))); + } else { + //测试人员 + queryWrapper.and(TASK.TASK_STATUS.eq(3)) + .groupBy(TASK.ID); + } + } + if (startDate != null && endDate != null) { + queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(startDate, endDate)); } return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), @@ -755,22 +775,31 @@ public class TaskServiceImpl extends ServiceImpl implements Ta * @return TaskIndividualGpaVo */ @Override - public TaskIndividualGpaVo getIndividualGpa() { - //获取当前用户信息 - JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); - LocalDate now = LocalDate.now(); - // 获取目标月的第一天 - LocalDate firstDay = now.with(TemporalAdjusters.firstDayOfMonth()); - // 获取目标月的最后一天 - LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth()); - List individualGpas = this.listAs(QueryWrapper.create() + public TaskIndividualGpaVo getIndividualGpa(String staffId, LocalDate startDate, LocalDate endDate) { + QueryWrapper queryWrapper = QueryWrapper.create(); + if (StringUtils.isNotBlank(staffId)) { + queryWrapper.and(TASK_STAFF_GROUP.STAFF_ID.eq(staffId)); + } else { + //获取当前用户信息 + JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); + queryWrapper.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))); + } + if (startDate!=null && endDate!=null){ + queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(startDate, endDate)); + } else { + LocalDate now = LocalDate.now(); + // 获取目标月的第一天 + LocalDate firstDay = now.with(TemporalAdjusters.firstDayOfMonth()); + // 获取目标月的最后一天 + LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth()); + //获取当月绩点 + queryWrapper.and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(firstDay, lastDay)); + } + List individualGpas = this.listAs(queryWrapper .select(TASK.ID, TASK.TASK_CONTENT, TASK.TASK_STATUS) .select(TASK_STAFF_GROUP.GRADE_POINT, TASK_STAFF_GROUP.REMARK) .leftJoin(TASK_STAFF_GROUP).on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID)) - .where(TASK.TASK_STATUS.in(2, 3, 4, 5, 6, 7, 8, 9)) - .and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id"))) - //获取当月绩点 - .and(dateFormat(TASK.TASK_RECEIPT_TIME, "%Y-%m-%d").between(firstDay, lastDay)) + .where(TASK.TASK_STATUS.in(2, 3, 5, 7, 8, 9)) , TaskIndividualGpaDetailVo.class); TaskIndividualGpaVo vo = new TaskIndividualGpaVo(); if (individualGpas.isEmpty()) { diff --git a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java index d3a8c16..dded892 100644 --- a/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java +++ b/Cpop-Oam/src/main/java/com/cpop/oam/business/service/impl/TaskWorkOrderServiceImpl.java @@ -695,7 +695,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl item.field(TaskWorkOrderPersonVo::getRecordStaffName) diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDetailDto.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDetailDto.java new file mode 100644 index 0000000..18656d0 --- /dev/null +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDetailDto.java @@ -0,0 +1,36 @@ +package com.cpop.pay.framewok.core.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.math.BigDecimal; + +/** + * @author DB + * @version 1.0.0 + * @since 2024-01-08 9:54 + */ +@Data +public class LearnNowPayLaterPlanDetailDto { + + /** + * 计划明细优惠说明 + */ + private String planDiscountDescription; + + /** + * 计划明细原支付金额(单位分) + */ + private Integer originalPrice; + + /** + * 计划明细实际支付金额(单位分) + */ + private Long actualPrice; + + /** + * 计划明细名称 + */ + private String planDetailName; +} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java index cac2fdc..626fd64 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/core/dto/LearnNowPayLaterPlanDto.java @@ -1,7 +1,10 @@ package com.cpop.pay.framewok.core.dto; +import com.cpop.core.base.enums.OrderSource; import lombok.Data; +import java.util.List; + /** * @author DB * @version 1.0.0 @@ -9,4 +12,40 @@ import lombok.Data; */ @Data public class LearnNowPayLaterPlanDto { + + /** + * 支付分计划名称 + */ + private String planName; + + /** + * 支付分计划有效期(单位天) + */ + private Integer planDuration; + + /** + * 支付分计划扣费次数 + */ + private Integer deductionQuantity; + + /** + * 支付分计划原总金额(单位分) + */ + private Integer totalOriginalPrice; + + /** + * 支付分计划实际扣费总金额(单位分) + */ + private Integer totalActualPrice; + + /** + * 支付分计划明细列表 + */ + private List planDetailList; + + /** + * 订单来源 + */ + private OrderSource orderSource = OrderSource.EASY_LEARN; + } diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java deleted file mode 100644 index ee57076..0000000 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/UnionPayHandler.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.cpop.pay.framewok.handler; - -import org.springframework.stereotype.Component; - -/** - * 联合支付处理器 - * @author DB - * @version 1.0.0 - * @since 2024-01-05 15:24 - */ -@Component -public class UnionPayHandler { - - -} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java index 94feedd..a5a3cea 100644 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java +++ b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/handler/wxPay/WxPayHandler.java @@ -2,15 +2,26 @@ package com.cpop.pay.framewok.handler.wxPay; import com.alibaba.fastjson.JSONObject; import com.cpop.common.utils.StringUtils; +import com.cpop.common.utils.bean.BeanUtils; import com.cpop.core.base.exception.ServiceException; +import com.cpop.core.base.exception.UtilException; import com.cpop.core.utils.SecurityUtils; +import com.cpop.pay.framewok.core.dto.LearnNowPayLaterPlanDto; +import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanRequest; +import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanResult; import com.github.binarywang.wxpay.config.WxPayConfig; +import com.github.binarywang.wxpay.exception.WxPayException; +import com.github.binarywang.wxpay.service.PartnerPayScoreSignPlanService; import com.github.binarywang.wxpay.service.WxPayService; import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.row.Db; import com.mybatisflex.core.row.Row; +import com.mybatisflex.core.row.RowKey; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; +import org.springframework.transaction.annotation.Transactional; + +import java.util.ArrayList; /** * @author DB @@ -129,4 +140,50 @@ public class WxPayHandler { } return wxMchId; } + + /** + * 创建支付分计划 + * @author DB + * @since 2024/1/8 + * @param wxPayService 微信支付 + * @param dto 先学后付计划 + * @return WxPartnerPayScoreSignPlanResult + */ + @Transactional(rollbackFor = Exception.class) + public WxPartnerPayScoreSignPlanResult createPayScorePlan(WxPayService wxPayService, LearnNowPayLaterPlanDto dto) { + Row row = Row.ofKey(RowKey.SNOW_FLAKE_ID); + row.set("sign_account", wxPayService.getConfig().getSubMchId()); + row.set("plan_name", dto.getPlanName()); + row.set("plan_duration", dto.getPlanDuration()); + row.set("deduction_quantity", dto.getDeductionQuantity()); + row.set("total_original_price", dto.getTotalOriginalPrice()); + row.set("total_actual_price", dto.getTotalActualPrice()); + row.set("plan_source", dto.getOrderSource().toString()); + //插入计划 + Db.insert("cp_sys_wx_pay_score", row); + PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); + WxPartnerPayScoreSignPlanRequest planRequest = BeanUtils.mapToClass(dto, WxPartnerPayScoreSignPlanRequest.class); + planRequest.setMerchantPlanNo(row.getString("id")); + WxPartnerPayScoreSignPlanResult plans; + try { + plans = partnerPayScoreSignPlanService.createPlans(planRequest); + } catch (WxPayException e) { + throw new UtilException(e); + } + ArrayList detailRows = new ArrayList<>(); + //更新计划详情 + plans.getPlanDetailList().forEach(item -> { + Row detailRow = Row.ofKey(RowKey.SNOW_FLAKE_ID); + detailRow.set("sys_wx_pay_score_id", row.getString("id")); + detailRow.set("plan_detail_no", item.getPlanDetailNo()); + detailRow.set("original_price", item.getOriginalPrice()); + detailRow.set("actual_price", item.getActualPrice()); + detailRow.set("plan_discount_description", item.getPlanDiscountDescription()); + detailRow.set("plan_detail_name", item.getPlanDetailName()); + detailRows.add(detailRow); + }); + //批量插入 + Db.insertBatch("cp_sys_wx_pay_score_detail", detailRows); + return plans; + } } diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java deleted file mode 100644 index b87c3d6..0000000 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/UnionPayStrategy.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.cpop.pay.framewok.strategy; - -import org.springframework.stereotype.Component; - -/** - * 联合支付策略 - * @author DB - * @version 1.0.0 - * @since 2024-01-05 15:26 - */ -public interface UnionPayStrategy { - - Object unionPay(String unionPayNo); - -} diff --git a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java b/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java deleted file mode 100644 index fb7218e..0000000 --- a/Cpop-Pay/src/main/java/com/cpop/pay/framewok/strategy/wxPay/LearnNowPayLaterOnePayStrategy.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.cpop.pay.framewok.strategy.wxPay; - -import com.cpop.pay.framewok.strategy.UnionPayStrategy; -import com.github.binarywang.wxpay.bean.payscore.WxPartnerPayScoreSignPlanRequest; -import com.github.binarywang.wxpay.exception.WxPayException; -import com.github.binarywang.wxpay.service.PartnerPayScoreSignPlanService; -import com.github.binarywang.wxpay.service.WxPayService; -import org.springframework.stereotype.Component; - -/** - * @author DB - * @version 1.0.0 - * @since 2024-01-05 15:27 - */ -@Component -public class LearnNowPayLaterOnePayStrategy implements UnionPayStrategy { - - /** - * 联合支付 - * @author DB - * @since 2024/1/5 - * @param unionPayNo - * @return Object - */ - @Override - public Object unionPay(String unionPayNo) { - - return null; - } - - public void createPayScorePlan(WxPayService wxPayService) throws WxPayException { - PartnerPayScoreSignPlanService partnerPayScoreSignPlanService = wxPayService.getPartnerPayScoreSignPlanService(); - WxPartnerPayScoreSignPlanRequest planRequest = new WxPartnerPayScoreSignPlanRequest(); - //planRequest.setPlanId() - partnerPayScoreSignPlanService.createPlans(planRequest); - - } -} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScore.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScore.java new file mode 100644 index 0000000..c172d3a --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScore.java @@ -0,0 +1,83 @@ +package com.cpop.system.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 微信支付分计划表 实体类。 + * + * @author DB + * @since 2024-01-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_sys_wx_pay_score", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class WxPayScore extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 外部计划id + */ + private String outPlanId; + + /** + * 签约账号信息 + */ + private String signAccount; + + /** + * 计划名 + */ + private String planName; + + /** + * 支付分计划有效期(单位天) + */ + private Integer planDuration; + + /** + * 支付分计划扣费次数 + */ + private Integer deductionQuantity; + + /** + * 支付分计划原总金额(单位分) + */ + private Integer totalOriginalPrice; + + /** + * 支付分计划实际扣费总金额(单位分) + */ + private Integer totalActualPrice; + + /** + * 计划来源 + */ + private String planSource; + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScoreDetail.java b/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScoreDetail.java new file mode 100644 index 0000000..e35cfa9 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/entity/WxPayScoreDetail.java @@ -0,0 +1,74 @@ +package com.cpop.system.business.entity; + +import com.cpop.core.base.entity.BaseEntity; +import com.cpop.core.base.entity.BaseInsertListener; +import com.cpop.core.base.entity.BaseUpdateListener; +import com.mybatisflex.annotation.Column; +import com.mybatisflex.annotation.Id; +import com.mybatisflex.annotation.Table; +import java.io.Serializable; +import java.time.LocalDateTime; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.*; +import lombok.experimental.Accessors; + +/** + * 微信支付分计划详情表 实体类。 + * + * @author DB + * @since 2024-01-08 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@Builder +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +@Table(value = "cp_sys_wx_pay_score_detail", onInsert = BaseInsertListener.class, onUpdate = BaseUpdateListener.class, mapperGenerateEnable = false) +public class WxPayScoreDetail extends BaseEntity implements Serializable { + + /** + * 主键 + */ + @Id + private String id; + + /** + * 系统微信支付分id + */ + @Id + private String sysWxPayScoreId; + + /** + * 计划详情编号 + */ + private Integer planDetailNo; + + /** + * 计划明细原支付金额(单位分) + */ + private Integer originalPrice; + + /** + * 计划明细实际支付金额(单位分) + */ + private Long actualPrice; + + /** + * 计划明细优惠说明 + */ + private String planDiscountDescription; + + /** + * 计划明细名称 + */ + private String planDetailName; + + /** + * 逻辑删除(0否1是) + */ + @Column(isLogicDelete = true) + private Boolean isDelete; + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreDetailMapper.java b/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreDetailMapper.java new file mode 100644 index 0000000..b9098cb --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreDetailMapper.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.system.business.entity.WxPayScoreDetail; + +/** + * 微信支付分计划详情表 映射层。 + * + * @author DB + * @since 2024-01-08 + */ +public interface WxPayScoreDetailMapper extends BaseMapper { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreMapper.java b/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreMapper.java new file mode 100644 index 0000000..30275ee --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/mapper/WxPayScoreMapper.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.mapper; + +import com.mybatisflex.core.BaseMapper; +import com.cpop.system.business.entity.WxPayScore; + +/** + * 微信支付分计划表 映射层。 + * + * @author DB + * @since 2024-01-08 + */ +public interface WxPayScoreMapper extends BaseMapper { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreDetailService.java b/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreDetailService.java new file mode 100644 index 0000000..82c899a --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreDetailService.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.system.business.entity.WxPayScoreDetail; + +/** + * 微信支付分计划详情表 服务层。 + * + * @author DB + * @since 2024-01-08 + */ +public interface WxPayScoreDetailService extends IService { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreService.java b/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreService.java new file mode 100644 index 0000000..c2718c3 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/WxPayScoreService.java @@ -0,0 +1,14 @@ +package com.cpop.system.business.service; + +import com.mybatisflex.core.service.IService; +import com.cpop.system.business.entity.WxPayScore; + +/** + * 微信支付分计划表 服务层。 + * + * @author DB + * @since 2024-01-08 + */ +public interface WxPayScoreService extends IService { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java index ab247f7..18b3c65 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/BrandServiceImpl.java @@ -9,6 +9,8 @@ import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.sql.SqlUtils; import com.cpop.system.business.entity.Store; +import com.cpop.system.business.entity.StoreLicense; +import com.cpop.system.business.service.StoreLicenseService; import com.cpop.system.business.service.StoreService; import com.cpop.system.business.vo.BrandPageVo; import com.mybatisflex.core.datasource.DataSourceKey; @@ -85,8 +87,8 @@ public class BrandServiceImpl extends ServiceImpl implements .set("brand_cloud_id", brand.getString("brandId")) .set("create_time", now) .set("update_time", now) - .set("create_user_id", loginUser.getUserId()) - .set("update_user_id", loginUser.getUserId()) + .set("create_user_id", loginUser == null ? "1" : loginUser.getUserId()) + .set("update_user_id", loginUser == null ? "1" : loginUser.getUserId()) .save(); //导入果酱品牌关联校区 importJamboxStore(jamboxBrandId,sysBrand.getId()); @@ -100,7 +102,7 @@ public class BrandServiceImpl extends ServiceImpl implements * @param brandId 品牌id * @return: void */ - private void importJamboxStore(String jamboxBrandId,String brandId) { + private void importJamboxStore(String jamboxBrandId, String brandId) { //获取果酱校区信息 List storeList; try { @@ -109,6 +111,7 @@ public class BrandServiceImpl extends ServiceImpl implements .select("store_id as storeCloudId","mechanism as storeName","address") .from("t_mechanism_info") .where("brand_id = ?", jamboxBrandId)); + } finally { DataSourceKey.clear(); } @@ -131,11 +134,30 @@ public class BrandServiceImpl extends ServiceImpl implements row.set("store_id", stores.get(i).getId()); row.set("create_time", now); row.set("update_time", now); - row.set("create_user_id", loginUser.getUserId()); - row.set("update_user_id", loginUser.getUserId()); + row.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId()); + row.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId()); storeExtends.add(row); } Db.insertBatch("cp_j_store_extend", storeExtends); + //导入证书信息 + List rowList; + try { + DataSourceKey.use("jambox"); + rowList = DbChain.table("t_mechanism_info").select("store_id as storeCloudId", "reg_addr as licenseAddr", "str_to_date(reg_date,'%Y年%m月%d') as licenseDate", "reg_Name as licenseName", + "ness_license_id as licenseCode", "corp_name as licenseUserName", "reg_pic as licensePicUrl") + .where("reg_addr is not null") + .in("store_id", storeList.stream().map(item -> item.getString("storeCloudId")).collect(Collectors.toList())) + .list(); + } finally { + DataSourceKey.clear(); + } + //获取校区信息 + Map storeMap = storeExtends.stream().collect(Collectors.toMap(item->item.getString("store_cloud_id"),item->item.getString("store_id"))); + rowList.forEach(item -> { + item.set("storeId", storeMap.get(item.getString("storeCloudId"))); + }); + List licenseList = RowUtil.toEntityList(rowList, StoreLicense.class).stream().filter(item->item.getStoreId() != null).collect(Collectors.toList()); + SpringUtils.getBean(StoreLicenseService.class).saveBatch(licenseList); } } @@ -152,7 +174,8 @@ public class BrandServiceImpl extends ServiceImpl implements return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), QueryWrapper.create() .select(BRAND.ID, BRAND.BRAND_NAME, BRAND.WX_MCH_ID, BRAND.CREATE_TIME, BRAND.IS_OPEN_SHARING) - .and(BRAND.BRAND_NAME.like(brandName)), + .and(BRAND.BRAND_NAME.like(brandName)) + .orderBy(BRAND.CREATE_TIME.desc()), BrandPageVo.class); } diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java index af4abcd..850da2c 100644 --- a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/StoreServiceImpl.java @@ -66,7 +66,8 @@ public class StoreServiceImpl extends ServiceImpl implements .leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID)) .leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_ID)) .leftJoin("cp_j_store_extend").on("`cp_j_store_extend`.`store_id` = `cp_sys_store`.`id`") - .and(STORE.STORE_NAME.like(bo.getName())), + .and(STORE.STORE_NAME.like(bo.getName())) + .orderBy(BRAND.CREATE_TIME.desc()), StorePageVo.class); } diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreDetailServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreDetailServiceImpl.java new file mode 100644 index 0000000..f30e4b7 --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreDetailServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.system.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.system.business.entity.WxPayScoreDetail; +import com.cpop.system.business.mapper.WxPayScoreDetailMapper; +import com.cpop.system.business.service.WxPayScoreDetailService; +import org.springframework.stereotype.Service; + +/** + * 微信支付分计划详情表 服务层实现。 + * + * @author DB + * @since 2024-01-08 + */ +@Service("wxPayScoreDetailService") +public class WxPayScoreDetailServiceImpl extends ServiceImpl implements WxPayScoreDetailService { + +} diff --git a/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreServiceImpl.java b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreServiceImpl.java new file mode 100644 index 0000000..44ee59e --- /dev/null +++ b/Cpop-System/src/main/java/com/cpop/system/business/service/impl/WxPayScoreServiceImpl.java @@ -0,0 +1,18 @@ +package com.cpop.system.business.service.impl; + +import com.mybatisflex.spring.service.impl.ServiceImpl; +import com.cpop.system.business.entity.WxPayScore; +import com.cpop.system.business.mapper.WxPayScoreMapper; +import com.cpop.system.business.service.WxPayScoreService; +import org.springframework.stereotype.Service; + +/** + * 微信支付分计划表 服务层实现。 + * + * @author DB + * @since 2024-01-08 + */ +@Service("wxPayScoreService") +public class WxPayScoreServiceImpl extends ServiceImpl implements WxPayScoreService { + +} diff --git a/Cpop-System/src/main/resources/mapper/WxPayScoreDetailMapper.xml b/Cpop-System/src/main/resources/mapper/WxPayScoreDetailMapper.xml new file mode 100644 index 0000000..bf38a77 --- /dev/null +++ b/Cpop-System/src/main/resources/mapper/WxPayScoreDetailMapper.xml @@ -0,0 +1,7 @@ + + + + + diff --git a/Cpop-System/src/main/resources/mapper/WxPayScoreMapper.xml b/Cpop-System/src/main/resources/mapper/WxPayScoreMapper.xml new file mode 100644 index 0000000..904d209 --- /dev/null +++ b/Cpop-System/src/main/resources/mapper/WxPayScoreMapper.xml @@ -0,0 +1,7 @@ + + + + +