Commit 851aaae7 authored by wangjinjing's avatar wangjinjing

init

parent 6462a1a1
# Compiled class file
*.class
# Log file
*.log
# BlueJ files
*.ctxt
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.example</groupId>
<artifactId>videoai</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>videoai</name>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!--<dependency>-->
<!--<groupId>org.mybatis.spring.boot</groupId>-->
<!--<artifactId>mybatis-spring-boot-starter</artifactId>-->
<!--<version>2.1.4</version>-->
<!--</dependency>-->
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alipay.sdk</groupId>
<artifactId>alipay-sdk-java</artifactId>
<version>4.19.0.ALL</version>
</dependency>
<!-- 支持Thymeleaf的非严格语法的第三方插件 -->
<!-- https://mvnrepository.com/artifact/net.sourceforge.nekohtml/nekohtml -->
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/druid-spring-boot-starter -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid-spring-boot-starter</artifactId>
<version>1.2.6</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.2.12</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>xml-apis</groupId>
<artifactId>xml-apis</artifactId>
<version>1.4.01</version>
</dependency>
</dependencies>
<build>
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*</include>
</includes>
</resource>
</resources>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
package com.video.ai;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringVideoAIApplication {
public static void main(String[] args) {
SpringApplication.run(SpringVideoAIApplication.class, args);
}
}
package com.video.ai.config;
import com.alibaba.druid.pool.DruidDataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;
import javax.sql.DataSource;
/*
使用 @Configuration 表明这是一个配置文件 等价于加载了一个 xml 的配置文件
一般使用spring的依赖注入,向spring容器注入一个配置实体类bean对象;
一般在配置类中会使用 @Bean注解,向spring容器注入实体类
另外,可以使用 @value 给配置类的一些属性变量注入初始化值;
注入的值直接使用类似于 ${属性名} 的方法加载配置文件的指定属性名的属性值
*/
@Configuration
public class DruidDataSourceConfiguration {
@Bean // 表示该方法的返回值会作为 spring 容器中的一个 bean 进行管理
@Primary // 如果存在类型相同的数据源对象,则优先使用本 springbean
@ConfigurationProperties(prefix = "spring.datasource") // 自动读取springboot框架的application.properties文件中的配置信息的值
// 要求指定前缀
public DataSource initDruidDataSource() {
return new DruidDataSource();
}
}
package com.video.ai.controller;
import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradeCloseRequest;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.alipay.api.request.AlipayTradeQueryRequest;
import com.github.pagehelper.PageInfo;
import com.video.ai.domain.*;
import com.video.ai.service.OrdersService;
import com.video.ai.utils.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.UnsupportedEncodingException;
import java.util.Date;
import java.util.List;
import java.util.Map;
@Controller
@RequestMapping("/alipay/trade")
public class AliPayController {
private static final Logger log = LoggerFactory.getLogger(AliPayController.class);
@Autowired
OrdersService service;
@Value("${alipay.return_url}")
private String return_url;
@Value("${alipay.notify_url}")
private String notify_url;
@Value("${alipay.pay_url}")
private String payurl;
@RequestMapping("/page/pay")
public void Pagepay(AliPayModel form, HttpServletRequest request, HttpServletResponse response) {
//获得初始化的AlipayClient
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
String id=UUIdUtils.createuuid();
//设置请求参数
AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
alipayRequest.setReturnUrl(return_url);
alipayRequest.setNotifyUrl(notify_url);
form.setProduct_code("FAST_INSTANT_TRADE_PAY");
form.setOut_trade_no(id);
alipayRequest.setBizContent(JsonUtil.objToStr(form));
//若想给BizContent增加其他可选请求参数,以增加自定义超时时间参数timeout_express来举例说明
//alipayRequest.setBizContent("{\"out_trade_no\":\""+ out_trade_no +"\","
// + "\"total_amount\":\""+ total_amount +"\","
// + "\"subject\":\""+ subject +"\","
// + "\"body\":\""+ body +"\","
// + "\"timeout_express\":\"10m\","
// + "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");
//请求参数可查阅【电脑网站支付的API文档-alipay.trade.page.pay-请求参数】章节
String result ="";
//请求
try {
result = alipayClient.pageExecute(alipayRequest).getBody();
//将订单新增到表中,状态为待支付
Orders order=new Orders();
order.setOrderNum(id);
order.setSubject(form.getSubject());
order.setOrderAmount(form.getTotal_amount());
order.setOrderStatus("10");
order.setBuyCounts(1);
order.setCreateTime(DateUtils.getTime());
order.setBz(form.getBody());
order.setPayurl(result);
service.add(order);
}catch (AlipayApiException e) {
log.error("page/pay->AlipayApiException:{}",e);
if(e.getCause() instanceof java.security.spec.InvalidKeySpecException){
result="商户私钥格式不正确,请确认配置文件Alipay-Config.properties中是否配置正确";
ResponseUtil.ResponseStr(response, result);
}
}
ResponseUtil.ResponseStr(response, "<div style='height:60px;line-height: 60px;background: #019fe9;text-align: center;color: #ffffff;font-size: 25px;'>支付平台</div>" +
"<div style='height:calc(100% - 60px);width:100%;'>" +
"<div style='height:210px;width:100%;color:red;text-align:center; line-height: 200px;font-size: 20px;font-weight: 600;color: #019fe9;'>" +
"请将如下地址复制给第三方,第三方通过浏览器打开!</div>" +
"\n" +
"<div style=\"text-align: center;color: #019fe9;\" >\n" +
"<p id=\"text\">"+payurl+"?payOrderId="+id+"</p></div>\n" +
"<button onclick=\"copyText()\" style=\"color: #e9f5fa; background-color: #019fe9; float: right; margin-right:25%\">复制</button> \n" +
"<textarea id=\"input\" style='opacity: 0;position: absolute;'></textarea> \n" +
" <script type=\"text/javascript\">\n" +
" function copyText() {var text = document.getElementById(\"text\").innerText;\n" +
" var input = document.getElementById(\"input\"); input.value = text; input.select(); document.execCommand(\"copy\"); alert(\"复制成功\");\n" +
" } </script>");
}
/***
* 取消订单
* @param param
* @param response
*/
@RequestMapping("/close")
public void close(AliPayParam param, HttpServletResponse response) {
//获得初始化的AlipayClient
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
//设置请求参数
AlipayTradeCloseRequest alipayRequest = new AlipayTradeCloseRequest();
alipayRequest.setBizContent("{\"out_trade_no\":\""+ param.getOrder_num() +"\"," +"\"trade_no\":\""+ param.getTrade_no() +"\"}");
String result ="";
//请求
try {
result = alipayClient.execute(alipayRequest).getBody();
Orders order=new Orders();
order.setOrderNum(param.getOrder_num());
order.setOrderStatus("30");//取消清单
//更新订单状态
service.updateInfoByOrderNum(order);
} catch (AlipayApiException e) {
log.error("page/close->AlipayApiException:{}",e);
}
ResponseUtil.ResponseStr(response, result);
}
@RequestMapping("/query")
@ResponseBody
public PageResultBean<Orders> query(AliPayParam param) {
//查询表中数据,进行数据查询
List<Orders> orderlist= service.queryByParam(param);
PageInfo<Orders> rolePageInfo = new PageInfo<>(orderlist);
return new PageResultBean<Orders>(rolePageInfo.getTotal(), rolePageInfo.getList());
}
@RequestMapping("/queryPage")
@ResponseBody
public String queryPage(AliPayParam param) {
//获得初始化的AlipayClient
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key2, AlipayConfig.sign_type);
//设置请求参数
AlipayTradeQueryRequest alipayRequest = new AlipayTradeQueryRequest();
alipayRequest.setBizContent("{\"out_trade_no\":\""+ param.getOrder_num() +"\","+"\"trade_no\":\""+ param.getTrade_no() +"\"}");
String result ="";
//请求
try {
result = alipayClient.execute(alipayRequest).getBody();
Map resultmap= JsonUtil.strToObj(result, Map.class);
if(null!=resultmap.get("alipay_trade_query_response")) {
Map traderesult=(Map)resultmap.get("alipay_trade_query_response");
if (null != traderesult && null != traderesult.get("msg")) {
result = traderesult.get("msg").toString().equals("Success")?"success":String.valueOf(traderesult.get("sub_msg"));
}
}
} catch (AlipayApiException e) {
log.error("queryPage->AlipayApiException:{}",e);
}
return result;
}
}
package com.video.ai.controller;
import com.alipay.api.AlipayApiException;
import com.alipay.api.internal.util.AlipaySignature;
import com.video.ai.domain.Orders;
import com.video.ai.service.OrdersService;
import com.video.ai.utils.AlipayConfig;
import com.video.ai.utils.DateUtils;
import com.video.ai.utils.JsonUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@Controller
@RequestMapping("/alipay")
public class AlipayReturnController {
private static final Logger log = LoggerFactory.getLogger(AliPayController.class);
@Autowired
OrdersService service;
/***
* 同步推送订单消息
* @param request
* @param response
*/
@RequestMapping("/returnUrl")
public String return_url(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> params = getParamByRequest(request);
log.info("return_url:{}\n", JsonUtil.objToStr(params));
boolean signVerified = false;
try {
// String sign = (String)params.get("sign");
// log.info("sign:{}\n", sign);
// String content =AlipaySignature. getSignCheckContentV1(params);
// log.info("content:{}\n", content);
// signVerified = AlipaySignature.rsaCheck(content, sign, AlipayConfig.alipay_public_key2, AlipayConfig.charset, AlipayConfig.sign_type);
// log.info("signVerified:{}\n", signVerified);
//调用SDK验证签名
signVerified = AlipaySignature.rsaCheckV1(params, AlipayConfig.alipay_public_key2, AlipayConfig.charset, AlipayConfig.sign_type);
} catch (AlipayApiException e) {
e.printStackTrace();
}
if (signVerified) {
//商户订单号
String out_trade_no = request.getParameter("out_trade_no");
//支付宝交易号
String trade_no = request.getParameter("trade_no");
//根据订单编号更新表中的交易号,
Orders order=new Orders();
order.setOrderNum(out_trade_no);
order.setTradeNo(trade_no);
service.updateInfoByOrderNum(order);
} else {
log.error("验签失败");
}
return "success";
}
/**
* 支付宝订单异步消息同步
* @param request
*/
@RequestMapping("/notifyUrl")
public String notifyurl(HttpServletRequest request) {
Map<String, String> params = getParamByRequest(request);
log.info("异步 notifyurl: {}\n",JsonUtil.objToStr(params));
boolean signVerified = false; //调用SDK验证签名
//
// String sign = (String)params.get("sign");
// log.info("sign:{}\n", sign);
// String content =AlipaySignature. getSignCheckContentV1(params);
// log.info("content:{}\n", content);
try {
// signVerified = AlipaySignature.rsaCheck(content, sign, AlipayConfig.alipay_public_key2, AlipayConfig.charset, AlipayConfig.sign_type);
log.info("signVerified:{}\n", signVerified);
log.info("异步 alipay_public_key: {}",AlipayConfig.alipay_public_key2);
signVerified = AlipaySignature.rsaCheckV1(params, AlipayConfig.alipay_public_key2, AlipayConfig.charset,AlipayConfig.sign_type);
} catch (AlipayApiException e) {
log.error("调用SDK验证签名error:",e);
}
/* 实际验证过程建议商户务必添加以下校验:
1、需要验证该通知数据中的out_trade_no是否为商户系统中创建的订单号,
2、判断total_amount是否确实为该订单的实际金额(即商户订单创建时的金额),
3、校验通知中的seller_id(或者seller_email) 是否为out_trade_no这笔单据的对应的操作方(有的时候,一个商户可能有多个seller_id/seller_email)
4、验证app_id是否为该商户本身。
*/
//支付宝交易号
String trade_no=params.get("trade_no");
String out_trade_no =params.get("out_trade_no") ;//商户订单号
String paidtime=params.get("gmt_payment"); //交易状态
String trade_status = params.get("trade_status");
if(signVerified) {//验证成功
Orders order=new Orders();
order.setOrderNum(out_trade_no);
order.setTradeNo(trade_no);
order.setOrderStatus("20");//支付订单
order.setPaidAmount(params.get("receipt_amount"));
if(trade_status.equals("TRADE_FINISHED")){
//判断该笔订单是否在商户网站中已经做过处理
order.setFinishTime(paidtime==null?DateUtils.getTime():paidtime);
}else if (trade_status.equals("TRADE_SUCCESS")){
//此状态支付成功状态,但仍可退费等处理
order.setPaidTime(paidtime==null?DateUtils .getTime():paidtime);
}
else if (trade_status.equals("TRADE_CLOSED")){
order.setOrderStatus("30");//取消
log.info("异步 TRADE_CLOSED: {}",JsonUtil.objToStr(params));
//此状态支付成功状态,但仍可退费等处理
order.setPaidTime(paidtime==null?DateUtils .getTime():paidtime);
}
//更新订单状态
order.setGmtcreatetime(params.get("gmt_payment"));
service.updateInfoByOrderNum(order);
log.info("notifyurl success");
}else {
//验证失败
log.error("fail");
}
if (trade_status.equals("TRADE_CLOSED")) {
return "error";
}
else {
return "success";
}
}
private Map<String, String> getParamByRequest(HttpServletRequest request) {
Map<String, String> params = new HashMap<>();
Map requestParams = request.getParameterMap();
for (Iterator iter = requestParams.keySet().iterator(); iter.hasNext(); ) {
String name = (String) iter.next();
String[] values = (String[]) requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++) {
valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
}
params.put(name, valueStr);
}
return params;
}
}
package com.video.ai.controller;
import org.springframework.stereotype.Controller;
@Controller
public class FlowController {
}
package com.video.ai.controller;
import com.video.ai.domain.Orders;
import com.video.ai.service.OrdersService;
import com.video.ai.utils.ResponseUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletResponse;
@Controller
@RequestMapping("/")
public class IndexController {
private static final Logger log = LoggerFactory.getLogger(IndexController.class);
@Autowired
OrdersService service;
@RequestMapping("/")
public String index() {
return "index";
}
/***
* 查看订单详情页面
* @param payOrderId
* @param response
*/
@RequestMapping("/paymentPage")
public void paymentPage(@RequestParam(name = "payOrderId") String payOrderId, HttpServletResponse response) {
//查询订单详情
Orders order = service.findByOrdernum(payOrderId);
if (null == order) {
log.info("不存在订单号:{}的订单", payOrderId);
ResponseUtil.ResponseStr(response, "该订单不存在");
return;
}
StringBuffer result = new StringBuffer();
result.append("<div style=\"height:60px;line-height: 60px;background: #019fe9;text-align: center;color: #ffffff;font-size: 25px;\">支付平台</div>\n" +
"<div style=\"font-size: 18px; color: #535353; height: 300px;line-height: 50px; padding-top: 100px; letter-spacing: 4px;\">\n" +
" <table style=\"text-align: center; width: 40%; float: right; height: 180px; border: 1px solid #019fe9; margin-right: 30%;\">\n" +
" <tr>\n" +
" <td style=\"border: 1px solid #019fe9;\">订单名称:</td>\n" +
" <td style=\"border: 1px solid #019fe9; color: red\">" + order.getSubject() + "</td>\n" +
" </tr> <tr>\n" +
" <td style=\"border: 1px solid #019fe9;\">订单金额:</td>\n" +
" <td style=\"border: 1px solid #019fe9;color: red\">" + order.getOrderAmount() + " </td>\n" +
" </tr><tr>\n" +
" <td style=\"border: 1px solid #019fe9;\">订单描述:</td>\n" +
" <td style=\"border: 1px solid #019fe9;color: red\" >" + order.getBz()+ "</td>\n" +
" </tr>\n" +
" </table>\n" +
"</div>\n" +
"<div style=\"text-align: center;font-size: 18px;\" id=\"body\"></div>");
result.append(order.getPayurl().replace("document.forms[0].submit();", "function countSecond(){document.getElementById(\"body\").append('正在跳转到支付界面...');setTimeout('document.forms[0].submit()', 1000)}setTimeout(\"countSecond()\", 2000)"));
//将订单信息塞到新的 hmtl 中输出
ResponseUtil.ResponseStr(response, result.toString());
}
}
package com.video.ai.controller;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayTradePagePayRequest;
import com.video.ai.domain.Orders;
import com.video.ai.service.OrdersService;
import com.video.ai.utils.AlipayConfig;
import com.video.ai.utils.DateUtils;
import com.video.ai.utils.UUIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.Date;
@Controller
@RequestMapping("/orders")
public class OrdersController {
@Value("${alipay.return_url}")
private String return_url;
@Value("${alipay.notify_url}")
private String notify_url;
@Autowired
private OrdersService ordersService;
@RequestMapping("/add")
public String add(Orders orders, Model model) {
orders.setId(UUIdUtils.next());
orders.setOrderNum(UUIdUtils.next());
orders.setOrderStatus("10");
Integer singlePrice = Integer.parseInt(orders.getProduct().getPrice());
orders.setOrderAmount((singlePrice * orders.getBuyCounts()) + "");
orders.setCreateTime(DateUtils.getTime());
ordersService.add(orders);
model.addAttribute("orders", orders);
return "ordersInfo";
}
@ResponseBody
@RequestMapping("/goAlipay")
public String goAlipay(Orders orders, String ordersDesc) throws Exception {
orders = ordersService.findById(orders.getId());
AlipayClient alipayClient = new DefaultAlipayClient(AlipayConfig.gatewayUrl, AlipayConfig.app_id, AlipayConfig.merchant_private_key, "json", AlipayConfig.charset, AlipayConfig.alipay_public_key, AlipayConfig.sign_type);
AlipayTradePagePayRequest alipayRequest = new AlipayTradePagePayRequest();
alipayRequest.setReturnUrl(return_url);
alipayRequest.setNotifyUrl(notify_url);
//商户订单号,商户网站订单系统中唯一订单号,必填
String out_trade_no = orders.getOrderNum();
//付款金额,必填
String total_amount = orders.getOrderAmount();
//订单名称,必填
String subject = orders.getProduct().getName();
//商品描述,可空
//String body = ordersDesc == null ? "" : ordersDesc;
// 该笔订单允许的最晚付款时间,逾期将关闭交易。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的情况下,无论交易何时创建,都在0点关闭)。 该参数数值不接受小数点, 如 1.5h,可转换为 90m。
String timeout_express = "1c";
alipayRequest.setBizContent("{\"out_trade_no\":\""+ out_trade_no +"\","
+ "\"total_amount\":\""+ total_amount +"\","
+ "\"subject\":\""+ subject +"\","
//+ "\"body\":\""+ body +"\","
+ "\"timeout_express\":\""+ timeout_express +"\","
+ "\"product_code\":\"FAST_INSTANT_TRADE_PAY\"}");
//请求
String result = alipayClient.pageExecute(alipayRequest).getBody();
return result;
}
}
package com.video.ai.controller;
import com.video.ai.domain.Product;
import com.video.ai.service.ProductService;
import com.video.ai.utils.UUIdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.List;
@Controller
@RequestMapping("/product")
public class ProductController {
@Autowired
private ProductService productService;
/**
* 请求添加页面
* @return
*/
@RequestMapping("/addForm")
public String addForm() {
return "addProduct";
}
/**
* 添加商品方法
* @param product
* @return
*/
@ResponseBody
@RequestMapping("/add")
public Product add(Product product) {
product.setId(UUIdUtils.next());
productService.add(product);
return productService.findById(product.getId());
}
@ResponseBody
@RequestMapping("/findAll")
public List<Product> findAll() {
return productService.findAll();
}
@RequestMapping("/list")
public String list(Model model) {
List<Product> list = productService.findAll();
model.addAttribute("list", list);
return "productList";
}
@RequestMapping("/purchase")
public String purchase(String id, Model model) {
Product product = productService.findById(id);
model.addAttribute("product", product);
return "productPurchase";
}
}
package com.video.ai.dao;
import com.video.ai.domain.Blog;
public interface BlogMapper {
int deleteByPrimaryKey(Integer id);
int insert(Blog record);
int insertSelective(Blog record);
Blog selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Blog record);
int updateByPrimaryKey(Blog record);
}
\ No newline at end of file
package com.video.ai.dao;
import com.video.ai.domain.Comment;
public interface CommentMapper {
int deleteByPrimaryKey(Integer id);
int insert(Comment record);
int insertSelective(Comment record);
Comment selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Comment record);
int updateByPrimaryKey(Comment record);
}
\ No newline at end of file
package com.video.ai.dao;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface FlowDao {
}
package com.video.ai.dao;
import com.video.ai.domain.AliPayParam;
import com.video.ai.domain.Orders;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface OrdersDao {
void add(Orders orders);
int update(Orders orders);
int updateInfoByOrderNum(Orders orders);
List<Orders> findAll();
Orders findById(String id);
List<Orders> queryByParam(AliPayParam param);
Orders findByOrdernum(String ordernum);
}
package com.video.ai.dao;
import com.video.ai.domain.Post;
public interface PostMapper {
int deleteByPrimaryKey(Integer id);
int insert(Post record);
int insertSelective(Post record);
Post selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Post record);
int updateByPrimaryKey(Post record);
}
\ No newline at end of file
package com.video.ai.dao;
import com.video.ai.domain.PostTag;
public interface PostTagMapper {
int deleteByPrimaryKey(Integer id);
int insert(PostTag record);
int insertSelective(PostTag record);
PostTag selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(PostTag record);
int updateByPrimaryKey(PostTag record);
}
\ No newline at end of file
package com.video.ai.dao;
import com.video.ai.domain.Product;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface ProductDao {
Integer add(Product product);
Product findById(String id);
List<Product> findAll();
}
package com.video.ai.dao;
import com.video.ai.domain.Tag;
import com.video.ai.domain.Tag;
public interface TagMapper {
int deleteByPrimaryKey(Integer id);
int insert(Tag record);
int insertSelective(Tag record);
Tag selectByPrimaryKey(Integer id);
int updateByPrimaryKeySelective(Tag record);
int updateByPrimaryKey(Tag record);
}
\ No newline at end of file
package com.video.ai.dao;
import com.video.ai.domain.User;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface UserDao {
List<User> findAllUser();
}
package com.video.ai.dao;
import com.video.ai.domain.UserInfoBean;
import java.util.List;
public interface UserInfoBeanMapper {
int deleteByPrimaryKey(Integer userid);
int insert(UserInfoBean record);
int insertSelective(UserInfoBean record);
UserInfoBean selectByPrimaryKey(Integer userid);
int updateByPrimaryKeySelective(UserInfoBean record);
int updateByPrimaryKey(UserInfoBean record);
/**
* 登录查询
*
* @param record 参数实体类
* @return 查询结果集
*/
List<UserInfoBean> queryForLogin(UserInfoBean record);
/**
* 根据用户参数自定义查询
*
* @param record 用户参数实体类
* @return 查询结果集
*/
List<UserInfoBean> queryUserInfoByParams(UserInfoBean record);
}
\ No newline at end of file
package com.video.ai.domain;
public class AliPayModel {
private String out_trade_no;
private String total_amount;
private String subject;
private String body;
private String product_code;
private String timeout_express;
public void setTimeout_express(String timeout_express) {
this.timeout_express = timeout_express;
}
public String getTimeout_express() {
return timeout_express;
}
public String getOut_trade_no() {
return out_trade_no;
}
public void setOut_trade_no(String out_trade_no) {
this.out_trade_no = out_trade_no;
}
public String getTotal_amount() {
return total_amount;
}
public void setTotal_amount(String total_amount) {
this.total_amount = total_amount;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getProduct_code() {
return product_code;
}
public void setProduct_code(String product_code) {
this.product_code = product_code;
}
}
package com.video.ai.domain;
public class AliPayParam {
private String order_num;
private String trade_no;
private String body;
private String starttime;
private String endtime;
private String status;
private int page;
private int size;
public int getPage() {
return page;
}
public void setPage(int page) {
this.page = page;
}
public int getSize() {
return size;
}
public void setSize(int size) {
this.size = size;
}
public String getTrade_no() {
return trade_no;
}
public void setTrade_no(String trade_no) {
this.trade_no = trade_no;
}
public String getOrder_num() {
return order_num;
}
public void setOrder_num(String order_num) {
this.order_num = order_num;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public String getStarttime() {
return starttime;
}
public void setStarttime(String starttime) {
this.starttime = starttime;
}
public String getEndtime() {
return endtime;
}
public void setEndtime(String endtime) {
this.endtime = endtime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}
package com.video.ai.domain;
public class Blog {
private Integer id;
private String title;
private Integer authorId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title == null ? null : title.trim();
}
public Integer getAuthorId() {
return authorId;
}
public void setAuthorId(Integer authorId) {
this.authorId = authorId;
}
}
\ No newline at end of file
package com.video.ai.domain;
public class Comment {
private Integer id;
private Integer postId;
private String name;
private String comment;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPostId() {
return postId;
}
public void setPostId(Integer postId) {
this.postId = postId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
public String getComment() {
return comment;
}
public void setComment(String comment) {
this.comment = comment == null ? null : comment.trim();
}
}
\ No newline at end of file
package com.video.ai.domain;
import java.util.Date;
/**
* 流水表
*/
public class Flow {
private String id;
/**
* 流水号
*/
private String flowNum;
/**
*订单号
*/
private String orderNum;
/**
*产品Id
*/
private Product prodect;
/**
*支付金额
*/
private String paidAmount;
/**
*支付方式 1:支付宝 \r\n 2:微信
*/
private Integer paidMethod;
/**
*购买数量
*/
private Integer buyCounts;
/**
*创建时间
*/
private Date createDate;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getFlowNum() {
return flowNum;
}
public void setFlowNum(String flowNum) {
this.flowNum = flowNum;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public Product getProdect() {
return prodect;
}
public void setProdect(Product prodect) {
this.prodect = prodect;
}
public String getPaidAmount() {
return paidAmount;
}
public void setPaidAmount(String paidAmount) {
this.paidAmount = paidAmount;
}
public Integer getPaidMethod() {
return paidMethod;
}
public void setPaidMethod(Integer paidMethod) {
this.paidMethod = paidMethod;
}
public Integer getBuyCounts() {
return buyCounts;
}
public void setBuyCounts(Integer buyCounts) {
this.buyCounts = buyCounts;
}
public Date getCreateDate() {
return createDate;
}
public void setCreateDate(Date createDate) {
this.createDate = createDate;
}
@Override
public String toString() {
return "Flow{" +
"id='" + id + '\'' +
", flowNum='" + flowNum + '\'' +
", orderNum='" + orderNum + '\'' +
", prodect=" + prodect +
", paidAmount='" + paidAmount + '\'' +
", paidMethod=" + paidMethod +
", buyCounts=" + buyCounts +
", createDate=" + createDate +
'}';
}
}
package com.video.ai.domain;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* 订单表
*/
public class Orders {
private String id;
/**
* 订单号
*/
private String orderNum;
private String tradeNo;
/**
* 订单状态 10:待付款;20:已付款
*/
private String orderStatus;
/**
* 订单金额
*/
private String orderAmount;
/**
* 实际支付金额
*/
private String paidAmount;
/**
* 产品
*/
private Product product;
/**
* 购买数量
*/
private Integer buyCounts;
/**
* 订单创建时间
*/
// @JsonFormat(pattern = "yyyy-MM-dd hh:mm:ss",timezone = "GMT+8")
private String createTime;
/**
* 订单支付时间
*/
private String paidTime;
private String finishTime;
private String subject;
private String bz;
private String payurl;
private String gmtcreatetime;
public String getGmtcreatetime() {
return gmtcreatetime;
}
public void setGmtcreatetime(String gmtcreatetime) {
this.gmtcreatetime = gmtcreatetime;
}
public String getPayurl() {
return payurl;
}
public void setPayurl(String payurl) {
this.payurl = payurl;
}
public String getTradeNo() {
return tradeNo;
}
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo;
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject;
}
public String getBz() {
return bz;
}
public void setBz(String bz) {
this.bz = bz;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getOrderNum() {
return orderNum;
}
public void setOrderNum(String orderNum) {
this.orderNum = orderNum;
}
public String getOrderStatus() {
return orderStatus;
}
public void setOrderStatus(String orderStatus) {
this.orderStatus = orderStatus;
}
public String getOrderAmount() {
return orderAmount;
}
public void setOrderAmount(String orderAmount) {
this.orderAmount = orderAmount;
}
public String getPaidAmount() {
return paidAmount;
}
public void setPaidAmount(String paidAmount) {
this.paidAmount = paidAmount;
}
public Product getProduct() {
return product;
}
public void setProduct(Product product) {
this.product = product;
}
public Integer getBuyCounts() {
return buyCounts;
}
public void setBuyCounts(Integer buyCounts) {
this.buyCounts = buyCounts;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getPaidTime() {
return paidTime;
}
public void setPaidTime(String paidTime) {
this.paidTime = paidTime;
}
public String getFinishTime() {
return finishTime;
}
public void setFinishTime(String finishTime) {
this.finishTime = finishTime;
}
}
package com.video.ai.domain;
import java.io.Serializable;
import java.util.List;
public class PageResultBean<T> implements Serializable {
private static final long serialVersionUID = 5071118307783022228L;
private long count;
private int code;
private List<T> data;
public PageResultBean(long count, List<T> data) {
this.count = count;
this.data = data;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public List<T> getData() {
return data;
}
public void setData(List<T> data) {
this.data = data;
}
}
package com.video.ai.domain;
import java.util.Date;
public class Post {
private Integer id;
private Integer blogId;
private Integer authorId;
private Date createdOn;
private String section;
private String subject;
private Integer draft;
private String body;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getBlogId() {
return blogId;
}
public void setBlogId(Integer blogId) {
this.blogId = blogId;
}
public Integer getAuthorId() {
return authorId;
}
public void setAuthorId(Integer authorId) {
this.authorId = authorId;
}
public Date getCreatedOn() {
return createdOn;
}
public void setCreatedOn(Date createdOn) {
this.createdOn = createdOn;
}
public String getSection() {
return section;
}
public void setSection(String section) {
this.section = section == null ? null : section.trim();
}
public String getSubject() {
return subject;
}
public void setSubject(String subject) {
this.subject = subject == null ? null : subject.trim();
}
public Integer getDraft() {
return draft;
}
public void setDraft(Integer draft) {
this.draft = draft;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body == null ? null : body.trim();
}
}
\ No newline at end of file
package com.video.ai.domain;
public class PostTag {
private Integer id;
private Integer postId;
private Integer tagId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public Integer getPostId() {
return postId;
}
public void setPostId(Integer postId) {
this.postId = postId;
}
public Integer getTagId() {
return tagId;
}
public void setTagId(Integer tagId) {
this.tagId = tagId;
}
}
\ No newline at end of file
package com.video.ai.domain;
public class Product {
private String id;
/**
* 产品名称
*/
private String name;
/**
* 产品价格
*/
private String price;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getPrice() {
return price;
}
public void setPrice(String price) {
this.price = price;
}
@Override
public String toString() {
return "Product{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", price='" + price + '\'' +
'}';
}
}
/**
* Copyright 2021 json.cn
*/
package com.video.ai.domain;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.util.List;
public class ResultObj {
private static final ObjectMapper MAPPER = new ObjectMapper();
/**
* 响应业务状态
* 200 成功
* 201 错误
* 400 参数错误
*/
private Integer code;
/**
* 响应消息
*/
private String msg;
/**
* 响应中的数据
*/
private Object obj;
public static ResultObj error(Integer status, String msg, Object data) {
return new ResultObj(status, msg, data);
}
public static ResultObj ok(Object data) {
return new ResultObj(data);
}
public static ResultObj ok() {
return ok(null);
}
private ResultObj() {
}
public static ResultObj error(Integer status, String msg) {
return new ResultObj(status, msg, null);
}
private ResultObj(Integer status, String msg, Object data) {
this.code = status;
this.msg = msg;
this.obj = data;
}
private ResultObj(Object data) {
this.code =200;
this.msg = "OK";
this.obj = data;
}
public Integer getCode() {
return code;
}
public void setCode(Integer code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public Object getObj() {
return obj;
}
public void setObj(Object obj) {
this.obj = obj;
}
/**
* 将json结果集转化为SysResult对象
*
* @param jsonData json数据
* @param clazz SysResult中的object类型
* @return SysResult对象
*/
public static ResultObj formatToPojo(String jsonData, Class<?> clazz) {
try {
if (clazz == null) {
return MAPPER.readValue(jsonData, ResultObj.class);
}
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isObject()) {
obj = MAPPER.readValue(data.traverse(), clazz);
} else if (data.isTextual()) {
obj = MAPPER.readValue(data.asText(), clazz);
}
return error(Integer.parseInt(jsonNode.get("status").toString()), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
/**
* 没有object对象的转化
*
* @param json 字符串
* @return SysResult对象
*/
public static ResultObj format(String json) {
try {
return MAPPER.readValue(json, ResultObj.class);
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* Object是集合转化
*
* @param jsonData json数据
* @param clazz 集合中的类型
* @return SysResult对象
*/
public static ResultObj formatToList(String jsonData, Class<?> clazz) {
try {
JsonNode jsonNode = MAPPER.readTree(jsonData);
JsonNode data = jsonNode.get("data");
Object obj = null;
if (data.isArray() && data.size() > 0) {
obj = MAPPER.readValue(data.traverse(),
MAPPER.getTypeFactory().constructCollectionType(List.class, clazz));
}
return error(Integer.parseInt(jsonNode.get("status").toString()), jsonNode.get("msg").asText(), obj);
} catch (Exception e) {
e.printStackTrace();
return null;
}
}
@Override
public String toString() {
return "ResultObj{" +
"code=" + code +
", msg='" + msg + '\'' +
", obj=" + obj +
'}';
}
}
\ No newline at end of file
package com.video.ai.domain;
public class Tag {
private Integer id;
private String name;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name == null ? null : name.trim();
}
}
\ No newline at end of file
package com.video.ai.domain;
public class User {
private String id;
private String name;
private Integer age;
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Integer getAge() {
return age;
}
public void setAge(Integer age) {
this.age = age;
}
@Override
public String toString() {
return "User{" +
"id='" + id + '\'' +
", name='" + name + '\'' +
", age=" + age +
'}';
}
}
package com.video.ai.domain;
import java.util.Date;
public class UserInfoBean {
private Integer userid;
private String username;
private String userpsw;
private String useraddress;
private String usertel;
private Date userregdate;
// 查询使用的字段
private Date userregdate2;
private String userimg;
public Integer getUserid() {
return userid;
}
public void setUserid(Integer userid) {
this.userid = userid;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username == null ? null : username.trim();
}
public String getUserpsw() {
return userpsw;
}
public void setUserpsw(String userpsw) {
this.userpsw = userpsw == null ? null : userpsw.trim();
}
public String getUseraddress() {
return useraddress;
}
public void setUseraddress(String useraddress) {
this.useraddress = useraddress == null ? null : useraddress.trim();
}
public String getUsertel() {
return usertel;
}
public void setUsertel(String usertel) {
this.usertel = usertel == null ? null : usertel.trim();
}
public Date getUserregdate() {
return userregdate;
}
public void setUserregdate(Date userregdate) {
this.userregdate = userregdate;
}
public Date getUserregdate2() {
return userregdate2;
}
public void setUserregdate2(Date userregdate2) {
this.userregdate2 = userregdate2;
}
public String getUserimg() {
return userimg;
}
public void setUserimg(String userimg) {
this.userimg = userimg == null ? null : userimg.trim();
}
@Override
public String toString() {
return "UserInfoBean{" +
"userid=" + userid +
", username='" + username + '\'' +
", userpsw='" + userpsw + '\'' +
", useraddress='" + useraddress + '\'' +
", usertel='" + usertel + '\'' +
", userregdate=" + userregdate +
", userregdate2=" + userregdate2 +
", userimg='" + userimg + '\'' +
'}';
}
}
\ No newline at end of file
package com.video.ai.service;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@Transactional
public class FlowService {
}
package com.video.ai.service;
import com.github.pagehelper.PageHelper;
import com.video.ai.dao.OrdersDao;
import com.video.ai.domain.AliPayParam;
import com.video.ai.domain.Orders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class OrdersService {
@Autowired
private OrdersDao ordersDao;
public void add(Orders orders) {
ordersDao.add(orders);
}
public void update(Orders orders) {
ordersDao.update(orders);
}
public void updateInfoByOrderNum(Orders orders) {
ordersDao.updateInfoByOrderNum(orders);
}
public List<Orders> findAll() {
return ordersDao.findAll();
}
public Orders findById(String id) {
return ordersDao.findById(id);
}
public List<Orders> queryByParam(AliPayParam param){
PageHelper.startPage(param.getPage(),param.getSize());
return ordersDao.queryByParam(param);
}
public Orders findByOrdernum(String id) {
return ordersDao.findByOrdernum(id);
}
}
package com.video.ai.service;
import com.video.ai.dao.ProductDao;
import com.video.ai.domain.Product;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class ProductService {
@Autowired
private ProductDao productDao;
public Integer add(Product product) {
return productDao.add(product);
};
public Product findById(String id) {
return productDao.findById(id);
}
public List<Product> findAll() {
return productDao.findAll();
}
}
package com.video.ai.service;
import com.video.ai.dao.UserDao;
import com.video.ai.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
@Service
@Transactional
public class UserService {
@Autowired
private UserDao userDao;
public List<User> findAllUser() {
return userDao.findAllUser();
}
}
package com.video.ai.utils;
public class AlipayConfig {
public static String app_id = "2021002192666228";
// 商户私钥,需转为PKCS8格式RSA2私钥
public static String merchant_private_key = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCObXnz1Ss52qmn6rGQdbnHtOAPDZNTR7pFstNa8eeFxDliC/MFtsDEiQkJKKdqYH7/M/1aOthZqnuLnKu9YRy2YY7ztfQX0V7q+OT6fdKHJV8M4AMkv17su0u1njFDCf70StNrCxjpRDxjzJWoGZlWQ4Yz824U32TCajV71lGv4YdlfaXYbpqlZ0AoeS+44HtFh37CwhWMDvmSvFMNPtjpIDETXTylgQBXKDVdq7DFs/W+KX/KsDo3tRNy0Y1tskRbG7nxVPhYFHTfHY0jY6h5n9rXYzXi31jHBs/ipII7AxZ2aIYSuq4PCZgqzv/BzwWd/v5hAI5VlENsWf/Rr1YbAgMBAAECggEAQ2PXXSDSyBgHSDVK+OBLHAwgK98vgysgHtRjHtfwxSE4SYT/4wc6pIN2bAf5VuL7lALkcGoBbkO1GzTxKbUmYcE9Y2EHcrGVKLbFmSQpldp/49amhh+qaXahdvi3tFGpeath53cjvVOVA1+MvDIIlIF0oWYgAu5EfZzFW6fnlMD6+5KESEBD4oz2TQqcvu44Pq+ey0P4JBG7YUXdX/eMlNZrJ1xr5FTW0nG8VJFt3/OXiZnprQFlOfLRW5ZfBQ6nQk0HVK3zF4IGbjYiHrED0VjBnWocQq25MC+YI8dniTV9bXedCEq1i2p/AqyICPDwuZyWxytwX0zhSzynjBIvqQKBgQDPnN+mgYxqxRUoQNb6PnSQx65zFGv/eSkPXzj/RyXXpsrPWeHdgnUsrAWdNazJZW9GgF1/xmC6Get/LN8nYttlFHZwKWHISKPBJOq9f4p8iJD6mh8hTuq/C8Hshmj6TRNMHU82HmIAomAo4wuX/bA+nm4lV9ZwqPdW2Th/wsyWNwKBgQCvn1wHD3Nz3xeDK7GuiOs1a7pOSeZXqBIg5R1638HFYKgWS1i4cuF3OjncVlhTVyzJ4X6qvIkB7PaJes9l1zYKeFFQiV6jG4aMDHQLbdSTyWSk9lPG72U3mN6ZA9FvTlRjhAtlu9SJ3+CrerAjlj5h/nDBOntpyy5/6aR2L8dNPQKBgBtSqPhv2jv+/f7TMbezWoHnVaUdje0MVAQK4yRth6Ru9gf960TMs4ESjpaXBstmhxN/N07mm7pCSQTusdusHfWakM/IEm9aZ/q2UhJoY6BqFLJ2cBxhF3HXKUlokw5F8IE25kLYEsvEkuUupEr3fydukE5n1ffztMGASvg9edFXAoGAWTd+m8OYphuGKUewKvc5bdj9OzpFfvBNzVI3SK2VFX0FxtWeC42oxlXZAPsIQcY+ZYxdOcUvYMANekfeRmEu/eCjhmNSpU+daVYGOawg2rbrnvXYF26UH8tUAa2z3nSPYEK7O4JQ9X2698IK6vkvVb7ZbwATo+npBGgf+T5KZA0CgYEApjNReSgZMRAFwy5DqaKAnc4POMaY1reA5NnHBs1W4XBdey472fiV7OEuCYc/7Lfg4ps/dAIw6Oh0dcmcscvADA6jGrxt7v59RMYm134CsD4F9XxfVMU5MbCrYU29pwVJiTVpy/NbICHF4hew2Lybwtr+TaYGrORL0LNPbAePdt0=";
// 商户公钥
public static String alipay_public_key = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAjm1589UrOdqpp+qxkHW5x7TgDw2TU0e6RbLTWvHnhcQ5YgvzBbbAxIkJCSinamB+/zP9WjrYWap7i5yrvWEctmGO87X0F9Fe6vjk+n3ShyVfDOADJL9e7LtLtZ4xQwn+9ErTawsY6UQ8Y8yVqBmZVkOGM/NuFN9kwmo1e9ZRr+GHZX2l2G6apWdAKHkvuOB7RYd+wsIVjA75krxTDT7Y6SAxE108pYEAVyg1XauwxbP1vil/yrA6N7UTctGNbbJEWxu58VT4WBR03x2NI2OoeZ/a12M14t9YxwbP4qSCOwMWdmiGErquDwmYKs7/wc8Fnf7+YQCOVZRDbFn/0a9WGwIDAQAB";
public static String alipay_public_key2 ="MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAoZl4Qe3YYnA5gfd4ZGzYGuMVV0DUPMoUbXKUy3mnbOZUhu06osIYHhSXd/QLyaQwlGaw1XoqvOgDEmAToLYOsA942cHMV2KWvtnF2hvVEfsS0wnwrenYsDTm2pcvbgWcQChnkaPMIU2uxLP+u7zQ9MVvq7YGVDuEn+qLEkjBhxtJFPzY8KAH9IJfCYHyke4ED4xwosn74kcNr3CHWKyqmkmtrSNCUyNdswYrjIKeLrGtLgodjwoywi2Z9usLQUd7h1nF6B6O0aFce+PGlH586VIiqwLmZXLMkpZmYzHok9RBKJAFFz+k+Iho2ILUj/NVXrLjV0QF+RotRMeyhgfK1wIDAQAB";
// 签名方式
public static String sign_type = "RSA2";
// 字符编码格式
public static String charset = "utf-8";
// 支付宝网关
// #支付宝网关(默认沙箱环境,线上:https://openapi.alipay.com/gateway.do)
// ALIPAY_GATEWAY_URL = https://openapi.alipaydev.com/gateway.do
public static String gatewayUrl = "https://openapi.alipay.com/gateway.do";
// 支付宝网关
public static String log_path = "D:\\";
}
package com.video.ai.utils;
import org.apache.commons.lang3.time.DateFormatUtils;
import java.sql.Timestamp;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 时间工具类
*/
public class DateUtils extends org.apache.commons.lang3.time.DateUtils {
public static String YYYY = "yyyy";
public static String YYYY_MM = "yyyy-MM";
public static final String YYYY_MM_DD = "yyyy-MM-dd";
public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
private static final String[] parsePatterns = {
"yyyy-MM-dd", "yyyy-MM-dd HH:mm:ss", "yyyy-MM-dd HH:mm", "yyyy-MM",
"yyyy/MM/dd", "yyyy/MM/dd HH:mm:ss", "yyyy/MM/dd HH:mm", "yyyy/MM",
"yyyy.MM.dd", "yyyy.MM.dd HH:mm:ss", "yyyy.MM.dd HH:mm", "yyyy.MM"};
private static final String format = "yyyy-MM-dd HH:mm:ss";
private static final ThreadLocal<SimpleDateFormat> threadLocal = new
ThreadLocal<>();
/**
* 获取当前Date型日期
*
* @return Date() 当前日期
*/
public static Date getNowDate() {
return new Date();
}
/**
* 获取当前日期, 默认格式为yyyy-MM-dd
*
* @return 日期格式化字符串
*/
public static String getDate() {
return dateTimeNow(YYYY_MM_DD);
}
public static String getTime() {
return dateTimeNow(YYYY_MM_DD_HH_MM_SS);
}
public static String dateTimeNow() {
return dateTimeNow(YYYYMMDDHHMMSS);
}
public static String dateTimeNow(final String format) {
return parseDateToStr(format, new Date());
}
public static String dateTime(final Date date) {
return parseDateToStr(YYYY_MM_DD, date);
}
public static String parseDateToStr(final String format, final Date date) {
return new SimpleDateFormat(format).format(date);
}
/**
* 日期路径 即年/月/日 如2018/08/08
*/
public static String datePath() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyy/MM/dd");
}
/**
* 日期路径 即年/月/日 如20180808
*/
public static String dateTime() {
Date now = new Date();
return DateFormatUtils.format(now, "yyyyMMdd");
}
/**
* 日期型字符串转化为日期 格式
*/
public static Date parseDate(Object str) {
if (str == null) {
return null;
}
try {
return parseDate(str.toString(), parsePatterns);
} catch (ParseException e) {
return null;
}
}
/**
* 日期型字符串转化为日期 格式
*/
public static Date StrParseDate(String str) {
if (str == null) {
return null;
}
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
try {
return simpleDateFormat.parse(str);
} catch (ParseException e) {
return null;
}
}
/**
* 计算两个时间差
*/
public static long getDatePoor(Date endDate, Date nowDate) {
long nd = 1000 * 24 * 60 * 60;
long nh = 1000 * 60 * 60;
long nm = 1000 * 60;
// long ns = 1000;
// 获得两个时间的毫秒时间差异
long diff = endDate.getTime() - nowDate.getTime();
// 计算差多少天
long day = diff / nd;
// 计算差多少小时
long hour = diff % nd / nh;
// 计算差多少分钟
long min = diff % nd % nh / nm;
// 计算差多少秒//输出结果
// long sec = diff % nd % nh % nm / ns;
return day;
}
/**
* 获取指定时间的凌晨时间
* @author : fyk
* @create : 2019/10/9 9:58
* @param: day 天 为0 就是获取当天 1 往后加一天 -1 前退一天
**/
public static String getEndTimestamp(Integer day,String date) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(parseDate(date));
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.add(Calendar.DAY_OF_MONTH, day);
Date start = calendar.getTime();
Timestamp timestamp = new Timestamp(start.getTime());
return sdf.format(timestamp.getTime());
}
/**
* 获取指定前一天时间
* @author : fyk
* @create : 2019/10/9 9:58
* @param: day 天 为0 就是获取当天 1 往后加一天 -1 前退一天
**/
public static String getYestodayTimestamp(Integer day,String date) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar calendar = Calendar.getInstance();
calendar.setTime(parseDate(date));
calendar.add(Calendar.DAY_OF_MONTH, day);
Date start = calendar.getTime();
Timestamp timestamp = new Timestamp(start.getTime());
return sdf.format(timestamp.getTime());
}
public static String getLastMinTime(Date newDate, Integer miniuts, String year,Integer yearvalue) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar cal = Calendar.getInstance();
cal.setTime(newDate);//设置起时间
if(year.equals("year"))
cal.add(Calendar.YEAR, yearvalue);
else if(year.equals("month")){
cal.add(Calendar.MONTH, yearvalue);
}
else if(year.equals("day")){
cal.add(Calendar.DAY_OF_MONTH, yearvalue);
}
cal.add(Calendar.MINUTE, miniuts);
return sdf.format(cal.getTime());
}
public static String getlastYearTime(Date newDate,Integer year) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar cal = Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.YEAR, year);
return sdf.format(cal.getTime());
}
public static String getlastMonthTime(Date newDate,Integer month) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar cal= Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.MONTH, month);
return sdf.format(cal.getTime());
}
public static String getlastMonthTimeY_M_D(Date newDate,Integer month) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(YYYY_MM_DD);
}
Calendar cal= Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.MONTH, month);
return sdf.format(cal.getTime());
}
public static Date getMonthTimeY_M_D(Date newDate,Integer month) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(YYYY_MM_DD);
}
Calendar cal= Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.MONTH, month);
return cal.getTime();
}
public static String getlastDayTime(Date newDate,Integer day) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(format);
}
Calendar cal= Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.DAY_OF_MONTH, day);
return sdf.format(cal.getTime());
}
public static String getlastDayTimeY_M_D(Date newDate,Integer day) {
SimpleDateFormat sdf = null;
sdf = threadLocal.get();
if (sdf == null){
sdf = new SimpleDateFormat(YYYY_MM_DD);
}
Calendar cal= Calendar.getInstance();
cal.setTime(newDate);//设置起时间
cal.add(Calendar.DAY_OF_MONTH, day);
return sdf.format(cal.getTime());
}
public static boolean TheSameDay(Date d1,Date d2) {
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTime(d1);
c2.setTime(d2);
return (c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR))
&& (c1.get(Calendar.MONTH) == c2.get(Calendar.MONTH))
&& (c1.get(Calendar.DAY_OF_MONTH) == c2.get(Calendar.DAY_OF_MONTH));
}
}
\ No newline at end of file
package com.video.ai.utils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.text.SimpleDateFormat;
/**
* JSON工具类
*/
public class JsonUtil {
private static final Logger log = LoggerFactory.getLogger(JsonUtil.class);
private final static ObjectMapper objectMapper = new ObjectMapper();
private static final String DATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
static {
// 对象的所有字段全部列入
objectMapper.setSerializationInclusion(JsonInclude.Include.ALWAYS);
// 取消默认转换timestamps形式
objectMapper.configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, false);
// 忽略空bean转json的错误
objectMapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
// 统一日期格式
objectMapper.setDateFormat(new SimpleDateFormat(DATE_FORMAT));
// 忽略在json字符串中存在, 但在java对象中不存在对应属性的情况, 防止错误
objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}
public static <T> String objToStr(T obj) {
if (null == obj) {
return null;
}
try {
return obj instanceof String ? (String) obj : objectMapper.writeValueAsString(obj);
} catch (Exception e) {
log.warn("objToStr error: ", e);
return null;
}
}
public static <T> T strToObj(String str, Class<T> clazz) {
if (StringUtils.isBlank(str) || null == clazz) {
return null;
}
try {
return clazz.equals(String.class) ? (T) str : objectMapper.readValue(str, clazz);
} catch (Exception e) {
log.warn("strToObj error: ", e);
return null;
}
}
public static <T> T strToObj(String str, TypeReference<T> typeReference) {
if (StringUtils.isBlank(str) || null == typeReference) {
return null;
}
try {
return (T) (typeReference.getType().equals(String.class) ? str : objectMapper.readValue(str,
typeReference));
} catch (Exception e) {
log.error("strToObj error", e);
return null;
}
}
}
package com.video.ai.utils;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;
public class ResponseUtil {
public static void ResponseStr(HttpServletResponse response, String result) {
try {
response.setContentType("text/html");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
out.write(result);
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
package com.video.ai.utils;
import java.util.UUID;
public class UUIdUtils {
public static String next() {
int machineId = 1;
int hashCodeV = UUID.randomUUID().toString().hashCode();
if(hashCodeV < 0) {//有可能是负数
hashCodeV = - hashCodeV;
}
return machineId + String.format("%015d", hashCodeV);
}
public static String createuuid() {
return UUID.randomUUID().toString().replaceAll("-", "");
}
}
# 项目发布端口号配置
server:
port: 8042
# 应用程序名配置
spring:
datasource:
url: jdbc:mysql://172.16.24.29:3306/videoorder?useUnicode=true&characterEncoding=utf-8&serverTimezone = GMT%2B8
username: root
password: 123456
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
alipay:
notify_url: http://zjh189.ncpoi.cc:20000/videopay/alipay/notifyUrl
return_url : http://zjh189.ncpoi.cc:20000/videopay/alipay/returnUrl
pay_url: http://zjh189.ncpoi.cc:20000/aipayAdmin/paymentPage
\ No newline at end of file
# 项目发布端口号配置
server:
port: 8080
spring:
datasource:
url: jdbc:mysql://localhost:3306/videoorder?useUnicode=true&characterEncoding=utf-8&serverTimezone = GMT%2B8
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
type: com.alibaba.druid.pool.DruidDataSource
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1 FROM DUAL
testWhileIdle: true
testOnBorrow: false
testOnReturn: false
poolPreparedStatements: true
maxPoolPreparedStatementPerConnectionSize: 20
alipay:
notify_url: http://localhost:8080/videoai/alipay/notifyUrl
return_url : http://localhost:8080/videoai/alipay/returnUrl
pay_url: http://localhost:8080/videoai/paymentPage
\ No newline at end of file
spring:
profiles:
active: dev
application:
name: videoai
server:
servlet:
context-path: /videoai
servlet:
thymeleaf:
cache: false
mode: LEGACYHTML5
encoding: UTF-8
prefix: classpath:/templates/
suffix: .html
logging:
level:
com.example.dao: DEBUG
mybatis:
type-aliases-package: com.video.ai.domain
configuration:
map-underscore-to-camel-case: true
default-fetch-size: 100
default-statement-timeout: 3000
mapper-locations: classpath:mapper/*.xml
\ No newline at end of file
<?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.video.ai.dao.FlowDao" >
</mapper>
<?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.video.ai.dao.OrdersDao">
<sql id="ordersColumns">
o.id as "id",
o.order_num as "orderNum",
o.order_status as "orderStatus",
o.order_amount as "orderAmount",
o.paid_amount as "paidAmount",
p.id as "product.id",
p.name as "product.name",
p.price as "product.price",
o.buy_counts as "buyCounts",
o.create_time as "createTime",
o.paid_time as "paidTime"
</sql>
<sql id="ordersJoins">
left join product p on o.product_id = p.id
</sql>
<resultMap id="ordersMap" type="Orders" autoMapping="true">
<collection property="product" ofType="Product">
<id column="product_id" property="id"></id>
</collection>
</resultMap>
<resultMap id="resultMap" type="com.video.ai.domain.Orders">
<result column="id" property="id"/>
<result column="order_num" property="orderNum"/>
<result column="trade_no" property="tradeNo"/>
<result column="order_status" property="orderStatus"/>
<result column="order_amount" property="orderAmount"/>
<result column="paid_amount" property="paidAmount"/>
<result column="buy_counts" property="buyCounts"/>
<result column="create_time" property="createTime"/>
<result column="paid_time" property="paidTime"/>
<result column="subject" property="subject"/>
<result column="bz" property="bz"/>
<result column="payurl" property="payurl"/>
<result column="gmtcreatetime" property="gmtcreatetime"/>
</resultMap>
<insert id="add" parameterType="Orders">
insert into orders (id,
order_num,
order_status,
order_amount,
paid_amount,
product_id,
buy_counts,
create_time,
paid_time,subject,bz,payurl)
values (#{id}, #{orderNum}, #{orderStatus}, #{orderAmount}, #{paidAmount},
#{product.id}, #{buyCounts}, #{createTime}, #{paidTime},
#{subject}, #{bz},#{payurl})
</insert>
<update id="update" parameterType="Orders">
update orders
<trim prefix="set" suffixOverrides=",">
<if test="orderNum != null and orderNum !=''">
order_num =#{orderNum},
</if>
<if test="orderStatus != null and orderStatus!=''">
order_status = #{orderStatus},
</if>
<if test="orderAmount != null and orderAmount!=''">
order_amount = #{orderAmount},
</if>
<if test="paidAmount != null and paidAmount!=''">
paid_amount = #{paidAmount},
</if>
<if test="buyCounts != null and buyCounts!=''">
buy_counts = #{buyCounts},
</if>
<if test="createTime != null and createTime!=''">
create_time = #{createTime},
</if>
<if test="paidTime != null and paidTime!=''">
paid_time = #{paidTime},
</if>
<if test="payurl != null and payurl!=''">
payurl = #{payurl},
</if>
<if test="gmtcreatetime != null and gmtcreatetime!=''">
gmtcreatetime = #{gmtcreatetime},
</if>
</trim>
where id=#{id}
</update>
<update id="updateInfoByOrderNum" parameterType="Orders">
update orders
<trim prefix="set" suffixOverrides=",">
<if test="orderNum != null and orderNum !=''">
order_num =#{orderNum},
</if>
<if test="orderStatus != null and orderStatus!=''">
order_status = #{orderStatus},
</if>
<if test="orderAmount != null and orderAmount!=''">
order_amount = #{orderAmount},
</if>
<if test="paidAmount != null and paidAmount!=''">
paid_amount = #{paidAmount},
</if>
<if test="buyCounts != null and buyCounts!=''">
buy_counts = #{buyCounts},
</if>
<if test="createTime != null ">
create_time = #{createTime},
</if>
<if test="paidTime != null and paidTime!=''">
paid_time = #{paidTime},
</if>
<if test="finishTime != null and finishTime!=''">
finishtime = #{finishTime},
</if>
<if test="payurl != null and payurl!=''">
payurl = #{payurl},
</if>
<if test="gmtcreatetime != null and gmtcreatetime!=''">
gmtcreatetime = #{gmtcreatetime},
</if>
<if test="tradeNo != null and tradeNo!=''">
trade_no = #{tradeNo},
</if>
</trim>
where order_num=#{orderNum}
</update>
<select id="findAll" resultMap="ordersMap">
select
<include refid="ordersColumns"/>
from orders o
<include refid="ordersJoins"/>
order by o.create_time desc
</select>
<select id="findById" resultMap="ordersMap">
select
<include refid="ordersColumns"/>
from orders o
<include refid="ordersJoins"/>
where o.id = #{id}
</select>
<select id="queryByParam" parameterType="com.video.ai.domain.AliPayParam" resultMap="resultMap">
select * from orders
<where>
<if test="trade_no != null and trade_no!=''">
and trade_no=#{trade_no}
</if>
<if test="order_num != null and order_num!=''">
and order_num=#{order_num}
</if>
<if test="starttime != null and starttime!=''">
and create_time>=#{starttime,jdbcType=TIMESTAMP}
</if>
<if test="endtime != null and endtime!=''">
and create_time<![CDATA[ < ]]>#{endtime,jdbcType=TIMESTAMP}
</if>
<if test="status != null and status!=''">
and order_status=#{status}
</if>
<if test=" body!= null and body!=''">
and
(bz like concat('%',#{body},'%')
or subject like concat('%',#{body},'%')
)
</if>
</where>
order by id desc
</select>
<select id="findByOrdernum" resultMap="resultMap">
select * from orders where order_num=#{ordernum}
</select>
</mapper>
<?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.video.ai.dao.ProductDao" >
<resultMap id="productMap" type="product" autoMapping="true" />
<sql id="productColumns">
id as "id",
name as "name",
price as "price"
</sql>
<insert id="add" useGeneratedKeys="true" keyProperty="id">
insert into product(id, name, price)
values (#{id}, #{name}, #{price})
</insert>
<select id="findById" resultMap="productMap">
select
<include refid="productColumns" />
from product
where id = #{id}
</select>
<select id="findAll" resultMap="productMap">
select
<include refid="productColumns" />
from product order by price asc
</select>
</mapper>
This source diff could not be displayed because it is too large. You can view the blob instead.
This diff is collapsed.
This diff is collapsed.
* {
margin: 0;
padding: 0;
}
ul, ol {
list-style: none;
}
body {
font-family: "Helvetica Neue", Helvetica, Arial, "Lucida Grande",
sans-serif;
}
.tab-head {
margin-left: 120px;
margin-bottom: 10px;
height: 60px;
}
.tab-content {
clear: left;
display: none;
}
h2 {
border-bottom: solid #02aaf1 2px;
width: 200px;
height: 25px;
margin: 0;
float: left;
text-align: center;
font-size: 16px;
}
.selected {
color: #FFFFFF;
background-color: #02aaf1;
}
.show {
clear: left;
display: block;
margin: 0 auto;
width: 80%;
}
.hidden {
display: none;
}
.new-btn-login-sp {
padding: 1px;
display: inline-block;
width: 75%;
}
.new-btn-login {
background-color: #02aaf1;
color: #FFFFFF;
font-weight: bold;
border: none;
width: 100%;
height: 30px;
border-radius: 5px;
font-size: 16px;
}
#main {
width: 90%;
margin: 0 auto;
font-size: 14px;
}
.red-star {
color: #f00;
width: 10px;
display: inline-block;
}
.null-star {
color: #fff;
}
.content {
margin-top: 5px;
}
.content dt {
width: 120px;
display: inline-block;
float: left;
margin-left: 20px;
color: #666;
font-size: 13px;
margin-top: 8px;
}
.content dd {
margin-left: 120px;
margin-bottom: 5px;
}
.content dd input {
width: 90%;
height: 38px;
border: 0;
-webkit-border-radius: 0;
-webkit-appearance: none;
}
#foot {
margin-top: 10px;
position: absolute;
bottom: 15px;
width: 100%;
}
.foot-ul {
width: 100%;
}
.foot-ul li {
width: 100%;
text-align: center;
color: #666;
}
.note-help {
color: #999999;
font-size: 12px;
line-height: 130%;
margin-top: 5px;
width: 100%;
display: block;
}
#btn-dd {
margin: 25px;
text-align: center;
}
.foot-ul {
width: 100%;
}
.one_line {
display: block;
height: 1px;
border: 0;
border-top: 1px solid #eeeeee;
width: 100%;
margin-left: 20px;
}
.am-header {
display: -webkit-box;
display: -ms-flexbox;
display: box;
width: 100%;
position: relative;
padding: 7px 0;
-webkit-box-sizing: border-box;
-ms-box-sizing: border-box;
box-sizing: border-box;
background: #1D222D;
height: 50px;
text-align: center;
-webkit-box-pack: center;
-ms-flex-pack: center;
box-pack: center;
-webkit-box-align: center;
-ms-flex-align: center;
box-align: center;
}
.am-header h1 {
-webkit-box-flex: 1;
-ms-flex: 1;
box-flex: 1;
line-height: 18px;
text-align: center;
font-size: 18px;
font-weight: 300;
color: #fff;
}
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付失败</title>
</head>
<body>
<div style=" margin: 0 auto;
text-align: center;
margin-top: 200px;
font-size: 30px;">支付失败
</div>
</body>
</html>
\ No newline at end of file
This diff is collapsed.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付成功</title>
</head>
<body>
<div style=" margin: 0 auto;
text-align: center;
margin-top: 200px;
font-size: 30px;">
支付成功!
</div>
</body>
</html>
\ No newline at end of file
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>支付成功</title>
</head>
<body style=" margin: 0 auto;
text-align: center;
margin-top: 200px;
font-size: 30px;">
支付成功!
</body>
</html>
\ No newline at end of file
package com.video.ai;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class SpringVideoAIApplicationTests {
@Test
void contextLoads() {
}
}
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment