详情页面
parent
7c081d82b0
commit
57157cc6be
|
|
@ -3,6 +3,7 @@ package com.ruoyi.app.controller;
|
||||||
import com.alipay.api.AlipayApiException;
|
import com.alipay.api.AlipayApiException;
|
||||||
import com.alipay.api.internal.util.AlipaySignature;
|
import com.alipay.api.internal.util.AlipaySignature;
|
||||||
import com.alipay.api.request.AlipayTradeCreateRequest;
|
import com.alipay.api.request.AlipayTradeCreateRequest;
|
||||||
|
import com.alipay.api.response.AlipayTradeAppPayResponse;
|
||||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||||
import com.ruoyi.app.domain.*;
|
import com.ruoyi.app.domain.*;
|
||||||
import com.ruoyi.app.domain.dto.*;
|
import com.ruoyi.app.domain.dto.*;
|
||||||
|
|
@ -478,30 +479,29 @@ public class PayController extends BaseController
|
||||||
@PostMapping(value = "/aliPay")
|
@PostMapping(value = "/aliPay")
|
||||||
@ApiOperation(value = "支付宝支付", notes = "支付宝支付", httpMethod = "POST")
|
@ApiOperation(value = "支付宝支付", notes = "支付宝支付", httpMethod = "POST")
|
||||||
public String aliPay(@RequestBody AppOrderArg appOrderArg) throws Exception{
|
public String aliPay(@RequestBody AppOrderArg appOrderArg) throws Exception{
|
||||||
return alipayService.startPay();
|
//return alipayService.startPay(appOrderArg);
|
||||||
// String orderNo = KeyUtil.generateUniqueKey();
|
String orderNo = KeyUtil.generateUniqueKey();
|
||||||
// AlipayTradeCreateResponse result = null;
|
AlipayTradeAppPayResponse result = null;
|
||||||
// try {
|
try {
|
||||||
// result = alipayService.startPay(orderNo, appOrderArg.getPrice());
|
result = alipayService.startPay(orderNo,appOrderArg.getPrice());
|
||||||
// } catch (AlipayApiException e) {
|
} catch (AlipayApiException e) {
|
||||||
// e.printStackTrace();
|
e.printStackTrace();
|
||||||
// }
|
}
|
||||||
// if (result.isSuccess()) {
|
if (result.isSuccess()) {
|
||||||
// AppOrder order = new AppOrder();
|
AppOrder order = new AppOrder();
|
||||||
// order.setOutTradeNo(orderNo);
|
order.setOutTradeNo(orderNo);
|
||||||
// order.setPrice(appOrderArg.getPrice());
|
order.setPrice(appOrderArg.getPrice());
|
||||||
// order.setAppId(AlipayService.APP_ID);
|
order.setAppId(AlipayService.APP_ID);
|
||||||
// order.setUserId(appOrderArg.getUserId());
|
order.setUserId(appOrderArg.getUserId());
|
||||||
// order.setPayStatus(1);
|
order.setPayStatus(1);
|
||||||
// order.setPaySoure(2);
|
order.setPaySoure(2);
|
||||||
// order.setCreateTime(new Date());
|
order.setCreateTime(new Date());
|
||||||
// order.setLevel(appOrderArg.getLevel());
|
order.setLevel(appOrderArg.getLevel());
|
||||||
// appOrderMapper.insertAppOrder(order);
|
appOrderMapper.insertAppOrder(order);
|
||||||
// //valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
|
String orderStr = result.getBody();
|
||||||
// String orderStr = new String(result.getBody().getBytes("ISO-8859-1"), "utf-8");
|
return orderStr;
|
||||||
// return orderStr;
|
} else {
|
||||||
// } else {
|
return null;
|
||||||
// return null;
|
}
|
||||||
// }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,7 @@ import com.alipay.api.request.AlipayTradePagePayRequest;
|
||||||
import com.alipay.api.response.AlipayOpenOperationOpenbizmockBizQueryResponse;
|
import com.alipay.api.response.AlipayOpenOperationOpenbizmockBizQueryResponse;
|
||||||
import com.alipay.api.response.AlipayTradeAppPayResponse;
|
import com.alipay.api.response.AlipayTradeAppPayResponse;
|
||||||
import com.alipay.api.response.AlipayTradeCreateResponse;
|
import com.alipay.api.response.AlipayTradeCreateResponse;
|
||||||
|
import com.ruoyi.app.domain.AppOrderArg;
|
||||||
import com.ruoyi.app.domain.dto.KeyUtil;
|
import com.ruoyi.app.domain.dto.KeyUtil;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
@ -132,33 +133,23 @@ public class AlipayService {
|
||||||
// System.out.println(diagnosisUrl);
|
// System.out.println(diagnosisUrl);
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
public String startPay() throws AlipayApiException{
|
public AlipayTradeAppPayResponse startPay(String orderNo,String price) throws AlipayApiException{
|
||||||
try {
|
try {
|
||||||
// 1. 创建AlipayClient实例
|
// 1. 创建AlipayClient实例
|
||||||
AlipayClient alipayClient = new DefaultAlipayClient(getClientParams());
|
AlipayClient alipayClient = new DefaultAlipayClient(getClientParams());
|
||||||
// 2. 创建使用的Open API对应的Request请求对象
|
// 2. 创建使用的Open API对应的Request请求对象
|
||||||
//AlipayOpenOperationOpenbizmockBizQueryRequest request = getRequest();
|
|
||||||
|
|
||||||
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
|
||||||
request.setNotifyUrl(NOTIFY_URL);
|
request.setNotifyUrl(NOTIFY_URL);
|
||||||
//SDK已经封装掉了公共参数,这里只需要传入业务参数。以下方法为sdk的model入参方式(model和biz_content同时存在的情况下取biz_content)。
|
|
||||||
// AlipayTradeAppPayModel model = new AlipayTradeAppPayModel ();
|
|
||||||
// //model.setBody("我是测试数据" );
|
|
||||||
// model.setSubject ( "App支付测试Java" );
|
|
||||||
// model.setOutTradeNo ( KeyUtil.generateUniqueKey() );
|
|
||||||
// //model.setTimeoutExpress ( "30m" );
|
|
||||||
// model.setTotalAmount ( "0.01" );
|
|
||||||
// //model.setProductCode ( "QUICK_MSECURITY_PAY" );
|
|
||||||
// request.setBizModel ( model );
|
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("out_trade_no" , KeyUtil.generateUniqueKey());
|
jsonObject.put("out_trade_no" , orderNo);
|
||||||
jsonObject.put("total_amount",0.01);
|
jsonObject.put("total_amount",price);
|
||||||
jsonObject.put("subject","订单充值");
|
jsonObject.put("subject","订单充值");
|
||||||
request.setBizContent(jsonObject.toString());
|
request.setBizContent(jsonObject.toString());
|
||||||
// 3. 发起请求并处理响应
|
// 3. 发起请求并处理响应
|
||||||
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
|
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
|
||||||
if (response.isSuccess()) {
|
if (response.isSuccess()) {
|
||||||
return response.getBody();
|
return response;
|
||||||
} else {
|
} else {
|
||||||
System.out.println("调用失败,原因:" + response.getMsg() + "," + response.getSubMsg());
|
System.out.println("调用失败,原因:" + response.getMsg() + "," + response.getSubMsg());
|
||||||
}
|
}
|
||||||
|
|
@ -169,31 +160,7 @@ public class AlipayService {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public AlipayTradeCreateResponse startPay(String outTradeNo, String totalAmount) throws AlipayApiException {
|
|
||||||
// 创建客户端
|
|
||||||
AlipayClient alipayClient = new DefaultAlipayClient(
|
|
||||||
ALIPAY_GATEWAY,
|
|
||||||
APP_ID,
|
|
||||||
APP_PRIVATE_KEY,
|
|
||||||
FORMAT,
|
|
||||||
CHARSET,
|
|
||||||
ALIPAY_PUBLIC_KEY,
|
|
||||||
SIGN_TYPE);
|
|
||||||
|
|
||||||
// 创建API请求
|
|
||||||
AlipayTradeCreateRequest alipayRequest = new AlipayTradeCreateRequest();
|
|
||||||
alipayRequest.setNotifyUrl(NOTIFY_URL);
|
|
||||||
|
|
||||||
// 设置请求参数
|
|
||||||
alipayRequest.setBizContent("{" +
|
|
||||||
"\"out_trade_no\":\"" + outTradeNo + "\"," +
|
|
||||||
"\"total_amount\":\"" + totalAmount + "\"," +
|
|
||||||
"\"subject\":\"" + SUBJECT + "\"" +
|
|
||||||
"}");
|
|
||||||
|
|
||||||
// 发起支付请求并获取支付结果
|
|
||||||
return alipayClient.sdkExecute(alipayRequest);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*public static void main(String[] args) throws Exception{
|
/*public static void main(String[] args) throws Exception{
|
||||||
AlipayService alipayService = new AlipayService();
|
AlipayService alipayService = new AlipayService();
|
||||||
|
|
|
||||||
|
|
@ -118,7 +118,6 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AreaVo> children = appCities.stream()
|
List<AreaVo> children = appCities.stream()
|
||||||
.filter(appCity -> !appCity.getId().equals(appCity.getId()))
|
|
||||||
.map(appCity -> {
|
.map(appCity -> {
|
||||||
AreaVo child = new AreaVo();
|
AreaVo child = new AreaVo();
|
||||||
child.setId(appCity.getId());
|
child.setId(appCity.getId());
|
||||||
|
|
@ -132,7 +131,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AreaVo> townChildren = appTowns.stream()
|
List<AreaVo> townChildren = appTowns.stream()
|
||||||
.filter(appTown -> !appTown.getId().equals(appCity.getId())) // Filter out where child id is same as parent id
|
// .filter(!appTown -> !appTown.getId().equals(appCity.getId())) // Filter out where child id is same as parent id
|
||||||
.map(appTown -> {
|
.map(appTown -> {
|
||||||
AreaVo townChild = new AreaVo();
|
AreaVo townChild = new AreaVo();
|
||||||
townChild.setId(appTown.getId());
|
townChild.setId(appTown.getId());
|
||||||
|
|
@ -152,28 +151,7 @@ public class AppProvinceServiceImpl implements IAppProvinceService {
|
||||||
return areaVo;
|
return areaVo;
|
||||||
})
|
})
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
collect.stream().forEach(
|
|
||||||
areaVo -> {
|
|
||||||
if (areaVo.getChildren() == null || areaVo.getChildren().isEmpty()) {
|
|
||||||
areaVo.setIsLeaf(true);
|
|
||||||
}
|
|
||||||
if ( areaVo.getLevel() == 1 && areaVo.getChildren().isEmpty()) {
|
|
||||||
ArrayList<AreaVo> areaVos = new ArrayList<>();
|
|
||||||
AppTown appTown1 = new AppTown();
|
|
||||||
appTown1.setCityId(Long.valueOf(areaVo.getId()));
|
|
||||||
List<AppTown> appTowns1 = appTownMapper.selectAppTownList(appTown1);
|
|
||||||
List<AreaVo> townChildren = appTowns1.stream().map(appTown -> {
|
|
||||||
AreaVo townChild = new AreaVo();
|
|
||||||
townChild.setId(appTown.getId());
|
|
||||||
townChild.setName(appTown.getName());
|
|
||||||
townChild.setLevel(3);
|
|
||||||
townChild.setIsLeaf(true);
|
|
||||||
return townChild;
|
|
||||||
}).collect(Collectors.toList());
|
|
||||||
areaVo.setChildren(townChildren);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
select
|
select
|
||||||
<include refid="appUserColumns"/>,
|
<include refid="appUserColumns"/>,
|
||||||
s.name as "schoolName",
|
s.name as "schoolName",
|
||||||
count(f.user_id) as "fansNum"
|
count(f.user_id) as "fansNum",
|
||||||
|
a.id as "userId"
|
||||||
from app_user a
|
from app_user a
|
||||||
left join app_school s on s.id = a.school
|
left join app_school s on s.id = a.school
|
||||||
left join app_user_fans f on f.user_id = a.id
|
left join app_user_fans f on f.user_id = a.id
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,86 @@
|
||||||
<!-- 动态详情 -->
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<el-descriptions title="动态详情">
|
||||||
这是动态详情页面
|
<el-descriptions-item label="姓名">kooriookami</el-descriptions-item>
|
||||||
</div>
|
<el-descriptions-item label="手机号">18100000000</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="居住地">苏州市</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="备注">
|
||||||
|
<el-tag size="small">学校</el-tag>
|
||||||
|
</el-descriptions-item>
|
||||||
|
<el-descriptions-item label="联系地址">江苏省苏州市吴中区吴中大道 1188 号</el-descriptions-item>
|
||||||
|
</el-descriptions>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import {listDynamic, getDynamic, treeDynamic} from "@/api/app/dynamic";
|
||||||
|
|
||||||
|
|
||||||
|
export default {
|
||||||
|
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
id: '',
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// App用户动态表格数据
|
||||||
|
dynamicList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
|
||||||
|
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
this.getDynamic(this.id);
|
||||||
|
},
|
||||||
|
|
||||||
|
mounted: function () {
|
||||||
|
this.id = this.$route().params.dynamicId;
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listDynamic(this.queryParams).then(response => {
|
||||||
|
this.registerList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
handleDetail(row) {
|
||||||
|
const id = row.id || row.ids;
|
||||||
|
|
||||||
|
this.$router.push({path: '/app/dynamic/detail'});
|
||||||
|
this.queryParams.dynamicId = id;
|
||||||
|
|
||||||
|
treeDynamic(this.queryParams).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "App用户动态详情";
|
||||||
|
|
||||||
|
// Access the data here
|
||||||
|
console.log(this.form); // Or use the data in any way you need
|
||||||
|
});
|
||||||
|
},
|
||||||
|
getDynamic(id){
|
||||||
|
getDynamic(id).then(response => {
|
||||||
|
console.log(response.data);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue