From b0b1d28927d791d5ef5fcd27376c250bc38da6c5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B5=E5=BF=A0=E6=9E=97?= <170083662@qq.com> Date: Sat, 26 Jul 2025 13:47:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=EF=BC=9A=E6=94=AF=E4=BB=98?= =?UTF-8?q?=E5=8A=9F=E8=83=BD=EF=BC=8810550=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/utils/RequestUtil.java | 446 +++++++++--------- .../system/controller/PaymentController.java | 1 + .../common/system/entity/CompanyGit.java | 77 ++- .../common/system/entity/UserBalanceLog.java | 84 ++++ .../system/mapper/UserBalanceLogMapper.java | 37 ++ .../system/mapper/xml/PaymentMapper.xml | 2 +- .../system/param/UserBalanceLogParam.java | 77 +++ .../system/service/UserBalanceLogService.java | 42 ++ .../impl/UserBalanceLogServiceImpl.java | 47 ++ .../shop/service/UserBalanceLogService.java | 42 ++ 10 files changed, 639 insertions(+), 216 deletions(-) create mode 100644 src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java create mode 100644 src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java create mode 100644 src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java create mode 100644 src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java create mode 100644 src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java create mode 100644 src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java diff --git a/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java b/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java index 7310f33..9bfc2b8 100644 --- a/src/main/java/com/gxwebsoft/common/core/utils/RequestUtil.java +++ b/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 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 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 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 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(); } + } + } diff --git a/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java b/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java index 1a81031..44c27f0 100644 --- a/src/main/java/com/gxwebsoft/common/system/controller/PaymentController.java +++ b/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; diff --git a/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java b/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java index be26877..2c6bfd1 100644 --- a/src/main/java/com/gxwebsoft/common/system/entity/CompanyGit.java +++ b/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; + + } } diff --git a/src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java b/src/main/java/com/gxwebsoft/common/system/entity/UserBalanceLog.java new file mode 100644 index 0000000..81641fc --- /dev/null +++ b/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; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java b/src/main/java/com/gxwebsoft/common/system/mapper/UserBalanceLogMapper.java new file mode 100644 index 0000000..f986c44 --- /dev/null +++ b/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 { + + /** + * 分页查询 + * + * @param page 分页对象 + * @param param 查询参数 + * @return List + */ + List selectPageRel(@Param("page") IPage page, + @Param("param") UserBalanceLogParam param); + + /** + * 查询全部 + * + * @param param 查询参数 + * @return List + */ + List selectListRel(@Param("param") UserBalanceLogParam param); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml index 20ab037..5f3a654 100644 --- a/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml +++ b/src/main/java/com/gxwebsoft/common/system/mapper/xml/PaymentMapper.xml @@ -5,7 +5,7 @@ SELECT a.* - FROM sys_payment a + FROM gxwebsoft_core.sys_payment a AND a.id = #{param.id} diff --git a/src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java b/src/main/java/com/gxwebsoft/common/system/param/UserBalanceLogParam.java new file mode 100644 index 0000000..06630e2 --- /dev/null +++ b/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; + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java b/src/main/java/com/gxwebsoft/common/system/service/UserBalanceLogService.java new file mode 100644 index 0000000..eaa4e0d --- /dev/null +++ b/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 { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserBalanceLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserBalanceLogParam param); + + /** + * 根据id查询 + * + * @param logId 主键ID + * @return UserBalanceLog + */ + UserBalanceLog getByIdRel(Integer logId); + +} diff --git a/src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java b/src/main/java/com/gxwebsoft/common/system/service/impl/UserBalanceLogServiceImpl.java new file mode 100644 index 0000000..2286471 --- /dev/null +++ b/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 implements UserBalanceLogService { + + @Override + public PageResult pageRel(UserBalanceLogParam param) { + PageParam page = new PageParam<>(param); + page.setDefaultOrder("create_time desc"); + List list = baseMapper.selectPageRel(page, param); + return new PageResult<>(list, page.getTotal()); + } + + @Override + public List listRel(UserBalanceLogParam param) { + List list = baseMapper.selectListRel(param); + // 排序 + PageParam 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)); + } + +} diff --git a/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java b/src/main/java/com/gxwebsoft/shop/service/UserBalanceLogService.java new file mode 100644 index 0000000..af7a18a --- /dev/null +++ b/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 { + + /** + * 分页关联查询 + * + * @param param 查询参数 + * @return PageResult + */ + PageResult pageRel(UserBalanceLogParam param); + + /** + * 关联查询全部 + * + * @param param 查询参数 + * @return List + */ + List listRel(UserBalanceLogParam param); + + /** + * 根据id查询 + * + * @param logId 主键ID + * @return UserBalanceLog + */ + UserBalanceLog getByIdRel(Integer logId); + +}