init
This commit is contained in:
@@ -0,0 +1,84 @@
|
|||||||
|
package com.ruoyi.xq.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.annotation.RepeatSubmit;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.core.validate.EditGroup;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.xq.domain.WxTransData;
|
||||||
|
import com.ruoyi.xq.service.WxTransDataService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换数据
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xq/wxTransData")
|
||||||
|
public class WxTransDataController extends BaseController {
|
||||||
|
|
||||||
|
private final WxTransDataService wxTransDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信交换数据列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransData:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<WxTransData> list(WxTransData bo, PageQuery pageQuery) {
|
||||||
|
Page<WxTransData> page = wxTransDataService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信交换数据详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransData:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<WxTransData> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(wxTransDataService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改微信交换数据
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransData:edit")
|
||||||
|
@Log(title = "微信交换数据", businessType = BusinessType.UPDATE)
|
||||||
|
@RepeatSubmit()
|
||||||
|
@PutMapping()
|
||||||
|
public R<Void> edit(@Validated(EditGroup.class) @RequestBody WxTransData bo) {
|
||||||
|
return toAjax(wxTransDataService.updateById(bo));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信交换数据
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransData:remove")
|
||||||
|
@Log(title = "微信交换数据", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(wxTransDataService.removeBatchByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.ruoyi.xq.controller;
|
||||||
|
|
||||||
|
import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.core.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.core.domain.R;
|
||||||
|
import com.ruoyi.common.core.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.xq.domain.WxTransLog;
|
||||||
|
import com.ruoyi.xq.service.WxTransLogService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotEmpty;
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换记录
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/xq/wxTransLog")
|
||||||
|
public class WxTransLogController extends BaseController {
|
||||||
|
|
||||||
|
private final WxTransLogService wxTransLogService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询微信交换记录列表
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransLog:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo<WxTransLog> list(WxTransLog bo, PageQuery pageQuery) {
|
||||||
|
Page<WxTransLog> page = wxTransLogService.page(pageQuery.build(), Wrappers.lambdaQuery(bo));
|
||||||
|
return TableDataInfo.build(page);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取微信交换记录详细信息
|
||||||
|
*
|
||||||
|
* @param id 主键
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransLog:query")
|
||||||
|
@GetMapping("/{id}")
|
||||||
|
public R<WxTransLog> getInfo(@NotNull(message = "主键不能为空")
|
||||||
|
@PathVariable Long id) {
|
||||||
|
return R.ok(wxTransLogService.getById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除微信交换记录
|
||||||
|
*
|
||||||
|
* @param ids 主键串
|
||||||
|
*/
|
||||||
|
@SaCheckPermission("xq:wxTransLog:remove")
|
||||||
|
@Log(title = "微信交换记录", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public R<Void> remove(@NotEmpty(message = "主键不能为空")
|
||||||
|
@PathVariable Long[] ids) {
|
||||||
|
return toAjax(wxTransLogService.removeBatchByIds(Arrays.asList(ids)));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -9,16 +9,13 @@ import com.ruoyi.common.enums.BusinessType;
|
|||||||
import com.ruoyi.common.helper.LoginHelper;
|
import com.ruoyi.common.helper.LoginHelper;
|
||||||
import com.ruoyi.xq.domain.UserExtend;
|
import com.ruoyi.xq.domain.UserExtend;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
import com.ruoyi.xq.dto.app.account.AccountDetailVo;
|
import com.ruoyi.xq.dto.app.account.*;
|
||||||
import com.ruoyi.xq.dto.app.account.AccountInfoVO;
|
|
||||||
import com.ruoyi.xq.dto.app.pay.OrderCreateVo;
|
import com.ruoyi.xq.dto.app.pay.OrderCreateVo;
|
||||||
import com.ruoyi.xq.dto.app.wxtrans.GenWxTransOrderReq;
|
import com.ruoyi.xq.dto.app.wxtrans.GenWxTransOrderReq;
|
||||||
import com.ruoyi.xq.dto.app.wxtrans.WxTransPriceAppVo;
|
import com.ruoyi.xq.dto.app.wxtrans.WxTransPriceAppVo;
|
||||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||||
import com.ruoyi.xq.service.AccountChangeLogService;
|
import com.ruoyi.xq.service.*;
|
||||||
import com.ruoyi.xq.service.UserExtendService;
|
|
||||||
import com.ruoyi.xq.service.WxTransOrderService;
|
|
||||||
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Operation;
|
||||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -38,6 +35,10 @@ public class AccountAppController {
|
|||||||
private WxTransOrderService wxTransOrderService;
|
private WxTransOrderService wxTransOrderService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
|
@Autowired
|
||||||
|
private WxTransDataService wxTransDataService;
|
||||||
|
@Autowired
|
||||||
|
private WxTransLogService wxTransLogService;
|
||||||
|
|
||||||
@GetMapping("/info")
|
@GetMapping("/info")
|
||||||
@Operation(summary = "当前用户信息的账户余额情况")
|
@Operation(summary = "当前用户信息的账户余额情况")
|
||||||
@@ -74,7 +75,7 @@ public class AccountAppController {
|
|||||||
@Log(title = "生成微信交换订单", businessType = BusinessType.OTHER, isSaveDb = false)
|
@Log(title = "生成微信交换订单", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
public R<OrderCreateVo> createWxTransOrder(@RequestBody GenWxTransOrderReq req){
|
public R<OrderCreateVo> createWxTransOrder(@RequestBody GenWxTransOrderReq req){
|
||||||
Long userId = LoginHelper.getUserId();
|
Long userId = LoginHelper.getUserId();
|
||||||
WxTransOrder vipOrder = wxTransOrderService.createVipOrder(userId, req.getWxTransNum());
|
WxTransOrder vipOrder = wxTransOrderService.createWxTransOrder(userId, req.getWxTransNum());
|
||||||
OrderCreateVo result = new OrderCreateVo();
|
OrderCreateVo result = new OrderCreateVo();
|
||||||
result.setPrice(vipOrder.getWxPrice());
|
result.setPrice(vipOrder.getWxPrice());
|
||||||
result.setOrderNo(vipOrder.getOrderNo());
|
result.setOrderNo(vipOrder.getOrderNo());
|
||||||
@@ -82,5 +83,32 @@ public class AccountAppController {
|
|||||||
return R.ok(result);
|
return R.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/wxTrans/star")
|
||||||
|
@Operation(summary = "发起交换微信")
|
||||||
|
@Log(title = "发起交换微信", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<Void> starWxTrans(@RequestBody StarWxTransReq starWxTransReq){
|
||||||
|
starWxTransReq.setSponsorUserId(LoginHelper.getUserId());
|
||||||
|
wxTransDataService.start(starWxTransReq);
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/wxTrans/data/page")
|
||||||
|
@Operation(summary = "查询交换微信数据")
|
||||||
|
@Log(title = "发起交换微信", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<PageModel<WxTransDataListAppVo>> wxTransDataPage(PageQuery pageQuery, WxTransDataQuery wxTransDataQuery){
|
||||||
|
wxTransDataQuery.setUserId(LoginHelper.getUserId());
|
||||||
|
Page<WxTransDataListAppVo> page = wxTransDataService.pageApp(pageQuery, wxTransDataQuery);
|
||||||
|
return R.ok(PageModel.build(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/wxTrans/log/page")
|
||||||
|
@Operation(summary = "查询交换微信账户明细")
|
||||||
|
@Log(title = "查询交换微信账户明细", businessType = BusinessType.OTHER, isSaveDb = false)
|
||||||
|
public R<PageModel<WxTransLogListVo>> wxTransLogPage(PageQuery pageQuery, WxTransLogQuery query){
|
||||||
|
query.setUserId(LoginHelper.getUserId());
|
||||||
|
Page<WxTransLogListVo> page = wxTransLogService.pageApp(pageQuery, query);
|
||||||
|
return R.ok(PageModel.build(page));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ public class User implements Serializable {
|
|||||||
@Schema(description = "基础资料是否完成 0 未完成 1已完成")
|
@Schema(description = "基础资料是否完成 0 未完成 1已完成")
|
||||||
private Integer finishBaseStatus;
|
private Integer finishBaseStatus;
|
||||||
|
|
||||||
|
@Schema(description = "微信号")
|
||||||
|
private String wxCode;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 基础信息完成进度
|
* 基础信息完成进度
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -43,6 +43,8 @@ public class VipPrice implements Serializable {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "会员价格")
|
@Schema(description = "会员价格")
|
||||||
private BigDecimal vipPrice;
|
private BigDecimal vipPrice;
|
||||||
|
@Schema(description = "赠送微信交换次数")
|
||||||
|
private Long giveWxTransNum;
|
||||||
/**
|
/**
|
||||||
* 1-启用 0-禁用
|
* 1-启用 0-禁用
|
||||||
*/
|
*/
|
||||||
|
|||||||
71
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/WxTransData.java
Normal file
71
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/WxTransData.java
Normal file
@@ -0,0 +1,71 @@
|
|||||||
|
package com.ruoyi.xq.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换数据对象 xq_wx_trans_data
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("xq_wx_trans_data")
|
||||||
|
public class WxTransData implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 发起用户Id
|
||||||
|
*/
|
||||||
|
private Long sponsorUserId;
|
||||||
|
/**
|
||||||
|
* 发起用户号
|
||||||
|
*/
|
||||||
|
private String sponsorUsercode;
|
||||||
|
/**
|
||||||
|
* 发起用户的微信
|
||||||
|
*/
|
||||||
|
private String sponsorWx;
|
||||||
|
/**
|
||||||
|
* 接受用户ID
|
||||||
|
*/
|
||||||
|
private Long receiveUserId;
|
||||||
|
/**
|
||||||
|
* 接受用户号
|
||||||
|
*/
|
||||||
|
private String receiveUsercode;
|
||||||
|
/**
|
||||||
|
* 接受用户的微信
|
||||||
|
*/
|
||||||
|
private String receiveWx;
|
||||||
|
/**
|
||||||
|
* 0-待接收 1-接受交换 2-拒绝交换
|
||||||
|
*/
|
||||||
|
private Integer status;
|
||||||
|
/**
|
||||||
|
* 后台操作管理员ID
|
||||||
|
*/
|
||||||
|
private Long adminId;
|
||||||
|
/**
|
||||||
|
* 后台操作管理员ID
|
||||||
|
*/
|
||||||
|
private String adminName;
|
||||||
|
|
||||||
|
private String traceId;
|
||||||
|
|
||||||
|
private LocalDateTime opTime;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
52
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/WxTransLog.java
Normal file
52
ruoyi-xq/src/main/java/com/ruoyi/xq/domain/WxTransLog.java
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
package com.ruoyi.xq.domain;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换记录对象 xq_wx_trans_log
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("xq_wx_trans_log")
|
||||||
|
public class WxTransLog implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID=1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@TableId(value = "id")
|
||||||
|
private Long id;
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
/**
|
||||||
|
* 用户编号
|
||||||
|
*/
|
||||||
|
private String usercode;
|
||||||
|
private String traceId;
|
||||||
|
private Long tarUserId;
|
||||||
|
private String tarUsercode;
|
||||||
|
private String tarUserJson;
|
||||||
|
private String remark;
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
private Integer cateId;
|
||||||
|
private String cateName;
|
||||||
|
/**
|
||||||
|
* 微信交换次数变化
|
||||||
|
*/
|
||||||
|
private Long changeValue;
|
||||||
|
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
private LocalDateTime updateTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class StarWxTransReq {
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long sponsorUserId;
|
||||||
|
@Schema(description = "接受的用户ID")
|
||||||
|
private Long receiveUserId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxTransDataListAppVo {
|
||||||
|
private Long id;
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户编号")
|
||||||
|
private String usercode;
|
||||||
|
@Schema(description = "用户头像")
|
||||||
|
private String avatar;
|
||||||
|
@Schema(description = "性别 0-未知 1-女 2-男")
|
||||||
|
private Integer gender;
|
||||||
|
@Schema(description = "昵称")
|
||||||
|
private String nickname;
|
||||||
|
@Schema(description = "生日")
|
||||||
|
private LocalDate birthday;
|
||||||
|
@Schema(description = "生日-缩减显示")
|
||||||
|
private String birthdayStr;
|
||||||
|
@Schema(description = "年龄")
|
||||||
|
private Integer age;
|
||||||
|
@Schema(description = "居住城市名称")
|
||||||
|
private String residenceCityName;
|
||||||
|
@Schema(description = "学历")
|
||||||
|
private Integer education;
|
||||||
|
@Schema(description = "职业")
|
||||||
|
private String profession;
|
||||||
|
|
||||||
|
@Schema(description = "微信号")
|
||||||
|
private String wxCode;
|
||||||
|
@Schema(description = "操作时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@Schema(description = "0-待接收 1-接受交换 2-拒绝交换")
|
||||||
|
private Integer status;
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxTransDataQuery {
|
||||||
|
@Schema(hidden = true)
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
|
@Schema(description = "0-待接收 1-接受交换 2-拒绝交换")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@Schema(description = "1-我发起的微信交换 2-我接受的微信交换 3-和我有关的微信交换")
|
||||||
|
private Integer type;
|
||||||
|
}
|
||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxTransLogListVo {
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
@Schema(description = "用户编号")
|
||||||
|
private String usercode;
|
||||||
|
@Schema(description = "来源的用户ID")
|
||||||
|
private Long sourceUserId;
|
||||||
|
@Schema(description = "来源的用户昵称")
|
||||||
|
private String sourceNickname;
|
||||||
|
@Schema(description = "来源的头像")
|
||||||
|
private String sourceImg;
|
||||||
|
@Schema(description = "标题分类")
|
||||||
|
private String title;
|
||||||
|
@Schema(description = "内容")
|
||||||
|
private String content;
|
||||||
|
@Schema(description = "创建时间")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
@Schema(description = "次数变化值")
|
||||||
|
private Long changeValue;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.ruoyi.xq.dto.app.account;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class WxTransLogQuery {
|
||||||
|
@Schema(description = "用户ID")
|
||||||
|
private Long userId;
|
||||||
|
}
|
||||||
@@ -11,4 +11,6 @@ public class ConsumeResp {
|
|||||||
private String traceId;
|
private String traceId;
|
||||||
private Long consumerId;
|
private Long consumerId;
|
||||||
private boolean success;
|
private boolean success;
|
||||||
|
|
||||||
|
private Long vipId;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,8 @@ import lombok.Getter;
|
|||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
public enum ErrorEnum implements IErrorService {
|
public enum ErrorEnum implements IErrorService {
|
||||||
VIP_AUTH(600100,"权限不足,需要开通VIP")
|
VIP_AUTH(600100,"权限不足,需要开通VIP"),
|
||||||
|
WX_TRANS_ERROR(600200,"微信交换次数余额不足"),
|
||||||
;
|
;
|
||||||
private final Integer code;
|
private final Integer code;
|
||||||
private final String text;
|
private final String text;
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.xq.enums.account;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
//0-待接收 1-接受交换 2-拒绝交换
|
||||||
|
@Getter
|
||||||
|
public enum WxTransDataStatusEnum {
|
||||||
|
READY(0,"待接受"),
|
||||||
|
SUCCESS(1,"接受交换"),
|
||||||
|
FAIL(2,"拒绝交换"),
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
WxTransDataStatusEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.ruoyi.xq.enums.account;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
public enum WxTransLogCateEnum {
|
||||||
|
CONSUMER(1,"消费"),
|
||||||
|
VIP_GIVE(2,"开通vip赠送"),
|
||||||
|
ORDER(3,"购买"),
|
||||||
|
SYSTEM(4,"系统调账"),
|
||||||
|
|
||||||
|
;
|
||||||
|
private final Integer code;
|
||||||
|
private final String text;
|
||||||
|
|
||||||
|
WxTransLogCateEnum(Integer code, String text) {
|
||||||
|
this.code = code;
|
||||||
|
this.text = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WxTransLogCateEnum getByCode(Integer code){
|
||||||
|
return Arrays.stream(WxTransLogCateEnum.values()).filter(i -> i.getCode().equals(code)).findFirst().orElse(null);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
package com.ruoyi.xq.enums.wxtrans;
|
package com.ruoyi.xq.enums.account;
|
||||||
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
|
|
||||||
@@ -73,11 +73,6 @@ public class LoginManager {
|
|||||||
if(user == null){
|
if(user == null){
|
||||||
throw new ServiceException("用户不存在或密码错误");
|
throw new ServiceException("用户不存在或密码错误");
|
||||||
}
|
}
|
||||||
/*String imei = ServletUtils.getImei();
|
|
||||||
UserForbidManager.CheckForbid forbid = userForbidManager.checkForbid(user.getId(), user.getUsercode(), imei, ServletUtils.getClientIP());
|
|
||||||
if(forbid != null && forbid.isForbid()){
|
|
||||||
throw new ServiceException(forbid.getMessage());
|
|
||||||
}*/
|
|
||||||
if(user.getStatus() != 0){
|
if(user.getStatus() != 0){
|
||||||
throw new ServiceException("用户已封禁,请联系客服");
|
throw new ServiceException("用户已封禁,请联系客服");
|
||||||
}
|
}
|
||||||
@@ -180,6 +175,7 @@ public class LoginManager {
|
|||||||
add.setType(0);
|
add.setType(0);
|
||||||
add.setPassword(BCrypt.hashpw(usercode+"用户手动滑稽安康黄鼠狼"));
|
add.setPassword(BCrypt.hashpw(usercode+"用户手动滑稽安康黄鼠狼"));
|
||||||
add.setMobile(mobile);
|
add.setMobile(mobile);
|
||||||
|
add.setWxCode(mobile);
|
||||||
add.setGender(UserGenderEnum.NONE.getCode());
|
add.setGender(UserGenderEnum.NONE.getCode());
|
||||||
add.setAvatar(cos + UserGenderEnum.NONE.getDefaultAvatar());
|
add.setAvatar(cos + UserGenderEnum.NONE.getDefaultAvatar());
|
||||||
add.setImToken(IdUtil.simpleUUID());
|
add.setImToken(IdUtil.simpleUUID());
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.ruoyi.xq.manager;
|
package com.ruoyi.xq.manager;
|
||||||
|
|
||||||
|
import com.ruoyi.xq.domain.VipPrice;
|
||||||
import com.ruoyi.xq.dto.app.pay.ConsumeResp;
|
import com.ruoyi.xq.dto.app.pay.ConsumeResp;
|
||||||
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
@@ -7,6 +8,8 @@ import com.ruoyi.xq.mq.AmqpProducer;
|
|||||||
import com.ruoyi.xq.mq.handle.dto.CalculateSalesHandleDTO;
|
import com.ruoyi.xq.mq.handle.dto.CalculateSalesHandleDTO;
|
||||||
import com.ruoyi.xq.service.UserExtendService;
|
import com.ruoyi.xq.service.UserExtendService;
|
||||||
import com.ruoyi.xq.service.VipOrderService;
|
import com.ruoyi.xq.service.VipOrderService;
|
||||||
|
import com.ruoyi.xq.service.VipPriceService;
|
||||||
|
import com.ruoyi.xq.service.WxTransOrderService;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -22,6 +25,12 @@ public class PayManager {
|
|||||||
private UserExtendService userExtendService;
|
private UserExtendService userExtendService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AmqpProducer amqpProducer;
|
private AmqpProducer amqpProducer;
|
||||||
|
@Autowired
|
||||||
|
private VipPriceService vipPriceService;
|
||||||
|
@Autowired
|
||||||
|
private WxTransOrderService wxTransOrderService;
|
||||||
|
|
||||||
|
|
||||||
public void callBack(String orderNo, Map<String,String> params, String appId, PlatformTypeEnum payTypeEnum){
|
public void callBack(String orderNo, Map<String,String> params, String appId, PlatformTypeEnum payTypeEnum){
|
||||||
OrderTypeEnum orderTypeEnum = OrderNoUtil.getType(orderNo);
|
OrderTypeEnum orderTypeEnum = OrderNoUtil.getType(orderNo);
|
||||||
if(orderTypeEnum == null){
|
if(orderTypeEnum == null){
|
||||||
@@ -47,6 +56,26 @@ public class PayManager {
|
|||||||
}catch (Exception e){
|
}catch (Exception e){
|
||||||
log.error("RabbitMq 发送失败, 充值分销流程流转失败!",e);
|
log.error("RabbitMq 发送失败, 充值分销流程流转失败!",e);
|
||||||
}
|
}
|
||||||
|
try {
|
||||||
|
if(vipResp.getVipId() != null){
|
||||||
|
VipPrice vipPrice = vipPriceService.getById(vipResp.getVipId());
|
||||||
|
if(vipPrice != null && vipPrice.getGiveWxTransNum() > 0){
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("开通会员赠送次数失败",e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case WX_TRANS:
|
||||||
|
ConsumeResp consumeResp = wxTransOrderService.doSuccess(orderNo, params, appId, payTypeEnum);
|
||||||
|
if(consumeResp.isSuccess()){
|
||||||
|
try {
|
||||||
|
// 用户消费统计
|
||||||
|
userExtendService.incsConsumeTotal(consumeResp.getUserId(), consumeResp.getPrice());
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("用户微信交换次数消费统计",e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -30,4 +30,5 @@ public interface UserExtendMapper extends BaseMapper<UserExtend> {
|
|||||||
|
|
||||||
boolean incsConsumeTotal(@Param("userId") Long userId, @Param("consumeMonty") BigDecimal consumeMonty);
|
boolean incsConsumeTotal(@Param("userId") Long userId, @Param("consumeMonty") BigDecimal consumeMonty);
|
||||||
|
|
||||||
|
boolean incsWxTransNum(@Param("userId") Long userId, @Param("num") int num);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.ruoyi.xq.domain.WxTransData;
|
||||||
|
import com.ruoyi.xq.dto.app.account.StarWxTransReq;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransDataQuery;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换数据Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface WxTransDataMapper extends BaseMapper<WxTransData> {
|
||||||
|
|
||||||
|
Page<WxTransData> pageApp(@Param("build") Page<Object> build, @Param("query") WxTransDataQuery query);
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.ruoyi.xq.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.ruoyi.xq.domain.WxTransLog;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换记录Mapper接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface WxTransLogMapper extends BaseMapper<WxTransLog> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,11 +4,12 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.xq.domain.ConsumeLog;
|
import com.ruoyi.xq.domain.ConsumeLog;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.UserExtend;
|
import com.ruoyi.xq.domain.UserExtend;
|
||||||
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
||||||
import com.ruoyi.xq.dto.app.account.AccountDetailVo;
|
import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
|
||||||
import com.ruoyi.xq.enums.user.AccountChangeCodeEnum;
|
import com.ruoyi.xq.enums.user.AccountChangeCodeEnum;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
@@ -35,8 +36,11 @@ public interface UserExtendService extends IService<UserExtend> {
|
|||||||
|
|
||||||
void updateWxTransNum(UpdateWxTransNumReq bo);
|
void updateWxTransNum(UpdateWxTransNumReq bo);
|
||||||
|
|
||||||
|
boolean consumeWxTrans(Long sponsorUserId, User receiveUser, String traceId);
|
||||||
|
|
||||||
|
boolean incsWxTrans(Long userId,Integer wxTransNum, WxTransLogCateEnum cateEnum, String traceId, String remark);
|
||||||
|
|
||||||
UserExtend getByUserId(Long id);
|
UserExtend getByUserId(Long id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.xq.domain.WxTransData;
|
||||||
|
import com.ruoyi.xq.dto.app.account.StarWxTransReq;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransDataListAppVo;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransDataQuery;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换数据Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface WxTransDataService extends IService<WxTransData> {
|
||||||
|
|
||||||
|
void start(StarWxTransReq starWxTransReq);
|
||||||
|
|
||||||
|
Page<WxTransDataListAppVo> pageApp(PageQuery pageQuery, WxTransDataQuery wxTransDataQuery);
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.ruoyi.xq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.domain.WxTransLog;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransLogListVo;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransLogQuery;
|
||||||
|
import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换记录Service接口
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
public interface WxTransLogService extends IService<WxTransLog> {
|
||||||
|
Page<WxTransLogListVo> pageApp(PageQuery pageQuery, WxTransLogQuery query);
|
||||||
|
|
||||||
|
void consumerSaveLog(Long sponsorUserId, String traceId, User receiveUser);
|
||||||
|
|
||||||
|
void saveLog(Long userId, Integer wxTransNum, WxTransLogCateEnum cateEnum, String traceId, String remark);
|
||||||
|
}
|
||||||
@@ -5,6 +5,11 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
|||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
|
import com.ruoyi.xq.dto.app.pay.ConsumeResp;
|
||||||
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信交换订单Service接口
|
* 微信交换订单Service接口
|
||||||
@@ -14,7 +19,12 @@ import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
|||||||
*/
|
*/
|
||||||
public interface WxTransOrderService extends IService<WxTransOrder> {
|
public interface WxTransOrderService extends IService<WxTransOrder> {
|
||||||
|
|
||||||
WxTransOrder createVipOrder(Long userId, Integer wxTransNum);
|
WxTransOrder createWxTransOrder(Long userId, Integer wxTransNum);
|
||||||
|
|
||||||
|
WxTransOrder getByOrderNo(String orderNo);
|
||||||
|
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
ConsumeResp doSuccess(String orderNo, Map<String, String> params, String appId, PlatformTypeEnum payTypeEnum);
|
||||||
|
|
||||||
Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo);
|
Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,21 +14,18 @@ import com.ruoyi.xq.domain.WxTransOrder;
|
|||||||
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
import com.ruoyi.xq.dto.admin.user.UserExtendAdminVo;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateIncomeCoinReq;
|
||||||
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
import com.ruoyi.xq.dto.admin.user.req.UpdateWxTransNumReq;
|
||||||
import com.ruoyi.xq.dto.app.account.AccountDetailVo;
|
import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
|
||||||
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
import com.ruoyi.xq.enums.consumer.ConsumerTypeEnum;
|
import com.ruoyi.xq.enums.consumer.ConsumerTypeEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
import com.ruoyi.xq.enums.user.AccountChangeCodeEnum;
|
import com.ruoyi.xq.enums.user.AccountChangeCodeEnum;
|
||||||
import com.ruoyi.xq.enums.wxtrans.WxTransSourceEnum;
|
import com.ruoyi.xq.enums.account.WxTransSourceEnum;
|
||||||
import com.ruoyi.xq.manager.OrderNoUtil;
|
import com.ruoyi.xq.manager.OrderNoUtil;
|
||||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||||
import com.ruoyi.xq.mapper.UserExtendMapper;
|
import com.ruoyi.xq.mapper.UserExtendMapper;
|
||||||
import com.ruoyi.xq.service.AccountChangeLogService;
|
import com.ruoyi.xq.service.*;
|
||||||
import com.ruoyi.xq.service.UserExtendService;
|
|
||||||
import com.ruoyi.xq.service.UserService;
|
|
||||||
import com.ruoyi.xq.service.WxTransOrderService;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -55,6 +52,8 @@ public class UserExtendServiceImpl extends ServiceImpl<UserExtendMapper,UserExte
|
|||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
private AccountChangeLogService accountChangeLogService;
|
private AccountChangeLogService accountChangeLogService;
|
||||||
|
@Autowired
|
||||||
|
private WxTransLogService wxTransLogService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean withdraw(Long userId, BigDecimal withdrawPrice,String traceId){
|
public boolean withdraw(Long userId, BigDecimal withdrawPrice,String traceId){
|
||||||
@@ -159,6 +158,24 @@ public class UserExtendServiceImpl extends ServiceImpl<UserExtendMapper,UserExte
|
|||||||
wxTransOrderService.save(wxTransOrder);
|
wxTransOrderService.save(wxTransOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean consumeWxTrans(Long sponsorUserId, User receiveUser, String traceId) {
|
||||||
|
boolean success = baseMapper.incsWxTransNum(sponsorUserId, 1);
|
||||||
|
if(success){
|
||||||
|
wxTransLogService.consumerSaveLog(sponsorUserId, traceId,receiveUser);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean incsWxTrans(Long userId, Integer wxTransNum, WxTransLogCateEnum cateEnum, String traceId, String remark) {
|
||||||
|
boolean success = baseMapper.incsWxTransNum(userId, wxTransNum);
|
||||||
|
if(success){
|
||||||
|
wxTransLogService.saveLog(userId, wxTransNum,cateEnum,traceId,remark);
|
||||||
|
}
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public UserExtend getByUserId(Long userId) {
|
public UserExtend getByUserId(Long userId) {
|
||||||
return this.getOne(Wrappers.lambdaQuery(UserExtend.class).eq(UserExtend::getUserId, userId).last("limit 1"));
|
return this.getOne(Wrappers.lambdaQuery(UserExtend.class).eq(UserExtend::getUserId, userId).last("limit 1"));
|
||||||
|
|||||||
@@ -123,6 +123,7 @@ public class VipOrderServiceImpl extends ServiceImpl<VipOrderMapper,VipOrder> im
|
|||||||
resp.setUserId(vipOrder.getUserId());
|
resp.setUserId(vipOrder.getUserId());
|
||||||
resp.setTraceId(traceId);
|
resp.setTraceId(traceId);
|
||||||
resp.setSuccess(true);
|
resp.setSuccess(true);
|
||||||
|
resp.setVipId(vipOrder.getVipId());
|
||||||
return resp;
|
return resp;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,136 @@
|
|||||||
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.domain.WxTransData;
|
||||||
|
import com.ruoyi.xq.dto.app.account.StarWxTransReq;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransDataListAppVo;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransDataQuery;
|
||||||
|
import com.ruoyi.xq.enums.ErrorEnum;
|
||||||
|
import com.ruoyi.xq.enums.account.WxTransDataStatusEnum;
|
||||||
|
import com.ruoyi.xq.enums.common.TraceIdEnum;
|
||||||
|
import com.ruoyi.xq.mapper.WxTransDataMapper;
|
||||||
|
import com.ruoyi.xq.service.UserExtendService;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.service.WxTransDataService;
|
||||||
|
import com.ruoyi.xq.util.BirthdayUtil;
|
||||||
|
import com.ruoyi.xq.util.PageConvert;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换数据Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WxTransDataServiceImpl extends ServiceImpl<WxTransDataMapper,WxTransData> implements WxTransDataService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private UserExtendService userExtendService;
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void start(StarWxTransReq starWxTransReq) {
|
||||||
|
if(starWxTransReq.getSponsorUserId().equals(starWxTransReq.getReceiveUserId())){
|
||||||
|
throw new ServiceException("自己不能和自己交换微信哦");
|
||||||
|
}
|
||||||
|
User receiveUser = userService.getById(starWxTransReq.getReceiveUserId());
|
||||||
|
if(receiveUser == null){
|
||||||
|
throw new ServiceException("接受用户不存在");
|
||||||
|
}
|
||||||
|
String traceId = TraceIdEnum.WX_TRANS.getCode();
|
||||||
|
boolean success = userExtendService.consumeWxTrans(starWxTransReq.getSponsorUserId(),receiveUser, traceId);
|
||||||
|
if(!success){
|
||||||
|
throw new ServiceException(ErrorEnum.WX_TRANS_ERROR);
|
||||||
|
}
|
||||||
|
User sponsorUser = userService.getById(starWxTransReq.getSponsorUserId());
|
||||||
|
WxTransData data = new WxTransData();
|
||||||
|
data.setTraceId(traceId);
|
||||||
|
data.setSponsorUserId(sponsorUser.getId());
|
||||||
|
data.setSponsorUsercode(sponsorUser.getUsercode());
|
||||||
|
data.setSponsorWx(sponsorUser.getWxCode());
|
||||||
|
data.setReceiveUserId(receiveUser.getId());
|
||||||
|
data.setReceiveUsercode(receiveUser.getUsercode());
|
||||||
|
data.setReceiveWx(receiveUser.getWxCode());
|
||||||
|
data.setStatus(WxTransDataStatusEnum.READY.getCode());
|
||||||
|
this.save(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<WxTransDataListAppVo> pageApp(PageQuery pageQuery, WxTransDataQuery wxTransDataQuery) {
|
||||||
|
Page<WxTransData> page = baseMapper.pageApp(pageQuery.build(), wxTransDataQuery);
|
||||||
|
List<WxTransData> records = page.getRecords();
|
||||||
|
if(CollectionUtils.isEmpty(records)){
|
||||||
|
return PageConvert.convertEmpty(page);
|
||||||
|
}
|
||||||
|
Long userId = wxTransDataQuery.getUserId();
|
||||||
|
List<Long> userIdList = new ArrayList<>();
|
||||||
|
for (WxTransData record : records) {
|
||||||
|
userIdList.add(record.getSponsorUserId());
|
||||||
|
userIdList.add(record.getReceiveUserId());
|
||||||
|
}
|
||||||
|
List<User> users = userService.listByIds(userIdList);
|
||||||
|
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
|
List<WxTransDataListAppVo> res = new ArrayList<>();
|
||||||
|
for (WxTransData record : records) {
|
||||||
|
WxTransDataListAppVo vo = new WxTransDataListAppVo();
|
||||||
|
vo.setId(record.getId());
|
||||||
|
vo.setCreateTime(record.getCreateTime());
|
||||||
|
vo.setStatus(record.getStatus());
|
||||||
|
if(record.getSponsorUserId().equals(userId)){
|
||||||
|
vo.setUserId(record.getSponsorUserId());
|
||||||
|
vo.setUsercode(record.getSponsorUsercode());
|
||||||
|
User user = userMap.get(record.getSponsorUserId());
|
||||||
|
if(user != null){
|
||||||
|
vo.setAvatar(user.getAvatar());
|
||||||
|
vo.setGender(user.getGender());
|
||||||
|
vo.setNickname(user.getNickname());
|
||||||
|
vo.setBirthday(user.getBirthday());
|
||||||
|
vo.setBirthdayStr(BirthdayUtil.getMinBirthday(user.getBirthday()));
|
||||||
|
vo.setAge(BirthdayUtil.getAge(user.getBirthday()));
|
||||||
|
vo.setResidenceCityName(user.getResidenceCityName());
|
||||||
|
vo.setEducation(user.getEducation());
|
||||||
|
vo.setProfession(user.getProfession());
|
||||||
|
}
|
||||||
|
if(WxTransDataStatusEnum.SUCCESS.getCode().equals(record.getStatus())){
|
||||||
|
vo.setWxCode(record.getReceiveWx());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setUserId(record.getReceiveUserId());
|
||||||
|
vo.setUsercode(record.getReceiveUsercode());
|
||||||
|
User user = userMap.get(record.getReceiveUserId());
|
||||||
|
if(user != null){
|
||||||
|
vo.setAvatar(user.getAvatar());
|
||||||
|
vo.setGender(user.getGender());
|
||||||
|
vo.setNickname(user.getNickname());
|
||||||
|
vo.setBirthday(user.getBirthday());
|
||||||
|
vo.setBirthdayStr(BirthdayUtil.getMinBirthday(user.getBirthday()));
|
||||||
|
vo.setAge(BirthdayUtil.getAge(user.getBirthday()));
|
||||||
|
vo.setResidenceCityName(user.getResidenceCityName());
|
||||||
|
vo.setEducation(user.getEducation());
|
||||||
|
vo.setProfession(user.getProfession());
|
||||||
|
}
|
||||||
|
if(WxTransDataStatusEnum.SUCCESS.getCode().equals(record.getStatus())){
|
||||||
|
vo.setWxCode(record.getSponsorWx());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
res.add(vo);
|
||||||
|
}
|
||||||
|
return PageConvert.convert(page,res);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
|
import com.ruoyi.xq.domain.User;
|
||||||
|
import com.ruoyi.xq.domain.WxTransLog;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransLogListVo;
|
||||||
|
import com.ruoyi.xq.dto.app.account.WxTransLogQuery;
|
||||||
|
import com.ruoyi.xq.dto.common.user.MinUser;
|
||||||
|
import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
|
||||||
|
import com.ruoyi.xq.mapper.WxTransLogMapper;
|
||||||
|
import com.ruoyi.xq.service.UserService;
|
||||||
|
import com.ruoyi.xq.service.WxTransLogService;
|
||||||
|
import com.ruoyi.xq.util.PageConvert;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 微信交换记录Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 77
|
||||||
|
* @date 2024-03-25
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class WxTransLogServiceImpl extends ServiceImpl<WxTransLogMapper,WxTransLog> implements WxTransLogService {
|
||||||
|
@Autowired
|
||||||
|
private UserService userService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<WxTransLogListVo> pageApp(PageQuery pageQuery, WxTransLogQuery query) {
|
||||||
|
Page<WxTransLog> page = this.page(pageQuery.build(), Wrappers.lambdaQuery(WxTransLog.class).eq(WxTransLog::getUserId, query.getUserId()));
|
||||||
|
List<WxTransLog> records = page.getRecords();
|
||||||
|
if(CollectionUtils.isEmpty(records)){
|
||||||
|
return PageConvert.convertEmpty(page);
|
||||||
|
}
|
||||||
|
List<Long> userIdList = records.stream().map(WxTransLog::getTarUserId).filter(Objects::nonNull).collect(Collectors.toList());
|
||||||
|
List<User> users = userService.listByIds(userIdList);
|
||||||
|
Map<Long, User> userMap = users.stream().collect(Collectors.toMap(User::getId, Function.identity()));
|
||||||
|
List<WxTransLogListVo> vo = new ArrayList<>();
|
||||||
|
for (WxTransLog record : records) {
|
||||||
|
WxTransLogListVo res = new WxTransLogListVo();
|
||||||
|
res.setUserId(record.getUserId());
|
||||||
|
res.setUsercode(record.getUsercode());
|
||||||
|
res.setTitle(record.getCateName());
|
||||||
|
res.setContent(record.getRemark());
|
||||||
|
res.setCreateTime(record.getCreateTime());
|
||||||
|
res.setChangeValue(record.getChangeValue());
|
||||||
|
User user = userMap.get(record.getTarUserId());
|
||||||
|
if(user != null){
|
||||||
|
res.setSourceUserId(user.getId());
|
||||||
|
res.setSourceNickname(user.getNickname());
|
||||||
|
res.setSourceImg(user.getAvatar());
|
||||||
|
}
|
||||||
|
vo.add(res);
|
||||||
|
}
|
||||||
|
return PageConvert.convert(page,vo);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void consumerSaveLog(Long sponsorUserId, String traceId, User receiveUser) {
|
||||||
|
MinUser minUser = userService.getMinUserById(sponsorUserId);
|
||||||
|
WxTransLog wxTransLog = new WxTransLog();
|
||||||
|
wxTransLog.setUserId(minUser.getId());
|
||||||
|
wxTransLog.setUsercode(minUser.getUsercode());
|
||||||
|
wxTransLog.setTraceId(traceId);
|
||||||
|
wxTransLog.setCateId(WxTransLogCateEnum.CONSUMER.getCode());
|
||||||
|
wxTransLog.setCateName(WxTransLogCateEnum.CONSUMER.getText());
|
||||||
|
wxTransLog.setRemark("使用一次微信交换");
|
||||||
|
wxTransLog.setChangeValue(-1L);
|
||||||
|
wxTransLog.setTarUserJson(JSON.toJSONString(receiveUser));
|
||||||
|
wxTransLog.setTarUserId(receiveUser.getId());
|
||||||
|
wxTransLog.setTarUsercode(receiveUser.getUsercode());
|
||||||
|
this.save(wxTransLog);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void saveLog(Long userId, Integer wxTransNum, WxTransLogCateEnum cateEnum, String traceId, String remark) {
|
||||||
|
MinUser minUser = userService.getMinUserById(userId);
|
||||||
|
WxTransLog wxTransLog = new WxTransLog();
|
||||||
|
wxTransLog.setUserId(minUser.getId());
|
||||||
|
wxTransLog.setUsercode(minUser.getUsercode());
|
||||||
|
wxTransLog.setTraceId(traceId);
|
||||||
|
wxTransLog.setCateId(cateEnum.getCode());
|
||||||
|
wxTransLog.setCateName(cateEnum.getText());
|
||||||
|
wxTransLog.setRemark(cateEnum.getText());
|
||||||
|
if(StringUtils.isNotBlank(remark)){
|
||||||
|
wxTransLog.setRemark(remark);
|
||||||
|
}
|
||||||
|
wxTransLog.setChangeValue(Long.valueOf(wxTransNum));
|
||||||
|
this.save(wxTransLog);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,25 +1,35 @@
|
|||||||
package com.ruoyi.xq.service.impl;
|
package com.ruoyi.xq.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.util.NumberUtil;
|
import cn.hutool.core.util.NumberUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.ruoyi.common.core.domain.PageQuery;
|
import com.ruoyi.common.core.domain.PageQuery;
|
||||||
import com.ruoyi.xq.domain.User;
|
import com.ruoyi.xq.domain.User;
|
||||||
import com.ruoyi.xq.domain.WxTransOrder;
|
import com.ruoyi.xq.domain.WxTransOrder;
|
||||||
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
import com.ruoyi.xq.dto.admin.wxtrans.WxTransOrderAdminVo;
|
||||||
|
import com.ruoyi.xq.dto.app.pay.ConsumeResp;
|
||||||
|
import com.ruoyi.xq.enums.account.WxTransLogCateEnum;
|
||||||
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
import com.ruoyi.xq.enums.common.OrderTypeEnum;
|
||||||
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
import com.ruoyi.xq.enums.common.SystemConfigEnum;
|
||||||
|
import com.ruoyi.xq.enums.common.TraceIdEnum;
|
||||||
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
import com.ruoyi.xq.enums.pay.PayStatusEnum;
|
||||||
import com.ruoyi.xq.enums.wxtrans.WxTransSourceEnum;
|
import com.ruoyi.xq.enums.account.WxTransSourceEnum;
|
||||||
|
import com.ruoyi.xq.enums.pay.PlatformTypeEnum;
|
||||||
import com.ruoyi.xq.manager.OrderNoUtil;
|
import com.ruoyi.xq.manager.OrderNoUtil;
|
||||||
import com.ruoyi.xq.manager.SystemConfigManager;
|
import com.ruoyi.xq.manager.SystemConfigManager;
|
||||||
|
import com.ruoyi.xq.manager.TraceIdManager;
|
||||||
import com.ruoyi.xq.mapper.WxTransOrderMapper;
|
import com.ruoyi.xq.mapper.WxTransOrderMapper;
|
||||||
|
import com.ruoyi.xq.service.UserExtendService;
|
||||||
import com.ruoyi.xq.service.UserService;
|
import com.ruoyi.xq.service.UserService;
|
||||||
import com.ruoyi.xq.service.WxTransOrderService;
|
import com.ruoyi.xq.service.WxTransOrderService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 微信交换订单Service业务层处理
|
* 微信交换订单Service业务层处理
|
||||||
@@ -34,9 +44,11 @@ public class WxTransOrderServiceImpl extends ServiceImpl<WxTransOrderMapper,WxTr
|
|||||||
private SystemConfigManager systemConfigManager;
|
private SystemConfigManager systemConfigManager;
|
||||||
@Autowired
|
@Autowired
|
||||||
private UserService userService;
|
private UserService userService;
|
||||||
|
@Autowired
|
||||||
|
private UserExtendService userExtendService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WxTransOrder createVipOrder(Long userId, Integer wxTransNum) {
|
public WxTransOrder createWxTransOrder(Long userId, Integer wxTransNum) {
|
||||||
BigDecimal price = systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.WX_TRANS_PRICE);
|
BigDecimal price = systemConfigManager.getSystemConfigOfBigDecimal(SystemConfigEnum.WX_TRANS_PRICE);
|
||||||
String orderNo = OrderNoUtil.gen(OrderTypeEnum.WX_TRANS);
|
String orderNo = OrderNoUtil.gen(OrderTypeEnum.WX_TRANS);
|
||||||
User user = userService.getById(userId);
|
User user = userService.getById(userId);
|
||||||
@@ -53,6 +65,45 @@ public class WxTransOrderServiceImpl extends ServiceImpl<WxTransOrderMapper,WxTr
|
|||||||
return order;
|
return order;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WxTransOrder getByOrderNo(String orderNo){
|
||||||
|
return this.getOne(Wrappers.lambdaQuery(WxTransOrder.class).eq(WxTransOrder::getOrderNo, orderNo).last("limit 1"));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public ConsumeResp doSuccess(String orderNo, Map<String, String> params, String appId, PlatformTypeEnum payTypeEnum){
|
||||||
|
WxTransOrder wxTransOrder = this.getByOrderNo(orderNo);
|
||||||
|
if(wxTransOrder == null){
|
||||||
|
ConsumeResp resp = new ConsumeResp();
|
||||||
|
resp.setSuccess(false);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
String traceId = TraceIdManager.gen(TraceIdEnum.VIP);
|
||||||
|
boolean success = this.update(Wrappers.lambdaUpdate(WxTransOrder.class)
|
||||||
|
.eq(WxTransOrder::getId, wxTransOrder.getId())
|
||||||
|
.eq(WxTransOrder::getPayStatus, PayStatusEnum.READY_PAY.getCode())
|
||||||
|
.set(WxTransOrder::getPayStatus, PayStatusEnum.PAY.getCode())
|
||||||
|
.set(WxTransOrder::getTraceId, traceId)
|
||||||
|
.set(WxTransOrder::getReturnContent, JSON.toJSONString(params))
|
||||||
|
.set(WxTransOrder::getAppid,appId)
|
||||||
|
.set(WxTransOrder::getPlatformType, payTypeEnum.getCode()));
|
||||||
|
if(!success){
|
||||||
|
ConsumeResp resp = new ConsumeResp();
|
||||||
|
resp.setSuccess(false);
|
||||||
|
return resp;
|
||||||
|
}
|
||||||
|
userExtendService.incsWxTrans(wxTransOrder.getUserId(),wxTransOrder.getWxNum(), WxTransLogCateEnum.ORDER,wxTransOrder.getTraceId(),
|
||||||
|
"购买一次微信交换");
|
||||||
|
ConsumeResp resp = new ConsumeResp();
|
||||||
|
resp.setPrice(wxTransOrder.getWxPrice());
|
||||||
|
resp.setUserId(wxTransOrder.getUserId());
|
||||||
|
resp.setTraceId(traceId);
|
||||||
|
resp.setSuccess(true);
|
||||||
|
return resp;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo) {
|
public Page<WxTransOrderAdminVo> pageAdmin(PageQuery pageQuery, WxTransOrderAdminVo bo) {
|
||||||
return baseMapper.pageAdmin(pageQuery.build(), bo);
|
return baseMapper.pageAdmin(pageQuery.build(), bo);
|
||||||
|
|||||||
@@ -29,6 +29,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
set consume_total = consume_total + #{consumeMonty}
|
set consume_total = consume_total + #{consumeMonty}
|
||||||
where user_id = #{userId}
|
where user_id = #{userId}
|
||||||
</update>
|
</update>
|
||||||
|
<update id="incsWxTransNum">
|
||||||
|
update xq_user_extend
|
||||||
|
set wx_trans_num = wx_trans_num + #{num}
|
||||||
|
where wx_trans_num + #{num} > 0 and user_id = #{userId}
|
||||||
|
</update>
|
||||||
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.user.UserExtendAdminVo">
|
<select id="pageAdmin" resultType="com.ruoyi.xq.dto.admin.user.UserExtendAdminVo">
|
||||||
select t1.*, t2.nickname,t2.mobile,t2.avatar
|
select t1.*, t2.nickname,t2.mobile,t2.avatar
|
||||||
from xq_user_extend t1
|
from xq_user_extend t1
|
||||||
|
|||||||
26
ruoyi-xq/src/main/resources/mapper/xq/WxTransDataMapper.xml
Normal file
26
ruoyi-xq/src/main/resources/mapper/xq/WxTransDataMapper.xml
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
<?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.ruoyi.xq.mapper.WxTransDataMapper">
|
||||||
|
<select id="pageApp" resultType="com.ruoyi.xq.domain.WxTransData">
|
||||||
|
select *
|
||||||
|
from xq_wx_trans_data t1
|
||||||
|
<where>
|
||||||
|
<if test="query.status != null">
|
||||||
|
and t1.status = #{query.status}
|
||||||
|
</if>
|
||||||
|
<if test="query.type == 1">
|
||||||
|
and t1.sponsor_user_id = #{query.userId}
|
||||||
|
</if>
|
||||||
|
<if test="query.type == 2">
|
||||||
|
and t1.receive_user_id = #{query.userId}
|
||||||
|
</if>
|
||||||
|
<if test="query.type == 3">
|
||||||
|
and (t1.receive_user_id = #{query.userId} or t1.sponsor_user_id = #{query.userId})
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
19
ruoyi-xq/src/main/resources/mapper/xq/WxTransLogMapper.xml
Normal file
19
ruoyi-xq/src/main/resources/mapper/xq/WxTransLogMapper.xml
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
<?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.ruoyi.xq.mapper.WxTransLogMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.ruoyi.xq.domain.WxTransLog" id="WxTransLogResult">
|
||||||
|
<result property="id" column="id"/>
|
||||||
|
<result property="userId" column="user_id"/>
|
||||||
|
<result property="userCode" column="user_code"/>
|
||||||
|
<result property="wxTransDataId" column="wx_trans_data_id"/>
|
||||||
|
<result property="cateId" column="cate_id"/>
|
||||||
|
<result property="changeValue" column="change_value"/>
|
||||||
|
<result property="createTime" column="create_time"/>
|
||||||
|
<result property="updateTime" column="update_time"/>
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Reference in New Issue
Block a user