微信支付历史表生成

pull/1/head
czc 2 years ago
parent c63f6a3d05
commit c082fb8656

@ -0,0 +1,93 @@
package com.cyl.manager.oms.controller;
import java.util.List;
import com.cyl.manager.oms.domain.WechatPaymentHistory;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Page;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.enums.BusinessType;
import com.cyl.manager.oms.convert.WechatPaymentHistoryConvert;
import com.cyl.manager.oms.pojo.query.WechatPaymentHistoryQuery;
import com.cyl.manager.oms.service.WechatPaymentHistoryService;
import com.cyl.manager.oms.pojo.vo.WechatPaymentHistoryVO;
import com.ruoyi.common.utils.poi.ExcelUtil;
/**
* Controller
*
* @author zcc
* @date 2023-07-12
*/
@Api(description ="微信订单表接口列表")
@RestController
@RequestMapping("/pms/omsWechatPaymentHistory")
public class WechatPaymentHistoryController extends BaseController {
@Autowired
private WechatPaymentHistoryService service;
@Autowired
private WechatPaymentHistoryConvert convert;
@ApiOperation("查询微信订单表列表")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:list')")
@PostMapping("/list")
public ResponseEntity<Page<WechatPaymentHistory>> list(@RequestBody WechatPaymentHistoryQuery query, Pageable page) {
List<WechatPaymentHistory> list = service.selectList(query, page);
return ResponseEntity.ok(new PageImpl<>(list, page, ((com.github.pagehelper.Page)list).getTotal()));
}
@ApiOperation("导出微信订单表列表")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:export')")
@Log(title = "微信订单表", businessType = BusinessType.EXPORT)
@GetMapping("/export")
public ResponseEntity<String> export(WechatPaymentHistoryQuery query) {
List<WechatPaymentHistory> list = service.selectList(query, null);
ExcelUtil<WechatPaymentHistoryVO> util = new ExcelUtil<>(WechatPaymentHistoryVO.class);
return ResponseEntity.ok(util.writeExcel(convert.dos2vos(list), "微信订单表数据"));
}
@ApiOperation("获取微信订单表详细信息")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:query')")
@GetMapping(value = "/{id}")
public ResponseEntity<WechatPaymentHistory> getInfo(@PathVariable("id") Long id) {
return ResponseEntity.ok(service.selectById(id));
}
@ApiOperation("新增微信订单表")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:add')")
@Log(title = "微信订单表", businessType = BusinessType.INSERT)
@PostMapping
public ResponseEntity<Integer> add(@RequestBody WechatPaymentHistory wechatPaymentHistory) {
return ResponseEntity.ok(service.insert(wechatPaymentHistory));
}
@ApiOperation("修改微信订单表")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:edit')")
@Log(title = "微信订单表", businessType = BusinessType.UPDATE)
@PutMapping
public ResponseEntity<Integer> edit(@RequestBody WechatPaymentHistory wechatPaymentHistory) {
return ResponseEntity.ok(service.update(wechatPaymentHistory));
}
@ApiOperation("删除微信订单表")
@PreAuthorize("@ss.hasPermi('pms:omsWechatPaymentHistory:remove')")
@Log(title = "微信订单表", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public ResponseEntity<Integer> remove(@PathVariable Long id) {
return ResponseEntity.ok(service.deleteById(id));
}
}

@ -0,0 +1,16 @@
package com.cyl.manager.oms.convert;
import org.mapstruct.Mapper;
import com.cyl.manager.oms.domain.WechatPaymentHistory;
import com.cyl.manager.oms.pojo.vo.WechatPaymentHistoryVO;
import java.util.List;
/**
* DO <=> DTO <=> VO / BO / Query
*
* @author zcc
*/
@Mapper(componentModel = "spring")
public interface WechatPaymentHistoryConvert {
List<WechatPaymentHistoryVO> dos2vos(List<WechatPaymentHistory> list);
}

@ -0,0 +1,72 @@
package com.cyl.manager.oms.domain;
import java.math.BigDecimal;
import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
import com.baomidou.mybatisplus.annotation.TableName;
/**
* oms_wechat_payment_history
*
* @author zcc
*/
@ApiModel(description="微信订单表对象")
@Data
@TableName("oms_wechat_payment_history")
public class WechatPaymentHistory extends BaseAudit {
private static final long serialVersionUID = 1L;
@ApiModelProperty("ID")
private Long id;
@ApiModelProperty("payment_id")
@Excel(name = "payment_id")
private String paymentId;
@ApiModelProperty("用户 ID")
@Excel(name = "用户 ID")
private Long memberId;
@ApiModelProperty("OPENID")
@Excel(name = "OPENID")
private String openid;
@ApiModelProperty("真实姓名,提现需要")
@Excel(name = "真实姓名,提现需要")
private String realName;
@ApiModelProperty("标题|商品名称")
@Excel(name = "标题|商品名称")
private String title;
@ApiModelProperty("订单号 支付时是payId 其他为orderId")
@Excel(name = "订单号 支付时是payId 其他为orderId")
private Long orderId;
@ApiModelProperty("金额,单位分")
@Excel(name = "金额,单位分")
private BigDecimal money;
@ApiModelProperty("交易类型1为支付 2为提现 3为退款")
@Excel(name = "交易类型", readConverterExp = "1=为支付,2=为提现,3=为退款")
private Integer opType;
@ApiModelProperty("状态0未完成交易 1完成关键交易")
@Excel(name = "状态", readConverterExp = "0=:未完成交易,1=:完成关键交易")
private Integer paymentStatus;
@ApiModelProperty("备注")
@Excel(name = "备注")
private String remark;
@ApiModelProperty("附加数据")
@Excel(name = "附加数据")
private String attach;
@ApiModelProperty("响应内容")
@Excel(name = "响应内容")
private String responseBody;
}

@ -0,0 +1,20 @@
package com.cyl.manager.oms.mapper;
import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cyl.manager.oms.domain.WechatPaymentHistory;
/**
* Mapper
*
* @author zcc
*/
public interface WechatPaymentHistoryMapper extends BaseMapper<WechatPaymentHistory> {
/**
*
*
* @param wechatPaymentHistory
* @return
*/
List<WechatPaymentHistory> selectByEntity(WechatPaymentHistory wechatPaymentHistory);
}

@ -0,0 +1,49 @@
package com.cyl.manager.oms.pojo.query;
import java.math.BigDecimal;
import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
*
*
* @author zcc
*/
@ApiModel(description="微信订单表 查询 对象")
@Data
public class WechatPaymentHistoryQuery {
@ApiModelProperty("payment_id 精确匹配")
private String paymentId;
@ApiModelProperty("用户 ID 精确匹配")
private Long memberId;
@ApiModelProperty("OPENID 精确匹配")
private String openid;
@ApiModelProperty("真实姓名,提现需要 精确匹配")
private String realNameLike;
@ApiModelProperty("标题|商品名称 精确匹配")
private String title;
@ApiModelProperty("订单号 支付时是payId 其他为orderId 精确匹配")
private Long orderId;
@ApiModelProperty("金额,单位分 精确匹配")
private BigDecimal money;
@ApiModelProperty("交易类型1为支付 2为提现 3为退款 精确匹配")
private Integer opType;
@ApiModelProperty("状态0未完成交易 1完成关键交易 精确匹配")
private Integer paymentStatus;
@ApiModelProperty("附加数据 精确匹配")
private String attach;
@ApiModelProperty("响应内容 精确匹配")
private String responseBody;
}

@ -0,0 +1,52 @@
package com.cyl.manager.oms.pojo.vo;
import java.math.BigDecimal;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseAudit;
import lombok.Data;
/**
*
*
* @author zcc
*/
@Data
public class WechatPaymentHistoryVO extends BaseAudit {
/** ID */
private Long id;
/** payment_id */
@Excel(name = "payment_id")
private String paymentId;
/** 用户 ID */
@Excel(name = "用户 ID")
private Long memberId;
/** OPENID */
@Excel(name = "OPENID")
private String openid;
/** 真实姓名,提现需要 */
@Excel(name = "真实姓名,提现需要")
private String realName;
/** 标题|商品名称 */
@Excel(name = "标题|商品名称")
private String title;
/** 订单号 支付时是payId 其他为orderId */
@Excel(name = "订单号 支付时是payId 其他为orderId")
private Long orderId;
/** 金额,单位分 */
@Excel(name = "金额,单位分")
private BigDecimal money;
/** 交易类型1为支付 2为提现 3为退款 */
@Excel(name = "交易类型", readConverterExp = "1=为支付,2=为提现,3=为退款")
private Integer opType;
/** 状态0未完成交易 1完成关键交易 */
@Excel(name = "状态", readConverterExp = "0=:未完成交易,1=:完成关键交易")
private Integer paymentStatus;
/** 备注 */
@Excel(name = "备注")
private String remark;
/** 附加数据 */
@Excel(name = "附加数据")
private String attach;
/** 响应内容 */
@Excel(name = "响应内容")
private String responseBody;
}

@ -0,0 +1,126 @@
package com.cyl.manager.oms.service;
import java.math.BigDecimal;
import java.util.List;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cyl.manager.oms.domain.WechatPaymentHistory;
import com.github.pagehelper.PageHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Pageable;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import com.cyl.manager.oms.mapper.WechatPaymentHistoryMapper;
import com.cyl.manager.oms.pojo.query.WechatPaymentHistoryQuery;
/**
* Service
*
*
* @author zcc
*/
@Service
public class WechatPaymentHistoryService {
@Autowired
private WechatPaymentHistoryMapper wechatPaymentHistoryMapper;
/**
*
*
* @param id
* @return
*/
public WechatPaymentHistory selectById(Long id) {
return wechatPaymentHistoryMapper.selectById(id);
}
/**
*
*
* @param query
* @param page
* @return
*/
public List<WechatPaymentHistory> selectList(WechatPaymentHistoryQuery query, Pageable page) {
if (page != null) {
PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize());
}
QueryWrapper<WechatPaymentHistory> qw = new QueryWrapper<>();
String paymentId = query.getPaymentId();
if (!StringUtils.isEmpty(paymentId)) {
qw.eq("payment_id", paymentId);
}
Long memberId = query.getMemberId();
if (memberId != null) {
qw.eq("member_id", memberId);
}
String openid = query.getOpenid();
if (!StringUtils.isEmpty(openid)) {
qw.eq("openid", openid);
}
String realNameLike = query.getRealNameLike();
if (!StringUtils.isEmpty(realNameLike)) {
qw.like("real_name", realNameLike);
}
String title = query.getTitle();
if (!StringUtils.isEmpty(title)) {
qw.eq("title", title);
}
Long orderId = query.getOrderId();
if (orderId != null) {
qw.eq("order_id", orderId);
}
BigDecimal money = query.getMoney();
if (money != null) {
qw.eq("money", money);
}
Integer opType = query.getOpType();
if (opType != null) {
qw.eq("op_type", opType);
}
Integer paymentStatus = query.getPaymentStatus();
if (paymentStatus != null) {
qw.eq("payment_status", paymentStatus);
}
String attach = query.getAttach();
if (!StringUtils.isEmpty(attach)) {
qw.eq("attach", attach);
}
String responseBody = query.getResponseBody();
if (!StringUtils.isEmpty(responseBody)) {
qw.eq("response_body", responseBody);
}
return wechatPaymentHistoryMapper.selectList(qw);
}
/**
*
*
* @param wechatPaymentHistory
* @return
*/
public int insert(WechatPaymentHistory wechatPaymentHistory) {
wechatPaymentHistory.setCreateTime(LocalDateTime.now());
return wechatPaymentHistoryMapper.insert(wechatPaymentHistory);
}
/**
*
*
* @param wechatPaymentHistory
* @return
*/
public int update(WechatPaymentHistory wechatPaymentHistory) {
return wechatPaymentHistoryMapper.updateById(wechatPaymentHistory);
}
/**
*
*
* @param id
* @return
*/
public int deleteById(Long id) {
return wechatPaymentHistoryMapper.deleteById(id);
}
}

