微信支付回调
This commit is contained in:
parent
c18adab76e
commit
931545c1d5
|
|
@ -128,7 +128,7 @@ gen:
|
|||
# 作者
|
||||
author: zhujj
|
||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||
packageName: com.ruoyi.exam
|
||||
packageName: com.ruoyi.vip
|
||||
# 自动去除表前缀,默认是true
|
||||
autoRemovePre: false
|
||||
# 表前缀(类名不会包含表前缀)
|
||||
|
|
|
|||
|
|
@ -33,5 +33,16 @@
|
|||
<artifactId>ruoyi-exam</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-vip</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-weixin</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,132 @@
|
|||
package com.ruoyi.cms.controller;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxScanPayNotifyResult;
|
||||
import com.github.binarywang.wxpay.bean.request.WxPayUnifiedOrderRequest;
|
||||
import com.github.binarywang.wxpay.bean.result.WxPayUnifiedOrderResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.IpUtils;
|
||||
import com.ruoyi.framework.jwt.JwtUtil;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.util.ServletUtils;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
import com.ruoyi.system.domain.SysUser;
|
||||
import com.ruoyi.system.service.ISysUserService;
|
||||
import com.ruoyi.train.course.domain.*;
|
||||
import com.ruoyi.train.course.service.ITrainCourseCategoryService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseSectionService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseService;
|
||||
import com.ruoyi.train.course.service.ITrainCourseUserService;
|
||||
import com.ruoyi.vip.domain.VipUserOrders;
|
||||
import com.ruoyi.vip.service.IVipUserOrdersService;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 课程 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2018-12-23
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/api/v1/wx/pay")
|
||||
public class ApiWxPayController extends BaseController {
|
||||
@Autowired
|
||||
private ITrainCourseUserService trainCourseUserService ;
|
||||
|
||||
@Autowired
|
||||
private IVipUserOrdersService vipUserOrdersService;
|
||||
|
||||
@Autowired
|
||||
private WxPayService wxService;
|
||||
@PostMapping("/notify/order")
|
||||
public String parseOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||
final WxPayOrderNotifyResult notifyResult = this.wxService.parseOrderNotifyResult(xmlData);
|
||||
if (null != notifyResult && notifyResult.getReturnCode().equals("SUCCESS")) {
|
||||
VipUserOrders userOrders = new VipUserOrders();
|
||||
userOrders.setId(notifyResult.getOutTradeNo());
|
||||
userOrders.setDelFlag("1");
|
||||
vipUserOrdersService.updateSelectiveById(userOrders);
|
||||
VipUserOrders vipUserOrders = vipUserOrdersService.selectById(notifyResult.getOutTradeNo());
|
||||
TrainCourseUser courseUser = new TrainCourseUser();
|
||||
courseUser.setVipUserId(vipUserOrders.getVipUserId());
|
||||
courseUser.setTrainCourseId(vipUserOrders.getTrainCourseId());
|
||||
trainCourseUserService.insert(courseUser);
|
||||
}
|
||||
return WxPayNotifyResponse.success("成功");
|
||||
}
|
||||
|
||||
@ApiOperation(value = "扫码支付回调通知处理")
|
||||
@PostMapping("/notify/scanpay")
|
||||
public String parseScanPayNotifyResult(String xmlData) throws WxPayException {
|
||||
final WxScanPayNotifyResult result = this.wxService.parseScanPayNotifyResult(xmlData);
|
||||
|
||||
// TODO 根据自己业务场景需要构造返回对象
|
||||
return WxPayNotifyResponse.success("成功");
|
||||
}
|
||||
/**
|
||||
* 调用统一下单接口,并组装生成支付所需参数对象.
|
||||
*
|
||||
* @param request 统一下单请求参数
|
||||
* @param <T> 请使用{@link com.github.binarywang.wxpay.bean.order}包下的类
|
||||
* @return 返回 {@link com.github.binarywang.wxpay.bean.order}包下的类对象
|
||||
*
|
||||
* 示例参数
|
||||
* {
|
||||
"body":"测试商品",
|
||||
"outTradeNo":"12344324242342342342554",
|
||||
"totalFee":1.01,
|
||||
"spbillCreateIp":"1.80.82.241",
|
||||
"notifyUrl":"http://www.baidu.com",
|
||||
"tradeType":"NATIVE",
|
||||
"productId":"13652b4a71df2f49e3647c55c8e31a88"
|
||||
}
|
||||
返回
|
||||
{
|
||||
"codeUrl": "weixin://wxpay/bizpayurl?pr=pK0R74G"
|
||||
}
|
||||
*/
|
||||
@ApiOperation(value = "统一下单,并组装所需支付参数")
|
||||
@PostMapping("/createOrder")
|
||||
public <T> T createOrder(@RequestBody WxPayUnifiedOrderRequest request) throws WxPayException {
|
||||
request.setOutTradeNo( IdUtil.simpleUUID());
|
||||
request.setSpbillCreateIp( IpUtils.getIpAddr( ServletUtils.getRequest()));
|
||||
VipUserOrders userOrders = new VipUserOrders();
|
||||
userOrders.setId(request.getOutTradeNo());
|
||||
userOrders.setVipUserId(ShiroUtils.getUserId().intValue());
|
||||
userOrders.setTrainCourseId(Integer.parseInt(request.getProductId()));
|
||||
//未支付订单
|
||||
userOrders.setDelFlag("0");
|
||||
vipUserOrdersService.insert(userOrders);
|
||||
return this.wxService.createOrder(request);
|
||||
}
|
||||
|
||||
/**
|
||||
* 统一下单(详见https://pay.weixin.qq.com/wiki/doc/api/jsapi.php?chapter=9_1)
|
||||
* 在发起微信支付前,需要调用统一下单接口,获取"预支付交易会话标识"
|
||||
* 接口地址:https://api.mch.weixin.qq.com/pay/unifiedorder
|
||||
*
|
||||
* @param request 请求对象,注意一些参数如appid、mchid等不用设置,方法内会自动从配置对象中获取到(前提是对应配置中已经设置)
|
||||
*/
|
||||
@ApiOperation(value = "原生的统一下单接口")
|
||||
@PostMapping("/unifiedOrder")
|
||||
public WxPayUnifiedOrderResult unifiedOrder(@RequestBody WxPayUnifiedOrderRequest request) throws WxPayException {
|
||||
request.setOutTradeNo( IdUtil.simpleUUID());
|
||||
request.setSpbillCreateIp( IpUtils.getIpAddr( ServletUtils.getRequest()));
|
||||
VipUserOrders userOrders = new VipUserOrders();
|
||||
userOrders.setId(request.getOutTradeNo());
|
||||
userOrders.setVipUserId(ShiroUtils.getUserId().intValue());
|
||||
userOrders.setTrainCourseId(Integer.parseInt(request.getProductId()));
|
||||
//未支付订单
|
||||
userOrders.setDelFlag("0");
|
||||
vipUserOrdersService.insert(userOrders);
|
||||
return this.wxService.unifiedOrder(request);
|
||||
}
|
||||
}
|
||||
|
|
@ -30,11 +30,6 @@
|
|||
<artifactId>ruoyi-framework</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ruoyi</groupId>
|
||||
<artifactId>ruoyi-weixin</artifactId>
|
||||
<version>${ruoyi.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>aliyun-java-sdk-core</artifactId>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,6 @@
|
|||
package com.ruoyi.train.course.controller;
|
||||
|
||||
import cn.hutool.json.JSONObject;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayNotifyResponse;
|
||||
import com.github.binarywang.wxpay.bean.notify.WxPayOrderNotifyResult;
|
||||
import com.github.binarywang.wxpay.exception.WxPayException;
|
||||
import com.github.binarywang.wxpay.service.WxPayService;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.framework.jwt.JwtUtil;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
|
|
@ -109,16 +105,5 @@ public class ApiTrainCourseController extends BaseController {
|
|||
success.put( "data", trainCourseSections );
|
||||
return success;
|
||||
}
|
||||
@Autowired
|
||||
private WxPayService wxService;
|
||||
@PostMapping("/notify/order")
|
||||
public AjaxResult parseOrderNotifyResult(@RequestBody String xmlData) throws WxPayException {
|
||||
final WxPayOrderNotifyResult notifyResult = this.wxService.parseOrderNotifyResult(xmlData);
|
||||
TrainCourseUser courseUser = new TrainCourseUser();
|
||||
courseUser.setVipUserId( ShiroUtils.getUserId().intValue() );
|
||||
|
||||
trainCourseUserService.insert(courseUser);
|
||||
// TODO 根据自己业务场景需要构造返回对象
|
||||
return AjaxResult.success("成功");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -115,7 +115,7 @@ public class TrainCourseController extends BaseController
|
|||
@ResponseBody
|
||||
public AjaxResult editSave(TrainCourse trainCourse)
|
||||
{
|
||||
return toAjax(trainCourseService.updateById(trainCourse));
|
||||
return toAjax(trainCourseService.updateSelectiveById(trainCourse));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -0,0 +1,126 @@
|
|||
package com.ruoyi.vip.controller;
|
||||
|
||||
import java.util.List;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.vip.domain.VipUserOrders;
|
||||
import com.ruoyi.vip.service.IVipUserOrdersService;
|
||||
import com.ruoyi.framework.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.common.base.AjaxResult;
|
||||
import com.ruoyi.common.utils.ExcelUtil;
|
||||
|
||||
/**
|
||||
* 我的订单 信息操作处理
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-25
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/vip/vipUserOrders")
|
||||
public class VipUserOrdersController extends BaseController
|
||||
{
|
||||
private String prefix = "vip/vipUserOrders";
|
||||
|
||||
@Autowired
|
||||
private IVipUserOrdersService vipUserOrdersService;
|
||||
|
||||
@RequiresPermissions("vip:vipUserOrders:view")
|
||||
@GetMapping()
|
||||
public String vipUserOrders()
|
||||
{
|
||||
return prefix + "/vipUserOrders";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的订单列表
|
||||
*/
|
||||
@RequiresPermissions("vip:vipUserOrders:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(VipUserOrders vipUserOrders)
|
||||
{
|
||||
List<VipUserOrders> list = vipUserOrdersService.selectVipUserOrdersPage(vipUserOrders);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 导出我的订单列表
|
||||
*/
|
||||
@RequiresPermissions("vip:vipUserOrders:export")
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(VipUserOrders vipUserOrders)
|
||||
{
|
||||
List<VipUserOrders> list = vipUserOrdersService.selectVipUserOrdersList(vipUserOrders);
|
||||
ExcelUtil<VipUserOrders> util = new ExcelUtil<VipUserOrders>(VipUserOrders.class);
|
||||
return util.exportExcel(list, "vipUserOrders");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增我的订单
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add()
|
||||
{
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存我的订单
|
||||
*/
|
||||
@RequiresPermissions("vip:vipUserOrders:add")
|
||||
@Log(title = "我的订单", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(VipUserOrders vipUserOrders)
|
||||
{
|
||||
return toAjax(vipUserOrdersService.insert(vipUserOrders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改我的订单
|
||||
*/
|
||||
@GetMapping("/edit/{id}")
|
||||
public String edit(@PathVariable("id") String id, ModelMap mmap)
|
||||
{
|
||||
VipUserOrders vipUserOrders = vipUserOrdersService.selectById(id);
|
||||
mmap.put("vipUserOrders", vipUserOrders);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存我的订单
|
||||
*/
|
||||
@RequiresPermissions("vip:vipUserOrders:edit")
|
||||
@Log(title = "我的订单", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(VipUserOrders vipUserOrders)
|
||||
{
|
||||
return toAjax(vipUserOrdersService.updateById(vipUserOrders));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除我的订单
|
||||
*/
|
||||
@RequiresPermissions("vip:vipUserOrders:remove")
|
||||
@Log(title = "我的订单", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(vipUserOrdersService.deleteByIds(ids));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,167 @@
|
|||
package com.ruoyi.vip.domain;
|
||||
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.ruoyi.common.base.BaseEntity;
|
||||
import javax.persistence.Id;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 我的订单表 vip_user_orders
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-25
|
||||
*/
|
||||
public class VipUserOrders
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 订单号 */
|
||||
@Id
|
||||
private String id;
|
||||
/** 会员代码 */
|
||||
private Integer vipUserId;
|
||||
/** 练习题代码 */
|
||||
private Integer trainCourseId;
|
||||
/** 支付金额 */
|
||||
private BigDecimal price;
|
||||
/** 创建者 */
|
||||
private String createBy;
|
||||
/** 创建时间 */
|
||||
private Date createDate;
|
||||
/** 更新者 */
|
||||
private String updateBy;
|
||||
/** 更新时间 */
|
||||
private Date updateDate;
|
||||
/** 备注信息 */
|
||||
private String remarks;
|
||||
/** 订单状态(0-默认,未支付 1-已支付) */
|
||||
private String delFlag;
|
||||
|
||||
/** 设置订单号 */
|
||||
public void setId(String id)
|
||||
{
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
/** 获取订单号 */
|
||||
public String getId()
|
||||
{
|
||||
return id;
|
||||
}
|
||||
/** 设置会员代码 */
|
||||
public void setVipUserId(Integer vipUserId)
|
||||
{
|
||||
this.vipUserId = vipUserId;
|
||||
}
|
||||
|
||||
/** 获取会员代码 */
|
||||
public Integer getVipUserId()
|
||||
{
|
||||
return vipUserId;
|
||||
}
|
||||
/** 设置练习题代码 */
|
||||
public void setTrainCourseId(Integer trainCourseId)
|
||||
{
|
||||
this.trainCourseId = trainCourseId;
|
||||
}
|
||||
|
||||
/** 获取练习题代码 */
|
||||
public Integer getTrainCourseId()
|
||||
{
|
||||
return trainCourseId;
|
||||
}
|
||||
/** 设置支付金额 */
|
||||
public void setPrice(BigDecimal price)
|
||||
{
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
/** 获取支付金额 */
|
||||
public BigDecimal getPrice()
|
||||
{
|
||||
return price;
|
||||
}
|
||||
/** 设置创建者 */
|
||||
public void setCreateBy(String createBy)
|
||||
{
|
||||
this.createBy = createBy;
|
||||
}
|
||||
|
||||
/** 获取创建者 */
|
||||
public String getCreateBy()
|
||||
{
|
||||
return createBy;
|
||||
}
|
||||
/** 设置创建时间 */
|
||||
public void setCreateDate(Date createDate)
|
||||
{
|
||||
this.createDate = createDate;
|
||||
}
|
||||
|
||||
/** 获取创建时间 */
|
||||
public Date getCreateDate()
|
||||
{
|
||||
return createDate;
|
||||
}
|
||||
/** 设置更新者 */
|
||||
public void setUpdateBy(String updateBy)
|
||||
{
|
||||
this.updateBy = updateBy;
|
||||
}
|
||||
|
||||
/** 获取更新者 */
|
||||
public String getUpdateBy()
|
||||
{
|
||||
return updateBy;
|
||||
}
|
||||
/** 设置更新时间 */
|
||||
public void setUpdateDate(Date updateDate)
|
||||
{
|
||||
this.updateDate = updateDate;
|
||||
}
|
||||
|
||||
/** 获取更新时间 */
|
||||
public Date getUpdateDate()
|
||||
{
|
||||
return updateDate;
|
||||
}
|
||||
/** 设置备注信息 */
|
||||
public void setRemarks(String remarks)
|
||||
{
|
||||
this.remarks = remarks;
|
||||
}
|
||||
|
||||
/** 获取备注信息 */
|
||||
public String getRemarks()
|
||||
{
|
||||
return remarks;
|
||||
}
|
||||
/** 设置订单状态(0-默认,未支付 1-已支付) */
|
||||
public void setDelFlag(String delFlag)
|
||||
{
|
||||
this.delFlag = delFlag;
|
||||
}
|
||||
|
||||
/** 获取订单状态(0-默认,未支付 1-已支付) */
|
||||
public String getDelFlag()
|
||||
{
|
||||
return delFlag;
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("id", getId())
|
||||
.append("vipUserId", getVipUserId())
|
||||
.append("trainCourseId", getTrainCourseId())
|
||||
.append("price", getPrice())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createDate", getCreateDate())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateDate", getUpdateDate())
|
||||
.append("remarks", getRemarks())
|
||||
.append("delFlag", getDelFlag())
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
package com.ruoyi.vip.mapper;
|
||||
|
||||
import com.ruoyi.vip.domain.VipUserOrders;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.MyMapper;
|
||||
|
||||
/**
|
||||
* 我的订单 数据层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-25
|
||||
*/
|
||||
public interface VipUserOrdersMapper extends MyMapper<VipUserOrders>
|
||||
{
|
||||
|
||||
/**
|
||||
* 查询我的订单列表
|
||||
*
|
||||
* @param vipUserOrders 我的订单信息
|
||||
* @return 我的订单集合
|
||||
*/
|
||||
public List<VipUserOrders> selectVipUserOrdersList(VipUserOrders vipUserOrders);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,30 @@
|
|||
package com.ruoyi.vip.service;
|
||||
|
||||
import com.ruoyi.vip.domain.VipUserOrders;
|
||||
import java.util.List;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||
/**
|
||||
* 我的订单 服务层
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-25
|
||||
*/
|
||||
public interface IVipUserOrdersService extends AbstractBaseService<VipUserOrders>
|
||||
{
|
||||
/**
|
||||
* 查询我的订单分页列表
|
||||
*
|
||||
* @param vipUserOrders 我的订单信息
|
||||
* @return 我的订单集合
|
||||
*/
|
||||
public List<VipUserOrders> selectVipUserOrdersPage(VipUserOrders vipUserOrders);
|
||||
/**
|
||||
* 查询我的订单列表
|
||||
*
|
||||
* @param vipUserOrders 我的订单信息
|
||||
* @return 我的订单集合
|
||||
*/
|
||||
public List<VipUserOrders> selectVipUserOrdersList(VipUserOrders vipUserOrders);
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
package com.ruoyi.vip.service.impl;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.ruoyi.vip.mapper.VipUserOrdersMapper;
|
||||
import com.ruoyi.vip.domain.VipUserOrders;
|
||||
import com.ruoyi.vip.service.IVipUserOrdersService;
|
||||
import com.ruoyi.common.support.Convert;
|
||||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 我的订单 服务层实现
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-25
|
||||
*/
|
||||
@Service
|
||||
public class VipUserOrdersServiceImpl extends AbstractBaseServiceImpl<VipUserOrdersMapper,VipUserOrders> implements IVipUserOrdersService
|
||||
{
|
||||
@Autowired
|
||||
private VipUserOrdersMapper vipUserOrdersMapper;
|
||||
|
||||
|
||||
/**
|
||||
* 查询我的订单列表
|
||||
*
|
||||
* @param vipUserOrders 我的订单信息
|
||||
* @return 我的订单集合
|
||||
*/
|
||||
@Override
|
||||
public List<VipUserOrders> selectVipUserOrdersList(VipUserOrders vipUserOrders)
|
||||
{
|
||||
return vipUserOrdersMapper.selectVipUserOrdersList(vipUserOrders);
|
||||
}
|
||||
/**
|
||||
* 查询我的订单分页列表
|
||||
*
|
||||
* @param vipUserOrders 我的订单信息
|
||||
* @return 我的订单集合
|
||||
*/
|
||||
@Override
|
||||
public List<VipUserOrders> selectVipUserOrdersPage(VipUserOrders vipUserOrders)
|
||||
{
|
||||
startPage();
|
||||
return vipUserOrdersMapper.selectVipUserOrdersList(vipUserOrders);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,42 @@
|
|||
<?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.vip.mapper.VipUserOrdersMapper">
|
||||
|
||||
<resultMap type="VipUserOrders" id="VipUserOrdersResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="vipUserId" column="vip_user_id" />
|
||||
<result property="trainCourseId" column="train_course_id" />
|
||||
<result property="price" column="price" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createDate" column="create_date" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="updateDate" column="update_date" />
|
||||
<result property="remarks" column="remarks" />
|
||||
<result property="delFlag" column="del_flag" />
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectVipUserOrdersVo">
|
||||
id, vip_user_id, train_course_id, price, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||
|
||||
<select id="selectVipUserOrdersList" parameterType="VipUserOrders" resultMap="VipUserOrdersResult">
|
||||
select
|
||||
<include refid="selectVipUserOrdersVo"/>
|
||||
from vip_user_orders
|
||||
<where>
|
||||
<if test="id != null and id != '' "> and id = #{id}</if>
|
||||
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
||||
<if test="trainCourseId != null "> and train_course_id = #{trainCourseId}</if>
|
||||
<if test="price != null "> and price = #{price}</if>
|
||||
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -0,0 +1,82 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-vipUserOrders-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">会员代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="vipUserId" name="vipUserId" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习题代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="trainCourseId" name="trainCourseId" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付金额:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="price" name="price" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建者:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="createBy" name="createBy" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="createDate" name="createDate" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">更新者:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="updateBy" name="updateBy" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">更新时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="updateDate" name="updateDate" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订单状态(0-默认,未支付 1-已支付):</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="delFlag" name="delFlag" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "vip/vipUserOrders"
|
||||
$("#form-vipUserOrders-add").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-vipUserOrders-add').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,83 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-vipUserOrders-edit" th:object="${vipUserOrders}">
|
||||
<input id="id" name="id" th:field="*{id}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">会员代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="vipUserId" name="vipUserId" th:field="*{vipUserId}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">练习题代码:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="trainCourseId" name="trainCourseId" th:field="*{trainCourseId}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">支付金额:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="price" name="price" th:field="*{price}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建者:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="createBy" name="createBy" th:field="*{createBy}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">创建时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="createDate" name="createDate" th:field="*{createDate}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">更新者:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="updateBy" name="updateBy" th:field="*{updateBy}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">更新时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="updateDate" name="updateDate" th:field="*{updateDate}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="remarks" name="remarks" th:field="*{remarks}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">订单状态(0-默认,未支付 1-已支付):</label>
|
||||
<div class="col-sm-8">
|
||||
<input id="delFlag" name="delFlag" th:field="*{delFlag}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<div th:include="include::footer"></div>
|
||||
<script type="text/javascript">
|
||||
var prefix = ctx + "vip/vipUserOrders"
|
||||
$("#form-vipUserOrders-edit").validate({
|
||||
rules:{
|
||||
xxxx:{
|
||||
required:true,
|
||||
},
|
||||
}
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-vipUserOrders-edit').serialize());
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,161 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<meta charset="utf-8">
|
||||
<head th:include="include :: header"></head>
|
||||
<body class="gray-bg">
|
||||
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
会员代码:<input type="text" name="vipUserId"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
练习题代码:<input type="text" name="trainCourseId"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
支付金额:<input type="text" name="price"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
创建者:<input type="text" name="createBy"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
创建时间:<input type="text" name="createDate"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
更新者:<input type="text" name="updateBy"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
更新时间:<input type="text" name="updateDate"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
备注信息:<input type="text" name="remarks"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
订单状态(0-默认,未支付 1-已支付):<input type="text" name="delFlag"/>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm hidden-xs" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="vip:vipUserOrders:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary btn-edit disabled" onclick="$.operate.edit()" shiro:hasPermission="vip:vipUserOrders:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger btn-del btn-del disabled" onclick="$.operate.removeAll()" shiro:hasPermission="vip:vipUserOrders:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="vip:vipUserOrders:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table" data-mobile-responsive="true"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div th:include="include :: footer"></div>
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('vip:vipUserOrders:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('vip:vipUserOrders:remove')}]];
|
||||
var prefix = ctx + "vip/vipUserOrders";
|
||||
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "我的订单",
|
||||
search: false,
|
||||
showExport: true,
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field : 'id',
|
||||
title : '订单号',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field : 'vipUserId',
|
||||
title : '会员代码',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'trainCourseId',
|
||||
title : '练习题代码',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'price',
|
||||
title : '支付金额',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'createBy',
|
||||
title : '创建者',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'createDate',
|
||||
title : '创建时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'updateBy',
|
||||
title : '更新者',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'updateDate',
|
||||
title : '更新时间',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'remarks',
|
||||
title : '备注信息',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
field : 'delFlag',
|
||||
title : '订单状态(0-默认,未支付 1-已支付)',
|
||||
sortable: true
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue