添加微信支付分相关代码;添加先学后付计划;添加云函数查询API

This commit is contained in:
DB 2024-01-09 17:59:48 +08:00
parent 6045a9c0e2
commit 3ef12d64fc
54 changed files with 2065 additions and 149 deletions

View File

@ -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";
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<String> classType;
/**
* 录入时间
*/
@SerializedName("_createTime")
private String createTime;
/**
* 满班学员数
*/
@SerializedName("studentMaxLimit")
private Integer fullClassStudentNum;
/**
* 主键
*/
@SerializedName("_id")
private String id;
/**
* 是否结班
*/
@SerializedName("finish")
private Boolean isCloseClass;
}

View File

@ -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;
}

View File

@ -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<String> classType;
/**
* 导师
*/
@SerializedName("_staffid")
private String supervisor;
/**
* 创建时间
*/
@SerializedName("_createTime")
private String createTime;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<CloudCustomerDto>
*/
public Page<CloudCourseDto> 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<CloudCourseDto> page = Page.of(pageNum, pageSize);
if (jsonObject != null) {
if (jsonObject.getBoolean("success")) {
List<CloudCourseDto> 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;
}
}
}

View File

@ -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<CloudCustomerDto>
*/
public Page<CloudCustomerDto> 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<CloudCustomerDto> page = Page.of(pageNum, pageSize);
if (jsonObject != null) {
if (jsonObject.getBoolean("success")) {
List<CloudCustomerDto> 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<CloudStudentDto>
*/
public Page<CloudStudentDto> 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<CloudStudentDto> page = Page.of(pageNum, pageSize);
if (jsonObject != null) {
if (jsonObject.getBoolean("success")) {
List<CloudStudentDto> 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;
}
}
}

View File

@ -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_";
/** /**
* 主入口 * 主入口

View File

@ -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;
}

View File

@ -81,4 +81,11 @@ public class EasyLearnUnionPayBo {
@ApiModelProperty(value = "openId", required = true) @ApiModelProperty(value = "openId", required = true)
private String openId; private String openId;
/**
* 订单名
*/
@ApiModelProperty("订单内容(课卡名/商品名)")
private String orderContent;
} }

View File

@ -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<PlanDetail> 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;
}
}

View File

@ -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<LearnNowPayLaterPlanDetailBo> planDetailList;
}

View File

@ -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;
}

View File

@ -68,16 +68,16 @@ public class OncePlaceOrderBo {
@ApiModelProperty(value = "总支付金额",required = true) @ApiModelProperty(value = "总支付金额",required = true)
private BigDecimal totalPayAmount; private BigDecimal totalPayAmount;
/**
* 校区/店铺员工云id
*/
@ApiModelProperty("校区/店铺员工云id")
private String storeStaffCloudId;
/** /**
* openId * openId
*/ */
@ApiModelProperty("openId") @ApiModelProperty("openId")
private String openId; private String openId;
/**
* 订单名
*/
@ApiModelProperty("订单内容(课卡名/商品名)")
private String orderContent;
} }

View File

@ -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;
}

View File

@ -3,6 +3,7 @@ package com.cpop.jambox.business.controller.backstage;
import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcel;
import com.cpop.core.base.R; import com.cpop.core.base.R;
import com.cpop.jambox.business.bo.EasyLearnPageBo; 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.EasyLearnUnionPayBo;
import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto; import com.cpop.jambox.business.dto.EasyLearnPageDto;
@ -107,9 +108,24 @@ public class EasyLearnController {
* @param bo 请求参数 * @param bo 请求参数
* @return R<Object> * @return R<Object>
*/ */
@Deprecated
@PostMapping("/unionPay") @PostMapping("/unionPay")
@ApiOperation("放心学统一支付") @ApiOperation("放心学统一支付")
public R<Object> unionPay(@RequestBody @Validated @ApiParam("一次性支付") EasyLearnUnionPayBo bo) { public R<Object> unionPay(@RequestBody @Validated EasyLearnUnionPayBo bo) {
return R.ok(easyLearnOrderService.unionPay(bo)); return R.ok(easyLearnOrderService.unionPay(bo));
} }
/**
* 放心学统一支付
* @author DB
* @since 2024/1/9
* @param bo 请求参数
* @return R<Object>
*/
@PostMapping("/unifiedPay")
@ApiOperation("放心学统一支付(测试)")
public R<Object> unifiedPay(@RequestBody @Validated @ApiParam("放心学统一支付") EasyLearnUnifiedPayBo bo) {
return R.ok(easyLearnOrderService.unifiedPay(bo));
}
} }