@ -195,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="selectOrderDetail" resultType="com.cyl.h5.pojo.vo.H5OrderVO"> <select id="selectOrderDetail" resultType="com.cyl.h5.pojo.vo.H5OrderVO">
select select
id orderId, id orderId,
pay_id,
order_sn, order_sn,
member_id, member_id,
total_amount, total_amount,

@ -0,0 +1,51 @@
<?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.cyl.manager.oms.mapper.WechatPaymentHistoryMapper">
<resultMap type="WechatPaymentHistory" id="OmsWechatPaymentHistoryResult">
<result property="id" column="id"/>
<result property="paymentId" column="payment_id"/>
<result property="memberId" column="member_id"/>
<result property="openid" column="openid"/>
<result property="realName" column="real_name"/>
<result property="title" column="title"/>
<result property="orderId" column="order_id"/>
<result property="money" column="money"/>
<result property="opType" column="op_type"/>
<result property="paymentStatus" column="payment_status"/>
<result property="remark" column="remark"/>
<result property="attach" column="attach"/>
<result property="responseBody" column="response_body"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time"/>
<result property="createBy" column="create_by"/>
<result property="createTime" column="create_time"/>
<result property="updateBy" column="update_by"/>
<result property="updateTime" column="update_time" />
</resultMap>
<sql id="selectOmsWechatPaymentHistoryVo">
select id, payment_id, member_id, openid, real_name, title, order_id, money, op_type, payment_status, remark, attach, response_body, create_by, create_time, update_by, update_time from oms_wechat_payment_history
</sql>
<select id="selectByEntity" parameterType="WechatPaymentHistory" resultMap="OmsWechatPaymentHistoryResult">
<include refid="selectOmsWechatPaymentHistoryVo"/>
<where>
<if test="paymentId != null and paymentId != ''"> and payment_id = #{paymentId}</if>
<if test="memberId != null "> and member_id = #{memberId}</if>
<if test="openid != null and openid != ''"> and openid = #{openid}</if>
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="orderId != null "> and order_id = #{orderId}</if>
<if test="money != null "> and money = #{money}</if>
<if test="opType != null "> and op_type = #{opType}</if>
<if test="paymentStatus != null "> and payment_status = #{paymentStatus}</if>
<if test="attach != null and attach != ''"> and attach = #{attach}</if>
<if test="responseBody != null and responseBody != ''"> and response_body = #{responseBody}</if>
</where>
</select>
</mapper>

@ -0,0 +1,22 @@
-- 菜单 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表', '3', '1', 'wechatPaymentHistory', 'pms/wechatPaymentHistory/index', 1, 0, 'C', '0', '0', 'pms:wechatPaymentHistory:list', '#', 1, sysdate(), '', null, '微信订单表菜单');
-- 按钮父菜单ID
SELECT @parentId := LAST_INSERT_ID();
-- 按钮 SQL
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表查询', @parentId, '1', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:query', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表新增', @parentId, '2', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:add', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表修改', @parentId, '3', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:edit', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表删除', @parentId, '4', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:remove', '#', 1, sysdate(), '', null, '');
insert into sys_menu (menu_name, parent_id, order_num, path, component, is_frame, is_cache, menu_type, visible, status, perms, icon, create_by, create_time, update_by, update_time, remark)
values('微信订单表导出', @parentId, '5', '#', '', 1, 0, 'F', '0', '0', 'pms:wechatPaymentHistory:export', '#', 1, sysdate(), '', null, '');
Loading…
Cancel
Save