no message

This commit is contained in:
wangh 2023-12-22 18:18:21 +08:00
parent b9bac4a4b0
commit 8148002ce2
11 changed files with 165 additions and 19 deletions

View File

@ -4,6 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import com.fuint.api.fuyou.entity.Const;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.util.Utils;
import com.fuint.business.integral.service.IntegralOrdersService;
import com.fuint.business.order.entity.AllOrderInfo;
import com.fuint.business.order.entity.OilOrder;
import com.fuint.business.order.service.AllOrderInfoService;
@ -27,6 +28,10 @@ public class FyPayController {
@Autowired
@Lazy
private OilOrderService orderService;
@Autowired
@Lazy
private IntegralOrdersService integralOrdersService;
@Autowired
@Lazy
private AllOrderInfoService allOrderInfoService;
@ -56,8 +61,8 @@ public class FyPayController {
allOrderInfoService.updateAllOrderInfo(allOrderInfo);
}
updateOrderStatus(orderNo,allOrderInfo.getType());
// 修改油品订单支付状态
orderService.updateOrderStatus(orderNo,"paid");
redisLock.unlock(orderLock);
}
// transaction_id 加锁
@ -66,4 +71,13 @@ public class FyPayController {
return "0";
}
}
public void updateOrderStatus(String orderNo,String type){
if ("油品订单".equals(type)) {
orderService.updateOrderStatus(orderNo,"paid");
}else if ("积分订单".equals(type)) {
integralOrdersService.editPayStatus(orderNo,"paid",-1);
integralOrdersService.checkTheStatusOfYourPaymentByIntegral(orderNo);
}
}
}

View File