View File

@ -33,6 +33,11 @@ public class EasyLearnOrder extends BaseEntity implements Serializable {
@Id @Id
private String id; private String id;
/**
* 购买的商品信息
*/
private String orderContent;
/** /**
* 支付状态(0未支付1已支付) * 支付状态(0未支付1已支付)
*/ */
@ -48,11 +53,6 @@ public class EasyLearnOrder extends BaseEntity implements Serializable {
*/ */
private String orderCloudId; private String orderCloudId;
/**
* 校区/店铺员工云id
*/
private String storeStaffCloudId;
/** /**
* 外部订单号 * 外部订单号
*/ */
@ -93,11 +93,6 @@ public class EasyLearnOrder extends BaseEntity implements Serializable {
*/ */
private BigDecimal totalPayAmount; private BigDecimal totalPayAmount;
/**
* 员工id
*/
private String staffId;
/** /**
* 订单类型(0先学后付;1月付;2微信支付;3数币支付;4机构会员) * 订单类型(0先学后付;1月付;2微信支付;3数币支付;4机构会员)
*/ */

View File

@ -1,6 +1,7 @@
package com.cpop.jambox.business.service; package com.cpop.jambox.business.service;
import com.cpop.jambox.business.bo.EasyLearnPageBo; 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.EasyLearnUnionPayBo;
import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto; import com.cpop.jambox.business.dto.EasyLearnPageDto;
@ -67,4 +68,13 @@ public interface EasyLearnOrderService extends IService<EasyLearnOrder> {
* @param xmlData 数据 * @param xmlData 数据
*/ */
void unionPayResult(String xmlData); void unionPayResult(String xmlData);
/**
* 放心学统一支付
* @author DB
* @since 2024/1/9
* @param bo 请求参数
* @return Object
*/
Object unifiedPay(EasyLearnUnifiedPayBo bo);
} }

View File

@ -13,6 +13,7 @@ import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.jambox.business.bo.EasyLearnPageBo; 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.EasyLearnUnionPayBo;
import com.cpop.jambox.business.bo.OncePlaceOrderBo; import com.cpop.jambox.business.bo.OncePlaceOrderBo;
import com.cpop.jambox.business.dto.EasyLearnPageDto; import com.cpop.jambox.business.dto.EasyLearnPageDto;
@ -632,6 +633,7 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
} else { } else {
url = UNION_PAY_DEV_JAMBOX_NOTIFY_URL; url = UNION_PAY_DEV_JAMBOX_NOTIFY_URL;
} }
//通知晖哥
HttpUtils.sendOkHttpPost(url, jsonObject.toJSONString()); HttpUtils.sendOkHttpPost(url, jsonObject.toJSONString());
//更新订单 //更新订单
this.updateChain().set(EASY_LEARN_ORDER.OUT_ORDER_NO, notifyResult.getTransactionId()) this.updateChain().set(EASY_LEARN_ORDER.OUT_ORDER_NO, notifyResult.getTransactionId())
@ -641,4 +643,16 @@ public class EasyLearnOrderServiceImpl extends ServiceImpl<EasyLearnOrderMapper,
throw new ServiceException(e.getMessage()); throw new ServiceException(e.getMessage());
} }
} }
/**
* 放心学统一支付
* @author DB
* @since 2024/1/9
* @param bo 请求参数
* @return Object
*/
@Override
public Object unifiedPay(EasyLearnUnifiedPayBo bo) {
return null;
}
} }

View File

