Browse Source

优化:支付功能(10550)

main
科技小王子 4 weeks ago
parent
commit
b0b1d28927
  1. 446
      src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java
  2. 1
      src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java
  3. 77
      src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java
  4. 84
      src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java
  5. 37
      src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java
  6. 2
      src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml
  7. 77
      src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java
  8. 42
      src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java
  9. 47
      src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java
  10. 42
      src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java

446
src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java

@ -16,249 +16,271 @@ import java.util.HashMap;
@Component
public class RequestUtil {
private static final String host = "https://server.gxwebsoft.com/api";
private static String ACCESS_TOKEN;
private static String TENANT_ID;
private static final String host = "https://server.gxwebsoft.com/api";
private static String ACCESS_TOKEN;
private static String TENANT_ID;
public void setTenantId(String tenantId) {
TENANT_ID = tenantId;
}
public void setTenantId(String tenantId) {
TENANT_ID = tenantId;
}
public void setAccessToken(String token) {
ACCESS_TOKEN = token;
}
public void setAccessToken(String token) {
ACCESS_TOKEN = token;
}
// 预付请求付款(余额支付)
public Object balancePay(ShopOrder order) {
// 设置租户ID
setTenantId(order.getTenantId().toString());
// 设置token
setAccessToken(order.getAddress());
// 余额支付接口
String path = "/system/payment/balancePay";
try {
// 链式构建请求
final String body = HttpRequest.post(host.concat(path))
.header("Tenantid", TENANT_ID)
.header("Authorization", ACCESS_TOKEN)
.body(JSONUtil.toJSONString(order))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class).getData();
// 预付请求付款(余额支付)
public Object balancePay(ShopOrder order) {
// 设置租户ID
setTenantId(order.getTenantId().toString());
// 设置token
setAccessToken(order.getAddress());
// 余额支付接口
String path = "/system/payment/balancePay";
try {
// 链式构建请求
final String body = HttpRequest.post(host.concat(path))
.header("Tenantid", TENANT_ID)
.header("Authorization", ACCESS_TOKEN)
.body(JSONUtil.toJSONString(order))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class).getData();
} catch (Exception e) {
e.printStackTrace();
}
return null;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
// 微信支付通知
public String pushWxPayNotify(Transaction transaction, Payment payment) {
// 设置租户ID
setTenantId(payment.getTenantId().toString());
// 推送支付通知地址
String path = payment.getNotifyUrl();
try {
// 链式构建请求
return HttpRequest.post(path)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(transaction))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
// 微信支付通知
public String pushWxPayNotify(Transaction transaction, Payment payment) {
// 设置租户ID
setTenantId(payment.getTenantId().toString());
// 推送支付通知地址
String path = payment.getNotifyUrl();
try {
// 链式构建请求
return HttpRequest.post(path)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(transaction))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
return "支付失败";
} catch (Exception e) {
e.printStackTrace();
}
return "支付失败";
}
public User getUserByPhone(String phone) {
String path = "/system/user/getByPhone/" + phone;
try {
// 链式构建请求
String result = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)//超时,毫秒
.execute().body();
public User getUserByPhone(String phone) {
String path = "/system/user/getByPhone/" + phone;
try {
// 链式构建请求
String result = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)//超时,毫秒
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
JSONObject jsonObject = JSONObject.parseObject(result);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public User getByUserId(Integer userId) {
String path = "/system/user/" + userId;
try {
// 链式构建请求
String result = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)//超时,毫秒
.execute().body();
public User getByUserId(Integer userId) {
String path = "/system/user/" + userId;
try {
// 链式构建请求
String result = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)//超时,毫秒
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println("jsonObject = " + jsonObject);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
JSONObject jsonObject = JSONObject.parseObject(result);
System.out.println("jsonObject = " + jsonObject);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
// 新增用户
public boolean saveUserByPhone(ShopMerchantAccount merchantAccount) {
String path = "/system/user/";
try {
HashMap<String, Object> map = new HashMap<>();
map.put("nickname", merchantAccount.getRealName());
map.put("username", merchantAccount.getPhone());
map.put("realName", merchantAccount.getRealName());
map.put("phone", merchantAccount.getPhone());
map.put("merchantId", merchantAccount.getMerchantId());
final ArrayList<Object> roles = new ArrayList<>();
final UserRole userRole = new UserRole();
userRole.setUserId(merchantAccount.getUserId());
userRole.setRoleId(merchantAccount.getRoleId());
userRole.setTenantId(merchantAccount.getTenantId());
roles.add(userRole);
map.put("roles", roles);
map.put("tenantId", TENANT_ID);
// 链式构建请求
String result = HttpRequest.post(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(map))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
public boolean saveUserByPhone(ShopMerchantAccount merchantAccount) {
String path = "/system/user/";
try {
HashMap<String, Object> map = new HashMap<>();
map.put("nickname", merchantAccount.getRealName());
map.put("username", merchantAccount.getPhone());
map.put("realName", merchantAccount.getRealName());
map.put("phone", merchantAccount.getPhone());
map.put("merchantId", merchantAccount.getMerchantId());
final ArrayList<Object> roles = new ArrayList<>();
final UserRole userRole = new UserRole();
userRole.setUserId(merchantAccount.getUserId());
userRole.setRoleId(merchantAccount.getRoleId());
userRole.setTenantId(merchantAccount.getTenantId());
roles.add(userRole);
map.put("roles", roles);
map.put("tenantId", TENANT_ID);
// 链式构建请求
String result = HttpRequest.post(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(map))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
return true;
}
} catch (Exception e) {
e.printStackTrace();
}
return true;
public ApiResult<?> updateUserBalance(String path, User user) {
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public ApiResult<?> updateUserBalance(String path, User user) {
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
public User getParent(Integer userId) {
try {
// 链式构建请求
final String result = HttpRequest.get(host.concat("/system/user-referee/getReferee/" + userId))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public User getParent(Integer userId) {
try {
// 链式构建请求
final String result = HttpRequest.get(host.concat("/system/user-referee/getReferee/" + userId))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.timeout(20000)
.execute().body();
JSONObject jsonObject = JSONObject.parseObject(result);
final String data = jsonObject.getString("data");
return JSONObject.parseObject(data, User.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
// 更新用户信息
public void updateUser(User user) {
String path = "/system/user/";
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
}
// 更新用户信息
public void updateUser(User user) {
String path = "/system/user/";
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
public String getMpOrderQrCode(String orderNo) {
String path = "/wx-login/getOrderQRCode/";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path).concat(orderNo))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
final JSONObject jsonObject = JSONObject.parseObject(body);
final String qrCode = jsonObject.getString("message");
return qrCode;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public String getMpOrderQrCode(String orderNo) {
String path = "/wx-login/getOrderQRCode/";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path).concat(orderNo))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
final JSONObject jsonObject = JSONObject.parseObject(body);
final String qrCode = jsonObject.getString("message");
return qrCode;
} catch (Exception e) {
e.printStackTrace();
}
return null;
public String getOrderQRCodeUnlimited(String orderNo) {
String path = "/wx-login/getOrderQRCodeUnlimited/";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path).concat(orderNo))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
System.out.println("body = " + body);
final JSONObject jsonObject = JSONObject.parseObject(body);
final String qrCode = jsonObject.getString("message");
System.out.println("qrCode = " + qrCode);
return qrCode;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
public String getOrderQRCodeUnlimited(String orderNo) {
String path = "/wx-login/getOrderQRCodeUnlimited/";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path).concat(orderNo))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
System.out.println("body = " + body);
final JSONObject jsonObject = JSONObject.parseObject(body);
final String qrCode = jsonObject.getString("message");
System.out.println("qrCode = " + qrCode);
return qrCode;
} catch (Exception e) {
e.printStackTrace();
}
return null;
public void updateUserMerchantId(User user) {
String path = "/system/user/updateUserMerchantId";
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
}
public void updateUserMerchantId(User user) {
String path = "/system/user/updateUserMerchantId";
try {
// 链式构建请求
final String body = HttpRequest.put(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.body(JSONUtil.toJSONString(user))
.timeout(20000)
.execute().body();
} catch (Exception e) {
e.printStackTrace();
}
public ApiResult<?> getWxConfig() {
String path = "/system/setting?settingKey=mp-weixin";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
// 余额支付通知
public void pushBalancePayNotify(Transaction transaction, Payment payment) {
System.out.println("payment = " + payment);
System.out.println("transaction = " + transaction);
// 设置租户ID
setTenantId(payment.getTenantId().toString());
// 推送支付通知地址
String path = payment.getNotifyUrl();
try {
// 链式构建请求
HttpRequest.post(path)
.header("Tenantid", TENANT_ID)
.body(JSONUtil.toJSONString(transaction))//表单内容
.timeout(20000)//超时,毫秒
.execute().body();
public ApiResult<?> getWxConfig() {
String path = "/system/setting?settingKey=mp-weixin";
try {
// 链式构建请求
final String body = HttpRequest.get(host.concat(path))
.header("Authorization", ACCESS_TOKEN)
.header("tenantId", TENANT_ID)
.timeout(20000)
.execute().body();
return JSONUtil.parseObject(body, ApiResult.class);
} catch (Exception e) {
e.printStackTrace();
return null;
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

1
src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java

@ -9,6 +9,7 @@ import com.gxwebsoft.common.core.utils.RequestUtil;
import com.gxwebsoft.common.core.web.*;
import com.gxwebsoft.common.system.entity.Payment;
import com.gxwebsoft.common.system.entity.User;
import com.gxwebsoft.common.system.entity.UserBalanceLog;
import com.gxwebsoft.common.system.param.PaymentParam;
import com.gxwebsoft.common.system.service.PaymentService;
import com.gxwebsoft.common.system.service.UserBalanceLogService;

77
src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java

@ -1,14 +1,13 @@
package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -64,4 +63,76 @@ public class CompanyGit implements Serializable {
@ApiModelProperty(value = "租户id")
private Integer tenantId;
/**
* 用户余额变动明细表
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "UserBalanceLog对象", description = "用户余额变动明细表")
@TableName("sys_user_balance_log")
public static class UserBalanceLog implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@TableId(value = "log_id", type = IdType.AUTO)
private Integer logId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)")
private Integer scene;
@ApiModelProperty(value = "变动金额")
private BigDecimal money;
@ApiModelProperty(value = "变动后余额")
private BigDecimal balance;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "支付流水号")
private String transactionId;
@ApiModelProperty(value = "管理员备注")
private String remark;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "昵称")
@TableField(exist = false)
private String nickname;
@ApiModelProperty(value = "用户头像")
@TableField(exist = false)
private String avatar;
}
}

84
src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java

@ -0,0 +1,84 @@
package com.gxwebsoft.common.system.entity;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
* 用户余额变动明细表
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "UserBalanceLog对象", description = "用户余额变动明细表")
@TableName("sys_user_balance_log")
public class UserBalanceLog implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@TableId(value = "log_id", type = IdType.AUTO)
private Integer logId;
@ApiModelProperty(value = "用户ID")
private Integer userId;
@ApiModelProperty(value = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)")
private Integer scene;
@ApiModelProperty(value = "变动金额")
private BigDecimal money;
@ApiModelProperty(value = "变动后余额")
private BigDecimal balance;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "支付流水号")
private String transactionId;
@ApiModelProperty(value = "管理员备注")
private String remark;
@ApiModelProperty(value = "排序(数字越小越靠前)")
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@TableLogic
private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "租户id")
private Integer tenantId;
@ApiModelProperty(value = "注册时间")
private Date createTime;
@ApiModelProperty(value = "修改时间")
private Date updateTime;
@ApiModelProperty(value = "昵称")
@TableField(exist = false)
private String nickname;
@ApiModelProperty(value = "用户头像")
@TableField(exist = false)
private String avatar;
}

37
src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java

@ -0,0 +1,37 @@
package com.gxwebsoft.common.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.gxwebsoft.common.system.entity.UserBalanceLog;
import com.gxwebsoft.common.system.param.UserBalanceLogParam;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 用户余额变动明细表Mapper
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
public interface UserBalanceLogMapper extends BaseMapper<UserBalanceLog> {
/**
* 分页查询
*
* @param page 分页对象
* @param param 查询参数
* @return List<UserBalanceLog>
*/
List<UserBalanceLog> selectPageRel(@Param("page") IPage<UserBalanceLog> page,
@Param("param") UserBalanceLogParam param);
/**
* 查询全部
*
* @param param 查询参数
* @return List<User>
*/
List<UserBalanceLog> selectListRel(@Param("param") UserBalanceLogParam param);
}

2
src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml

@ -5,7 +5,7 @@
<!-- 关联查询sql -->
<sql id="selectSql">
SELECT a.*
FROM sys_payment a
FROM gxwebsoft_core.sys_payment a
<where>
<if test="param.id != null">
AND a.id = #{param.id}

77
src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java

@ -0,0 +1,77 @@
package com.gxwebsoft.common.system.param;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.gxwebsoft.common.core.annotation.QueryField;
import com.gxwebsoft.common.core.annotation.QueryType;
import com.gxwebsoft.common.core.web.BaseParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.math.BigDecimal;
/**
* 用户余额变动明细表查询参数
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
@Data
@EqualsAndHashCode(callSuper = false)
@JsonInclude(JsonInclude.Include.NON_NULL)
@ApiModel(value = "UserBalanceLogParam对象", description = "用户余额变动明细表查询参数")
public class UserBalanceLogParam extends BaseParam {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "主键ID")
@QueryField(type = QueryType.EQ)
private Integer logId;
@ApiModelProperty(value = "用户ID")
@QueryField(type = QueryType.EQ)
private Integer userId;
@ApiModelProperty(value = "余额变动场景(10用户充值 20用户消费 30管理员操作 40订单退款)")
@QueryField(type = QueryType.EQ)
private Integer scene;
@ApiModelProperty(value = "变动金额")
@QueryField(type = QueryType.EQ)
private BigDecimal money;
@ApiModelProperty(value = "变动后余额")
@QueryField(type = QueryType.EQ)
private BigDecimal balance;
@ApiModelProperty(value = "描述/说明")
private String describe;
@ApiModelProperty(value = "管理员备注")
private String remark;
@ApiModelProperty(value = "排序(数字越小越靠前)")
@QueryField(type = QueryType.EQ)
private Integer sortNumber;
@ApiModelProperty(value = "备注")
private String comments;
@ApiModelProperty(value = "状态, 0正常, 1冻结")
@QueryField(type = QueryType.EQ)
private Integer status;
@ApiModelProperty(value = "是否删除, 0否, 1是")
@QueryField(type = QueryType.EQ)
private Integer deleted;
@ApiModelProperty(value = "商户编码")
private String merchantCode;
@ApiModelProperty(value = "昵称")
private String nickname;
@ApiModelProperty(value = "余额变动场景筛选")
private String sceneMultiple;
}

42
src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java

@ -0,0 +1,42 @@
package com.gxwebsoft.common.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.UserBalanceLog;
import com.gxwebsoft.common.system.param.UserBalanceLogParam;
import java.util.List;
/**
* 用户余额变动明细表Service
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
public interface UserBalanceLogService extends IService<UserBalanceLog> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<UserBalanceLog>
*/
PageResult<UserBalanceLog> pageRel(UserBalanceLogParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<UserBalanceLog>
*/
List<UserBalanceLog> listRel(UserBalanceLogParam param);
/**
* 根据id查询
*
* @param logId 主键ID
* @return UserBalanceLog
*/
UserBalanceLog getByIdRel(Integer logId);
}

47
src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java

@ -0,0 +1,47 @@
package com.gxwebsoft.common.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gxwebsoft.common.core.web.PageParam;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.UserBalanceLog;
import com.gxwebsoft.common.system.mapper.UserBalanceLogMapper;
import com.gxwebsoft.common.system.param.UserBalanceLogParam;
import com.gxwebsoft.common.system.service.UserBalanceLogService;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* 用户余额变动明细表Service实现
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
@Service
public class UserBalanceLogServiceImpl extends ServiceImpl<UserBalanceLogMapper, UserBalanceLog> implements UserBalanceLogService {
@Override
public PageResult<UserBalanceLog> pageRel(UserBalanceLogParam param) {
PageParam<UserBalanceLog, UserBalanceLogParam> page = new PageParam<>(param);
page.setDefaultOrder("create_time desc");
List<UserBalanceLog> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());
}
@Override
public List<UserBalanceLog> listRel(UserBalanceLogParam param) {
List<UserBalanceLog> list = baseMapper.selectListRel(param);
// 排序
PageParam<UserBalanceLog, UserBalanceLogParam> page = new PageParam<>();
page.setDefaultOrder("create_time desc");
return page.sortRecords(list);
}
@Override
public UserBalanceLog getByIdRel(Integer logId) {
UserBalanceLogParam param = new UserBalanceLogParam();
param.setLogId(logId);
return param.getOne(baseMapper.selectListRel(param));
}
}

42
src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java

@ -0,0 +1,42 @@
package com.gxwebsoft.shop.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.gxwebsoft.common.core.web.PageResult;
import com.gxwebsoft.common.system.entity.UserBalanceLog;
import com.gxwebsoft.common.system.param.UserBalanceLogParam;
import java.util.List;
/**
* 用户余额变动明细表Service
*
* @author 科技小王子
* @since 2023-04-21 15:59:09
*/
public interface UserBalanceLogService extends IService<UserBalanceLog> {
/**
* 分页关联查询
*
* @param param 查询参数
* @return PageResult<UserBalanceLog>
*/
PageResult<UserBalanceLog> pageRel(UserBalanceLogParam param);
/**
* 关联查询全部
*
* @param param 查询参数
* @return List<UserBalanceLog>
*/
List<UserBalanceLog> listRel(UserBalanceLogParam param);
/**
* 根据id查询
*
* @param logId 主键ID
* @return UserBalanceLog
*/
UserBalanceLog getByIdRel(Integer logId);
}
Loading…
Cancel
Save