@ -128,6 +128,15 @@ public class IntegralOrdersController extends BaseController {
}
/**
* 更改状态
* @return
*/
@GetMapping("/editPayStatus")
public ResponseObject editPayStatus(String orderNo, String payStates,Integer storeId) {
return getSuccessResult(this.integralOrdersService.editPayStatus(orderNo,payStates,storeId));
}
/**
*
* 礼品订单

View File

@ -100,5 +100,6 @@ public interface IntegralOrdersMapper {
int editPayStatus(@Param("orderNumber") String orderNumber,@Param("payStates") String payStates, @Param("storeId") Integer storeId );
// int editPayStatus(@Param("orderNumber") String orderNumber,@Param("payStates") String payStates, @Param("storeId") Integer storeId );
}

View File

@ -72,7 +72,8 @@ public interface IntegralOrdersService {
int editPayStatus(String orderNumber, String payStates,Integer storeId);
IntegralOrders integralOrdersProcessingUni(IntegralOrdersRequest integralOrdersList);
Map<String, Object> integralOrdersProcessingUni(IntegralOrdersRequest integralOrdersList);
}

View File

@ -3,6 +3,7 @@ package com.fuint.business.integral.service.impl;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.fuint.api.fuyou.entity.MerchantConfig;
import com.fuint.api.fuyou.entity.ReceiveParameter;
import com.fuint.api.fuyou.service.FyPayService;
import com.fuint.api.fuyou.service.MerchantConfigService;
import com.fuint.business.integral.dto.IntegralOrdersDTO;
@ -296,16 +297,20 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
return integralOrdersDao.editPayStatus(orderNumber,payStates,storeId);
}
@Override
public IntegralOrders integralOrdersProcessingUni(IntegralOrdersRequest integralOrdersList) {
public Map<String, Object> integralOrdersProcessingUni(IntegralOrdersRequest integralOrdersList) {
double epsilon = 1e-10; // 阈值
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
Map<String, Object> applet = null;
// 首先判断是否足够积分
LJUserVo ljUserVos = ljUserMapper.selectAllInfoById2(nowAccountInfo.getId(),integralOrdersList.getChainStoreId());
if (ljUserVos.getPoints() < integralOrdersList.getAllPoints()) {
integralOrdersList.getIntegralOrdersList().get(0).setStatus("un");
return integralOrdersList.getIntegralOrdersList().get(0);
applet.put("code","error");
return applet;
}
// 插入订单
@ -344,11 +349,35 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
&& "unpaid".equals(status)){
flag = true;
}
// Map<String, Object> applet = null;
// 支付
if (flag) {}
if (flag) {
// 调用支付接口
// 判断是否开启支付规则
List<MerchantConfig> list = merchantConfigService.selectMeChByIsOpen();
// if (list.size() > 0) {
// oilConfigService.oilRule();
// }
// 处理支付需要的数据
ReceiveParameter receiveParameter = new ReceiveParameter();
receiveParameter.setOrderNo(orderNo);
receiveParameter.setType("积分订单");
receiveParameter.setContent("积分订单");
receiveParameter.setGoodsMoney(integralOrdersList.getAllAmout());
receiveParameter.setStoreId(integralOrdersList.getStoreId());
receiveParameter.setPayType(integralOrdersList.getPaymentType());
receiveParameter.setUserId(nowAccountInfo.getId());
// 调用支付接口
try {
applet = fyPayService.applet(receiveParameter);
applet.put("orderNo",orderNo);
} catch (Exception e) {
e.printStackTrace();
}
}
return null;
return applet;
}
}

View File

@ -65,7 +65,10 @@ public class IntegralSettingsServiceImpl implements IntegralSettingsService {
@Override
public IntegralSettings getByStoreId(Integer id) {
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
return this.integralSettingsMapper.getByStoreId(nowAccountInfo.getStoreId());
if (ObjectUtil.isEmpty(id)) {
id = nowAccountInfo.getStoreId();
}
return this.integralSettingsMapper.getByStoreId(id);
}
/**

View File

@ -227,7 +227,7 @@
chainStoreId: uni.getStorageSync('chainStoreId')
}
}).then((res) => {
if (res.code == 200) {
if (res.code == 200 && res.data) {
this.myPoints = res.data.points
}
})

View File

@ -7,6 +7,10 @@
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<u-empty text="积分明细" v-if="detailList.length == 0" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
<view class="m-box" v-for="(item,index) in detailList" :key="index">
<view class="">
<view class="title" v-if="item.changeType == 1">{{item.changeReason}}</view>
@ -17,8 +21,7 @@
<view class="sc-nmb" v-else>{{item.pointsChange}}</view>
</view>
<!-- 判断根据实际情况而改 -->
<u-empty text="积分明细" v-if="mingList.length == 0" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
<u-loadmore :status="status" v-if="show == true" />
</view>
</view>
@ -171,4 +174,4 @@
font-weight: 500;
color: #F52D22;
}
</style>
</style>

View File

@ -7,10 +7,11 @@
<view class="my-icons"></view>
</view>
<!-- 顶部区域 -->
<u-empty v-if="!setting.pointsRules" style="margin: 5px auto;" mode="data"
icon="http://cdn.uviewui.com/uview/empty/data.png">
</u-empty>
<view class="centen-siez">
<u-parse :content="setting.pointsRules"></u-parse>
</view>
</view>
</view>
@ -24,6 +25,8 @@
return {
title: '',
setting: {},
storeId: uni.getStorageSync('storeId'),
pointsRules: '',
}
},
@ -39,10 +42,13 @@
//
// business/integral/integralSettings/getSettings
getSettings() {
console.log("store", this.storeId)
request({
url: '/business/integral/integralSettings/getByStoreId',
method: 'get',
// params:data
params: {
storeId: this.storeId
}
}).then((res) => {
if (res.code == 200) {
this.setting = res.data

View File

@ -15,6 +15,10 @@
</view>
</view>
<u-empty text="积分订单" v-if="orderList.length == 0" icon="http://cdn.uviewui.com/uview/empty/list.png">
</u-empty>
<view class="goods-box" v-for="(item,index) in orderList" :key="item.id" @click="orderDetails(item)">
<view class="goods-top">
<view class="goods-img">

View File

@ -98,7 +98,7 @@
<view style="color: #9d9d9d; font-size: 12px; ">积分账户{{myPoints}}</view>
</view>
<view class="andeniu">
<text>选择</text>
<text @click="choose()">选择</text>
</view>
</view>
@ -129,10 +129,14 @@
baseUrl: config.baseUrl,
allPoints: 0,
allAmout: 0,
orderInfo: {},
addrInfo: {
address: ''
},
paymentType: '',
// chainStoreId: uni.getStorageSync('chainStoreId'),
storeId: uni.getStorageSync('storeId'),
chainStoreId: 1,
tapList: [{
text: '到店自提'
},
@ -186,6 +190,78 @@
methods: {
// //
async choose() {
let _this = this
let integralOrdersList = []
let integralOrders = {
giftId: this.goodsInfo.id,
amount: _this.allAmout,
integral: _this.myPoints,
exchangeQuantity: _this.value,
orderType: 1,
paymentType: _this.paymentType
}
integralOrdersList.push(integralOrders)
request({
url: "business/integral/integralOrders/integralOrdersProcessingUni",
method: 'post',
data: {
integralOrdersList: integralOrdersList,
// authCode:this_.authCode,
// paymentType: _this.paymentType,
paymentType: "WECHAT",
allAmout: _this.allAmout,
allPoints: _this.myPoints,
chainStoreId: _this.chainStoreId,
storeId: _this.storeId,
},
}).then(res => {
if (res.code === 200) {
console.log(res)
let payProvider = "wxpay"
_this.orderInfo = JSON.parse(res.data.data.reservedPayInfo);
uni.requestPayment({
// provider: 'wxpay' 'alipay'
provider: payProvider,
timeStamp: _this.orderInfo.timeStamp,
nonceStr: _this.orderInfo.nonceStr,
package: _this.orderInfo.package,
signType: 'MD5',
paySign: _this.orderInfo.paySign,
success: function(res) {
console.log('success:', res);
uni.reLaunch({
url: '/pagesRefuel/orderSuccess/index'
})
},
fail: function(err) {
// request({
// url: "business/oilOrder/orderStatus",
// method: 'post',
// data: {
// "orderNo": res.data.data.orderNo,
// "status": "payFail"
// },
// }).then((res) => {
// uni.showToast({
// title: "!",
// icon: "error"
// })
// })
// console.log('fail:', err);
}
});
}
})
},
dataProcessing() {
if (this.goodsInfo.deliveryMethod != null && this.goodsInfo.deliveryMethod != undefined) {
const deliveryData = JSON.parse(this.goodsInfo.deliveryMethod);
@ -203,7 +279,8 @@
console.log('当前值为123: ' + this.goodsInfo.remainingInventory)
//
if (e.value >= this.goodsInfo.remainingInventory && this.goodsInfo.remainingInventory != -1) { // -1
if (e.value >= this.goodsInfo.remainingInventory && this.goodsInfo.remainingInventory != -
1) { // -1
e.value = this.goodsInfo.remainingInventory
this.value = this.goodsInfo.remainingInventory
this.flag = true
@ -324,7 +401,7 @@
url: '/business/userManager/user/getByUniApp',
method: 'get',
params: {
chainStoreId: uni.getStorageSync('chainStoreId')
chainStoreId: this.chainStoreId
}
}).then((res) => {
if (res.code == 200) {
@ -349,7 +426,6 @@
},
// storeId
getInfoByStoreId() {
console.log("helllllllllllllllllllllllllo")
request({
url: '/business/storeInformation/store/storeInfoUni',
method: 'get',