@ -10,6 +10,26 @@ import lombok.Getter;
@Getter @Getter
public enum EasyLearnPayPayEnum { public enum EasyLearnPayPayEnum {
/**
* 放心学次付
*/
EASY_LEARN_DEFAULT_PAY("EasyLearnDefaultPay",0),
/**
* 放心学月付
*/
EASY_LEARN_MONTH_PAY("EasyLearnMonthPay",1),
/**
* 微信支付
*/
WX_PAY("WxPay",2),
/**
* 数币支付
*/
DIGITAL_CURRENCY("DigitalCurrency",3),
/** /**
* 预付 * 预付
*/ */
@ -23,7 +43,7 @@ public enum EasyLearnPayPayEnum {
/** /**
* 会员 * 会员
*/ */
MEMBER("MEMBER",7);; MEMBER("MEMBER",7);
EasyLearnPayPayEnum(String name, Integer orderType) { EasyLearnPayPayEnum(String name, Integer orderType) {
this.orderType = orderType; this.orderType = orderType;

View File

@ -0,0 +1,29 @@
package com.cpop.oam.web;
import com.cpop.api.cloudDb.core.dto.CloudCustomerDto;
import com.cpop.api.cloudDb.handler.CloudCustomerStudentHandler;
import com.cpop.core.utils.SpringUtils;
import com.mybatisflex.core.paginate.Page;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
/**
* @author DB
* @version 1.0.0
* @since 2024-01-09 14:55
*/
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.RANDOM_PORT)
public class CpopCloudDbTests {
/**
* 获取客户分页测试
* @author DB
* @since 2024/1/9
*/
@Test
public void getCustomerPageTest() {
Page<CloudCustomerDto> page = SpringUtils.getBean(CloudCustomerStudentHandler.class).getCustomerPage(1, 10, null, null,
"f4a7f4c892934490a7550ed1e2f0opiu", null);
System.out.println(page);
}
}

View File

@ -83,4 +83,6 @@ public class CpopCoreTests {
String encode = SpringUtils.getBean(PasswordEncoder.class).encode("Admin@123"); String encode = SpringUtils.getBean(PasswordEncoder.class).encode("Admin@123");
System.out.println("encode加密"+encode); System.out.println("encode加密"+encode);
} }
} }

View File

@ -23,10 +23,7 @@ import com.cpop.system.business.entity.Store;
import com.cpop.system.business.entity.StoreLicense; import com.cpop.system.business.entity.StoreLicense;
import com.cpop.system.business.entity.StoreRenew; import com.cpop.system.business.entity.StoreRenew;
import com.cpop.system.business.entity.StoreSign; import com.cpop.system.business.entity.StoreSign;
import com.cpop.system.business.service.StoreLicenseService; import com.cpop.system.business.service.*;
import com.cpop.system.business.service.StoreRenewService;
import com.cpop.system.business.service.StoreService;
import com.cpop.system.business.service.StoreSignService;
import com.mybatisflex.core.FlexGlobalConfig; import com.mybatisflex.core.FlexGlobalConfig;
import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.datasource.DataSourceKey;
import com.mybatisflex.core.datasource.FlexDataSource; import com.mybatisflex.core.datasource.FlexDataSource;
@ -842,19 +839,14 @@ public class CpopImportTests {
List<Row> stageRowList; List<Row> stageRowList;
try { try {
DataSourceKey.use("jambox"); 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") 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") .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") .from("OAM_finance_reimbursement").as("ofr")
.leftJoin("OAM_staff").as("os").on("os.staff_id = ofr.staff_id") .leftJoin("OAM_staff").as("os").on("os.staff_id = ofr.staff_id")
.where("ofr.deleted = 1") .where("ofr.deleted = 1")
.list();*/ .list();
//报销阶段 //报销阶段
stageRowList = DbChain.table("OAM_finance_reimbursement_stage") stageRowList = DbChain.table("OAM_finance_reimbursement_stage")
.select("finance_reimbursement_id", "stage_amount", "payment_time") .select("finance_reimbursement_id", "stage_amount", "payment_time")
@ -864,19 +856,33 @@ public class CpopImportTests {
} finally { } finally {
DataSourceKey.clear(); DataSourceKey.clear();
} }
//List<FinanceReimburseType> financeReimburseTypes = RowUtil.toEntityList(typeRowList, FinanceReimburseType.class);
//SpringUtils.getBean(FinanceReimburseTypeService.class).saveBatch(financeReimburseTypes);
//System.out.println(JSONArray.toJSONString(typeRowList));
//Map<String, FinanceReimburseType> oldTypeIdMap = SpringUtils.getBean(FinanceReimburseTypeService.class).list().stream().collect(Collectors.toMap(BaseEntity::getCreateUserId, item -> item));
//获取所有员工
//获取现有所有员工 //获取现有所有员工
/*Map<String, StaffInfoVo> staffMap = SpringUtils.getBean(StaffService.class).listAs(QueryWrapper.create() Map<String, StaffInfoVo> staffMap = SpringUtils.getBean(StaffService.class).listAs(QueryWrapper.create()
.select(STAFF.ID, STAFF.NAME) .select(STAFF.ID, STAFF.NAME, STAFF.USER_ID)
.select(SYS_USER.PHONE_NUMBER.as(StaffInfoVo::getPhoneNumber)) .select(SYS_USER.PHONE_NUMBER.as(StaffInfoVo::getPhoneNumber))
.from(STAFF) .from(STAFF)
.leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID)), .leftJoin(SYS_USER).on(SYS_USER.ID.eq(STAFF.USER_ID)),
StaffInfoVo.class).stream().collect(Collectors.toMap(StaffInfoVo::getPhoneNumber, item -> item));*/ StaffInfoVo.class).stream().collect(Collectors.toMap(StaffInfoVo::getPhoneNumber, item -> item));
Map<String, FinanceReimburse> oldReimburseIdMap = SpringUtils.getBean(FinanceReimburseService.class).list().stream().collect(Collectors.toMap(BaseEntity::getCreateUserId, item -> item)); List<Row> 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<String, String> map = new HashMap<>();
map.put("name", "旧数据无名字");
map.put("url", item.getString("attachmentUrl"));
List<Map<String, String>> 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<FinanceReimburse> financeReimburses = RowUtil.toEntityList(filterRecordRowList, FinanceReimburse.class);
SpringUtils.getBean(FinanceReimburseService.class).saveBatch(financeReimburses);
//获取所有员工
Map<String, FinanceReimburse> oldReimburseIdMap = SpringUtils.getBean(FinanceReimburseService.class).list().stream().collect(Collectors.toMap(BaseEntity::getUpdateUserId, item -> item));
stageRowList.forEach(item -> { stageRowList.forEach(item -> {
if (oldReimburseIdMap.get(item.getString("financeReimbursementId")) != null){ if (oldReimburseIdMap.get(item.getString("financeReimbursementId")) != null){
item.set("financeReimburseId", oldReimburseIdMap.get(item.getString("financeReimbursementId")).getId()); item.set("financeReimburseId", oldReimburseIdMap.get(item.getString("financeReimbursementId")).getId());
@ -1578,9 +1584,28 @@ public class CpopImportTests {
List<SysUser> entityList = RowUtil.toEntityList(cpSysUser, SysUser.class); List<SysUser> entityList = RowUtil.toEntityList(cpSysUser, SysUser.class);
//加密 //加密
PasswordEncoder passwordEncoder = SpringUtils.getBean(PasswordEncoder.class); PasswordEncoder passwordEncoder = SpringUtils.getBean(PasswordEncoder.class);
entityList.forEach(item->{ RsaUtils rsaUtils = SpringUtils.getBean(RsaUtils.class);
item.setPassword(passwordEncoder.encode(item.getPhoneNumber())); 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); 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));
//导入营业执照相关信息
}
}
} }

View File

@ -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<Page<CloudCustomerDto>>
*/
@ApiOperation("获取客户分页")
@GetMapping("/getCustomerPage")
public R<Page<CloudCustomerDto>> 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<CloudCustomerDto> 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<Page<CloudCustomerDto>>
*/
@ApiOperation("获取学员分页")
@GetMapping("/getStudentPage")
public R<Page<CloudStudentDto>> 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<CloudStudentDto> studentPage = cloudCustomerStudentHandler.getStudentPage(page, pageSize, startDate, endDate, storeId, customerId, studentId);
return R.ok(studentPage);
}
}

View File

@ -12,10 +12,12 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam; import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**
@ -191,8 +193,10 @@ public class TaskTechnologyController {
@PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @PreAuthorize("@aps.hasPermission('oamTask:technology:list')")
@ApiOperation("技术模块-今日事务-个人任务分页列表") @ApiOperation("技术模块-今日事务-个人任务分页列表")
@GetMapping("/getPersonTaskPage") @GetMapping("/getPersonTaskPage")
public R<Page<PersonTaskPageVo>> getPersonTaskPage() { public R<Page<PersonTaskPageVo>> getPersonTaskPage(@RequestParam(value = "staffId", required = false) @ApiParam("员工id") String staffId,
Page<PersonTaskPageVo> list = taskService.getPersonTaskPage(); @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<PersonTaskPageVo> list = taskService.getPersonTaskPage(staffId, startDate, endDate);
return R.ok(list); return R.ok(list);
} }
@ -354,8 +358,10 @@ public class TaskTechnologyController {
@PreAuthorize("@aps.hasPermission('oamTask:technology:list')") @PreAuthorize("@aps.hasPermission('oamTask:technology:list')")
@ApiOperation("技术模块-今日事务-个人绩点") @ApiOperation("技术模块-今日事务-个人绩点")
@GetMapping("/getIndividualGpa") @GetMapping("/getIndividualGpa")
public R<TaskIndividualGpaVo> getIndividualGpa() { public R<TaskIndividualGpaVo> getIndividualGpa(@RequestParam(value = "staffId", required = false) @ApiParam("员工id") String staffId,
TaskIndividualGpaVo vo = taskService.getIndividualGpa(); @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); return R.ok(vo);
} }

View File

@ -5,6 +5,10 @@ import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.service.IService; import com.mybatisflex.core.service.IService;
import com.cpop.oam.business.bo.*; import com.cpop.oam.business.bo.*;
import com.cpop.oam.business.entity.Task; import com.cpop.oam.business.entity.Task;
import io.swagger.annotations.ApiParam;
import org.springframework.web.bind.annotation.RequestParam;
import java.time.LocalDate;
/** /**
* OAM-任务表 服务层 * OAM-任务表 服务层
@ -70,7 +74,7 @@ public interface TaskService extends IService<Task> {
* @since 2023/12/04 * @since 2023/12/04
* @return Page<PersonTaskPageVo> * @return Page<PersonTaskPageVo>
*/ */
Page<PersonTaskPageVo> getPersonTaskPage(); Page<PersonTaskPageVo> getPersonTaskPage(String staffId, LocalDate startDate, LocalDate endDate);
/** /**
* 技术模块-今日事务-转交任务 * 技术模块-今日事务-转交任务
@ -120,6 +124,6 @@ public interface TaskService extends IService<Task> {
* @since 2023/12/05 * @since 2023/12/05
* @return TaskIndividualGpaVo * @return TaskIndividualGpaVo
*/ */
TaskIndividualGpaVo getIndividualGpa(); TaskIndividualGpaVo getIndividualGpa(String staffId, LocalDate startDate,LocalDate endDate);
} }

