diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/controller/WechatPaymentHistoryController.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/controller/WechatPaymentHistoryController.java new file mode 100644 index 0000000..e1736a2 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/controller/WechatPaymentHistoryController.java @@ -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> list(@RequestBody WechatPaymentHistoryQuery query, Pageable page) { + List 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 export(WechatPaymentHistoryQuery query) { + List list = service.selectList(query, null); + ExcelUtil 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 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 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 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 remove(@PathVariable Long id) { + return ResponseEntity.ok(service.deleteById(id)); + } +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/convert/WechatPaymentHistoryConvert.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/convert/WechatPaymentHistoryConvert.java new file mode 100644 index 0000000..c4ca162 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/convert/WechatPaymentHistoryConvert.java @@ -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 dos2vos(List list); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/domain/WechatPaymentHistory.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/domain/WechatPaymentHistory.java new file mode 100644 index 0000000..2327111 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/domain/WechatPaymentHistory.java @@ -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; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/mapper/WechatPaymentHistoryMapper.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/mapper/WechatPaymentHistoryMapper.java new file mode 100644 index 0000000..a19b030 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/mapper/WechatPaymentHistoryMapper.java @@ -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 { + /** + * 查询微信订单表列表 + * + * @param wechatPaymentHistory 微信订单表 + * @return 微信订单表集合 + */ + List selectByEntity(WechatPaymentHistory wechatPaymentHistory); +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/query/WechatPaymentHistoryQuery.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/query/WechatPaymentHistoryQuery.java new file mode 100644 index 0000000..ec63ab8 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/query/WechatPaymentHistoryQuery.java @@ -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; + +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/vo/WechatPaymentHistoryVO.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/vo/WechatPaymentHistoryVO.java new file mode 100644 index 0000000..349faf1 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/pojo/vo/WechatPaymentHistoryVO.java @@ -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; +} diff --git a/ruoyi-mall/src/main/java/com/cyl/manager/oms/service/WechatPaymentHistoryService.java b/ruoyi-mall/src/main/java/com/cyl/manager/oms/service/WechatPaymentHistoryService.java new file mode 100644 index 0000000..feb50b5 --- /dev/null +++ b/ruoyi-mall/src/main/java/com/cyl/manager/oms/service/WechatPaymentHistoryService.java @@ -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 selectList(WechatPaymentHistoryQuery query, Pageable page) { + if (page != null) { + PageHelper.startPage(page.getPageNumber() + 1, page.getPageSize()); + } + QueryWrapper 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); + } +} diff --git a/ruoyi-mall/src/main/resources/mapper/oms/OrderMapper.xml b/ruoyi-mall/src/main/resources/mapper/oms/OrderMapper.xml index 1aaf003..055d864 100644 --- a/ruoyi-mall/src/main/resources/mapper/oms/OrderMapper.xml +++ b/ruoyi-mall/src/main/resources/mapper/oms/OrderMapper.xml @@ -195,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + + + and payment_id = #{paymentId} + and member_id = #{memberId} + and openid = #{openid} + and real_name like concat('%', #{realName}, '%') + and title = #{title} + and order_id = #{orderId} + and money = #{money} + and op_type = #{opType} + and payment_status = #{paymentStatus} + and attach = #{attach} + and response_body = #{responseBody} + + + diff --git a/sql/pms/omsWechatPaymentHistory.sql b/sql/pms/omsWechatPaymentHistory.sql new file mode 100644 index 0000000..7c312be --- /dev/null +++ b/sql/pms/omsWechatPaymentHistory.sql @@ -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, '');