View File

@ -12,6 +12,7 @@ import com.cpop.oam.business.entity.TaskWorkOrder;
import com.cpop.oam.business.vo.TaskWorkOrderPageVo; import com.cpop.oam.business.vo.TaskWorkOrderPageVo;
import com.cpop.oam.business.vo.TaskWorkOrderRecordListVo; import com.cpop.oam.business.vo.TaskWorkOrderRecordListVo;
import java.time.LocalDate;
import java.util.List; import java.util.List;
/** /**

View File

@ -7,6 +7,7 @@ import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cpop.common.utils.StringUtils; import com.cpop.common.utils.StringUtils;
import com.cpop.common.utils.bean.BeanUtils; 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.entity.PageDomain;
import com.cpop.core.base.exception.ServiceException; import com.cpop.core.base.exception.ServiceException;
import com.cpop.core.utils.SecurityUtils; import com.cpop.core.utils.SecurityUtils;
@ -363,9 +364,11 @@ public class BusinessServiceImpl extends ServiceImpl<BusinessMapper, Business> i
} }
business.setAllSurplusQuantity(business.getAllSurplusQuantity() - 1); business.setAllSurplusQuantity(business.getAllSurplusQuantity() - 1);
this.updateById(business); this.updateById(business);
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
SpringUtils.getBean(BusinessStaffService.class).updateChain() SpringUtils.getBean(BusinessStaffService.class).updateChain()
.setRaw(BUSINESS_STAFF.SURPLUS_QUANTITY, "surplus_quantity - 1") .setRaw(BUSINESS_STAFF.SURPLUS_QUANTITY, "surplus_quantity - 1")
.where(BUSINESS_STAFF.BUSINESS_ID.eq(businessDetail.getBusinessId())) .where(BUSINESS_STAFF.BUSINESS_ID.eq(businessDetail.getBusinessId()))
.and(BUSINESS_STAFF.STAFF_ID.eq(loginUserInfo.getString("id")))
.update(); .update();
} }
} }

View File

@ -29,6 +29,8 @@ import com.cpop.oam.framework.constant.WebHookKeyConstant;
import com.cpop.oam.framework.enums.OamConfigEnum; import com.cpop.oam.framework.enums.OamConfigEnum;
import com.mybatisflex.core.paginate.Page; import com.mybatisflex.core.paginate.Page;
import com.mybatisflex.core.query.QueryWrapper; 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 com.mybatisflex.spring.service.impl.ServiceImpl;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
@ -331,22 +333,40 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
* @since 2023/12/04 * @since 2023/12/04
*/ */
@Override @Override
public Page<PersonTaskPageVo> getPersonTaskPage() { public Page<PersonTaskPageVo> getPersonTaskPage(String staffId, LocalDate startDate, LocalDate endDate) {
PageDomain pageDomain = SqlUtils.getInstance().getPageDomain(); 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()); String testStaffPhones = SpringUtils.getBean(RedisService.class).getCacheObject(OamConfigKey.OAM_CONFIG_KEY + OamConfigEnum.TEST_STAFF_PHONE.getKey());
if (StringUtils.isBlank(testStaffPhones)) { if (StringUtils.isBlank(testStaffPhones)) {
throw new ServiceException("测试员工手机号未配置,请联系相关人员配置"); throw new ServiceException("测试员工手机号未配置,请联系相关人员配置");
} }
QueryWrapper queryWrapper = QueryWrapper.create(); QueryWrapper queryWrapper = QueryWrapper.create();
//对比当前员工是否是测试管理员 if (StringUtils.isNotBlank(staffId)){
if (!Arrays.asList(testStaffPhones.split(",")).contains(loginUserInfo.getString("phoneNumber"))) { Row staff = Db.selectOneByQuery(SYS_USER.getTableName(), QueryWrapper.create().select(SYS_USER.PHONE_NUMBER)
queryWrapper.and(TASK.TASK_STATUS.in(2, 3)) .leftJoin(STAFF).on(STAFF.USER_ID.eq(SYS_USER.ID))
.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("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 { } else {
//测试人员 JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
queryWrapper.and(TASK.TASK_STATUS.eq(3)) //对比当前员工是否是测试管理员
.groupBy(TASK.ID); 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(), return this.mapper.paginateAs(pageDomain.getPageNum(),
pageDomain.getPageSize(), pageDomain.getPageSize(),
@ -755,22 +775,31 @@ public class TaskServiceImpl extends ServiceImpl<TaskMapper, Task> implements Ta
* @return TaskIndividualGpaVo * @return TaskIndividualGpaVo
*/ */
@Override @Override
public TaskIndividualGpaVo getIndividualGpa() { public TaskIndividualGpaVo getIndividualGpa(String staffId, LocalDate startDate, LocalDate endDate) {
//获取当前用户信息 QueryWrapper queryWrapper = QueryWrapper.create();
JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo(); if (StringUtils.isNotBlank(staffId)) {
LocalDate now = LocalDate.now(); queryWrapper.and(TASK_STAFF_GROUP.STAFF_ID.eq(staffId));
// 获取目标月的第一天 } else {
LocalDate firstDay = now.with(TemporalAdjusters.firstDayOfMonth()); //获取当前用户信息
// 获取目标月的最后一天 JSONObject loginUserInfo = SecurityUtils.getInstance().getLoginUserInfo();
LocalDate lastDay = now.with(TemporalAdjusters.lastDayOfMonth()); queryWrapper.and(TASK_STAFF_GROUP.STAFF_ID.eq(loginUserInfo.getString("id")));
List<TaskIndividualGpaDetailVo> individualGpas = this.listAs(QueryWrapper.create() }
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<TaskIndividualGpaDetailVo> individualGpas = this.listAs(queryWrapper
.select(TASK.ID, TASK.TASK_CONTENT, TASK.TASK_STATUS) .select(TASK.ID, TASK.TASK_CONTENT, TASK.TASK_STATUS)
.select(TASK_STAFF_GROUP.GRADE_POINT, TASK_STAFF_GROUP.REMARK) .select(TASK_STAFF_GROUP.GRADE_POINT, TASK_STAFF_GROUP.REMARK)
.leftJoin(TASK_STAFF_GROUP).on(TASK_STAFF_GROUP.TASK_ID.eq(TASK.ID)) .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)) .where(TASK.TASK_STATUS.in(2, 3, 5, 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))
, TaskIndividualGpaDetailVo.class); , TaskIndividualGpaDetailVo.class);
TaskIndividualGpaVo vo = new TaskIndividualGpaVo(); TaskIndividualGpaVo vo = new TaskIndividualGpaVo();
if (individualGpas.isEmpty()) { if (individualGpas.isEmpty()) {

View File

@ -695,7 +695,7 @@ public class TaskWorkOrderServiceImpl extends ServiceImpl<TaskWorkOrderMapper, T
.on(BRAND.ID.eq(TASK_WORK_ORDER.BRAND_ID)) .on(BRAND.ID.eq(TASK_WORK_ORDER.BRAND_ID))
.leftJoin(STORE) .leftJoin(STORE)
.on(STORE.ID.eq(TASK_WORK_ORDER.STORE_ID)) .on(STORE.ID.eq(TASK_WORK_ORDER.STORE_ID))
.where(TASK.TASK_STATUS.in(1, 2, 4, 5, 6, 7)), .where(TASK.TASK_STATUS.in(1, 2, 5, 7)),
TaskWorkOrderPersonVo.class, TaskWorkOrderPersonVo.class,
// 提交人 // 提交人
item -> item.field(TaskWorkOrderPersonVo::getRecordStaffName) item -> item.field(TaskWorkOrderPersonVo::getRecordStaffName)

View File

@ -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;
}

View File

@ -1,7 +1,10 @@
package com.cpop.pay.framewok.core.dto; package com.cpop.pay.framewok.core.dto;
import com.cpop.core.base.enums.OrderSource;
import lombok.Data; import lombok.Data;
import java.util.List;
/** /**
* @author DB * @author DB
* @version 1.0.0 * @version 1.0.0
@ -9,4 +12,40 @@ import lombok.Data;
*/ */
@Data @Data
public class LearnNowPayLaterPlanDto { public class LearnNowPayLaterPlanDto {
/**
* 支付分计划名称
*/
private String planName;
/**
* 支付分计划有效期(单位天)
*/
private Integer planDuration;
/**
* 支付分计划扣费次数
*/
private Integer deductionQuantity;
/**
* 支付分计划原总金额(单位分)
*/
private Integer totalOriginalPrice;
/**
* 支付分计划实际扣费总金额(单位分)
*/
private Integer totalActualPrice;
/**
* 支付分计划明细列表
*/
private List<LearnNowPayLaterPlanDetailDto> planDetailList;
/**
* 订单来源
*/
private OrderSource orderSource = OrderSource.EASY_LEARN;
} }

View File

@ -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 {
}

View File

@ -2,15 +2,26 @@ package com.cpop.pay.framewok.handler.wxPay;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.cpop.common.utils.StringUtils; 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.ServiceException;
import com.cpop.core.base.exception.UtilException;
import com.cpop.core.utils.SecurityUtils; 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.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.github.binarywang.wxpay.service.WxPayService;
import com.mybatisflex.core.query.QueryWrapper; import com.mybatisflex.core.query.QueryWrapper;
import com.mybatisflex.core.row.Db; import com.mybatisflex.core.row.Db;
import com.mybatisflex.core.row.Row; import com.mybatisflex.core.row.Row;
import com.mybatisflex.core.row.RowKey;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
/** /**
* @author DB * @author DB
@ -129,4 +140,50 @@ public class WxPayHandler {
} }
return wxMchId; 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<Row> 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;
}
} }

View File

@ -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);
}

View File

@ -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);
}
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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<WxPayScoreDetail> {
}

View File

@ -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<WxPayScore> {
}

View File

@ -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<WxPayScoreDetail> {
}

View File

@ -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<WxPayScore> {
}

View File

@ -9,6 +9,8 @@ import com.cpop.core.utils.SecurityUtils;
import com.cpop.core.utils.SpringUtils; import com.cpop.core.utils.SpringUtils;
import com.cpop.core.utils.sql.SqlUtils; import com.cpop.core.utils.sql.SqlUtils;
import com.cpop.system.business.entity.Store; 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.service.StoreService;
import com.cpop.system.business.vo.BrandPageVo; import com.cpop.system.business.vo.BrandPageVo;
import com.mybatisflex.core.datasource.DataSourceKey; import com.mybatisflex.core.datasource.DataSourceKey;
@ -85,8 +87,8 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
.set("brand_cloud_id", brand.getString("brandId")) .set("brand_cloud_id", brand.getString("brandId"))
.set("create_time", now) .set("create_time", now)
.set("update_time", now) .set("update_time", now)
.set("create_user_id", loginUser.getUserId()) .set("create_user_id", loginUser == null ? "1" : loginUser.getUserId())
.set("update_user_id", loginUser.getUserId()) .set("update_user_id", loginUser == null ? "1" : loginUser.getUserId())
.save(); .save();
//导入果酱品牌关联校区 //导入果酱品牌关联校区
importJamboxStore(jamboxBrandId,sysBrand.getId()); importJamboxStore(jamboxBrandId,sysBrand.getId());
@ -100,7 +102,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
* @param brandId 品牌id * @param brandId 品牌id
* @return: void * @return: void
*/ */
private void importJamboxStore(String jamboxBrandId,String brandId) { private void importJamboxStore(String jamboxBrandId, String brandId) {
//获取果酱校区信息 //获取果酱校区信息
List<Row> storeList; List<Row> storeList;
try { try {
@ -109,6 +111,7 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
.select("store_id as storeCloudId","mechanism as storeName","address") .select("store_id as storeCloudId","mechanism as storeName","address")
.from("t_mechanism_info") .from("t_mechanism_info")
.where("brand_id = ?", jamboxBrandId)); .where("brand_id = ?", jamboxBrandId));
} finally { } finally {
DataSourceKey.clear(); DataSourceKey.clear();
} }
@ -131,11 +134,30 @@ public class BrandServiceImpl extends ServiceImpl<BrandMapper, Brand> implements
row.set("store_id", stores.get(i).getId()); row.set("store_id", stores.get(i).getId());
row.set("create_time", now); row.set("create_time", now);
row.set("update_time", now); row.set("update_time", now);
row.set("create_user_id", loginUser.getUserId()); row.set("create_user_id", loginUser == null ? "1" : loginUser.getUserId());
row.set("update_user_id", loginUser.getUserId()); row.set("update_user_id", loginUser == null ? "1" : loginUser.getUserId());
storeExtends.add(row); storeExtends.add(row);
} }
Db.insertBatch("cp_j_store_extend", storeExtends); Db.insertBatch("cp_j_store_extend", storeExtends);
//导入证书信息
List<Row> 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<String, String> 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<StoreLicense> 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<BrandMapper, Brand> implements
return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(), return this.mapper.paginateAs(pageDomain.getPageNum(), pageDomain.getPageSize(),
QueryWrapper.create() QueryWrapper.create()
.select(BRAND.ID, BRAND.BRAND_NAME, BRAND.WX_MCH_ID, BRAND.CREATE_TIME, BRAND.IS_OPEN_SHARING) .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); BrandPageVo.class);
} }

View File

@ -66,7 +66,8 @@ public class StoreServiceImpl extends ServiceImpl<StoreMapper, Store> implements
.leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID)) .leftJoin(STORE_SIGN).on(STORE_SIGN.STORE_ID.eq(STORE.ID))
.leftJoin(BRAND).on(BRAND.ID.eq(STORE.BRAND_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`") .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); StorePageVo.class);
} }

View File

@ -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<WxPayScoreDetailMapper, WxPayScoreDetail> implements WxPayScoreDetailService {
}

View File

@ -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<WxPayScoreMapper, WxPayScore> implements WxPayScoreService {
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.system.business.mapper.WxPayScoreDetailMapper">
</mapper>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.cpop.system.business.mapper.WxPayScoreMapper">
</mapper>