This commit is contained in:
cun-nan 2024-05-29 11:05:24 +08:00
parent 39d6919db3
commit 70d1a50a04
13 changed files with 325 additions and 74 deletions

View File

@ -140,26 +140,26 @@ public class FyPayController {
String orderLock = "orderLock_notify"+orderNo;
if (redisLock.tryLock(orderLock,5000, TimeUnit.MILLISECONDS)){
// 业务逻辑 判断订单状态
// AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
// if (ObjectUtil.isNotEmpty(allOrderInfo)){
// allOrderInfo.setPayMoney(Double.valueOf(settleOrderAmt)/100);
// allOrderInfo.setTransactionId(transactionId);
// allOrderInfo.setStatus("paid");
// allOrderInfo.setPayTime(new Date());
// allOrderInfoService.updateAllOrderInfo(allOrderInfo);
//
// // 修改配置收款账户余额信息
// MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId());
// Double beforeAmount = merchantConfig.getAmount();
// Double afterAmount = beforeAmount + allOrderInfo.getPayMoney();
// merchantConfig.setAmount(afterAmount);
// merchantConfigService.updateMerch(merchantConfig);
// merchantConfigRecordService.updateMerchantConfigRecordByOrderNo(orderNo,"yes");
// }
//
// updateOrderStatus(orderNo,allOrderInfo.getType());
//// 修改订单支付状态
// redisLock.unlock(orderLock);
AllOrderInfo allOrderInfo = allOrderInfoService.selectAllOrderInfoByOrderNo(orderNo);
if (ObjectUtil.isNotEmpty(allOrderInfo)){
allOrderInfo.setPayMoney(Double.valueOf(settleOrderAmt)/100);
allOrderInfo.setTransactionId(transactionId);
allOrderInfo.setStatus("paid");
allOrderInfo.setPayTime(new Date());
allOrderInfoService.updateAllOrderInfo(allOrderInfo);
// 修改配置收款账户余额信息
MerchantConfig merchantConfig = merchantConfigService.selectMeChByIdIsUse(allOrderInfo.getStoreId());
Double beforeAmount = merchantConfig.getAmount();
Double afterAmount = beforeAmount + allOrderInfo.getPayMoney();
merchantConfig.setAmount(afterAmount);
merchantConfigService.updateMerch(merchantConfig);
merchantConfigRecordService.updateMerchantConfigRecordByOrderNo(orderNo,"yes");
}
updateOrderStatus(orderNo,allOrderInfo.getType());
// 修改订单支付状态
redisLock.unlock(orderLock);
}
// transaction_id 加锁
return "1";

View File

@ -50,8 +50,8 @@ public class Const {
//小程序异步通知(回调地址)
// public static String notify_url = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notify";
public static String notify_url = "http://k40180f897.goho.co/api/fyPay/notify";
// public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
// public static String notify_url = "http://k40180f897.goho.co/api/fyPay/notify";
public static String notify_url = "https://8q4f124343.yicp.fun/api/fyPay/notify";
//主扫异步通知(回调地址)
// public static String notify_url_scan = "https://www.tuofeng.cc/oilAdmin/api/fyPay/notifyScan";

View File

@ -824,6 +824,7 @@ public class FyPayServiceImpl implements FyPayService {
map.put("random_str", "orderNo");
map.put("order_type", receiveParameterPos.getPayType());
map.put("goods_des", receiveParameterPos.getContent());
map.put("goods_detail", receiveParameterPos.getContent());
double amount = receiveParameterPos.getGoodsMoney() * 100;
map.put("order_amt", String.valueOf((int) amount));
String nowtime = DateUtil.format(new Date(), "yyyyMMddHHmmss");
@ -834,6 +835,18 @@ public class FyPayServiceImpl implements FyPayService {
Const.INS_PUBLIC_KEY = publicKey;
Const.INS_PRIVATE_KEY = privateKey;
if (ObjectUtil.isNotEmpty(merchantConfig)) {
// 添加配置记录信息
MerchantConfigRecord merchantConfigRecord = new MerchantConfigRecord();
merchantConfigRecord.setMerchantId(merchantConfig.getId());
merchantConfigRecord.setIsSuccess("no");
merchantConfigRecord.setAmount(receiveParameterPos.getGoodsMoney());
merchantConfigRecord.setType("0");
merchantConfigRecord.setStoreId(merchantConfig.getStoreId());
merchantConfigRecord.setOrderNo(receiveParameterPos.getOrderNo());
merchantConfigRecordService.insertMerchantConfigRecord(merchantConfigRecord);
}
// 请求报文
String reqBody = Message.requestMsg(map);
// 响应报文
@ -844,6 +857,13 @@ public class FyPayServiceImpl implements FyPayService {
String str = resMap.get("sign");
if (Utils.verifySign(resMap, str)) {
OilOrder oilOrder = oilOrderService.selectOilOrderByOrderNo(receiveParameterPos.getOrderNo());
ReceiveParameter receiveParameter = new ReceiveParameter();
BeanUtils.copyProperties(receiveParameterPos, receiveParameter);
// 添加订单信息
Double discountAmount = 0.0;
if (ObjectUtil.isNotEmpty(oilOrder)) discountAmount = oilOrder.getDiscountAmount();
this.insertAllOrderInfo(receiveParameter, discountAmount);
System.out.println(resMap);
}
return resMap;

View File

@ -342,4 +342,14 @@ public class OilOrderController extends BaseController {
public ResponseObject addOrderPos(@RequestBody OilOrderVo oilOrderVo) throws Exception {
return getSuccessResult(orderService.addOrderPos(oilOrderVo));
}
/**
* pos端扫码支付
* @param oilOrderVo
* @return
*/
@PostMapping("addOrderScanPos")
public ResponseObject addOrderScanPos(@RequestBody OilOrderVo oilOrderVo) throws Exception {
return getSuccessResult(orderService.addOrderPosScan(oilOrderVo));
}
}

View File

@ -222,5 +222,5 @@ public interface OilOrderService extends IService<OilOrder> {
* @param oilOrderVo
* @return
*/
Map<String, String> addOrderPosScan(OilOrderVo oilOrderVo) throws Exception;
Map<String, Object> addOrderPosScan(OilOrderVo oilOrderVo) throws Exception;
}

View File

@ -1727,7 +1727,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
int row = 0;
OilOrder oilOrder = this.selectOilOrderByOrderNo(orderNo);
Integer userId = oilOrder.getUserId();
LJUser user = userService.queryUserByUserId(userId);
LJUser user = null;
if (ObjectUtil.isNotEmpty(userId)) user = userService.queryUserByUserId(userId);
if (ObjectUtil.isNotEmpty(oilOrder)) {
// oilOrder.setPayAmount(oilOrder.getOrderAmount()-oilOrder.getDiscountAmount());
oilOrder.setOrderStatus(status);
@ -1781,14 +1782,16 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
cardValueChildOrder.setPayTime(new Date());
cardValueChildOrderService.updateCardValueChildOrder(cardValueChildOrder);
if (ObjectUtil.isNotEmpty(user)) {
// 查询主卡信息
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), oilOrder.getStoreId());
userId = cardValudChildrens.getUserId();
CardValudChildrens cardValudChildrens = cardValudChildrensService.selectCardValueChildrenByMobileAndStoreId(user.getMobile(), oilOrder.getStoreId());
userId = cardValudChildrens.getUserId();
}
}
this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), null, oilOrder.getStoreId(), orderNo);
if (ObjectUtil.isNotEmpty(userId)) this.updateGrowthValue(oilOrder.getOrderAmount(), oilOrder.getPayAmount(), userId, Integer.valueOf(oilOrder.getOils()), null, oilOrder.getStoreId(), orderNo);
this.addOilTracks(oilOrder, oilOrder.getStoreId());
this.updateCardAndActiveById(oilOrder.getStoreId(), oilOrder.getUserId(), oilOrder.getActiveId(), oilOrder.getCouponId(), oilOrder.getActiveType(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), Integer.valueOf(oilOrder.getOils()));
this.insertCardBalance(oilOrder.getOrderAmount() - oilOrder.getDiscountAmount() - oilOrder.getPayAmount(), userId, oilOrder.getStoreId(), orderNo);
if (ObjectUtil.isNotEmpty(userId)) this.insertCardBalance(oilOrder.getOrderAmount() - oilOrder.getDiscountAmount() - oilOrder.getPayAmount(), userId, oilOrder.getStoreId(), orderNo);
if (ObjectUtil.isNotEmpty(oilOrder.getStaffId()))
staffCommissionService.countStaffCommission(oilOrder.getStaffId(), oilOrder.getStoreId(), oilOrder.getOrderAmount(), oilOrder.getPayAmount(), "1", orderNo);
}
@ -2385,7 +2388,7 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
this.addOilTracks(oilOrderVo, nowAccountInfo.getStoreId());
this.updateCardAndActiveById(nowAccountInfo.getStoreId(), oilOrderVo.getUserId(), oilOrderVo.getActiveId(), oilOrderVo.getCouponId(), oilOrderVo.getActiveType(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), Integer.valueOf(oilOrderVo.getOils()));
this.insertAllOrderInfo(orderNo, nowAccountInfo.getStoreId(), oilOrderVo.getOrderAmount(), oilOrderVo.getPayAmount(), oilOrderVo.getDiscountAmount(), oilOrderVo.getPayType(), oilOrderVo.getUserId(), "POS", "1", "paid");
this.insertFavorable(oilOrderVo, oilOrderVo.getOilCardAmount());
this.insertFavorable(oilOrderVo, oilOrderVo.getOilCardAmount1());
if (ObjectUtil.isNotEmpty(oilOrderVo.getUserId())) integralSettingsService.refuelPoints(oilOrderVo);
//修改优惠券使用状态
if (oilOrderVo.getCouponId() != null) {
@ -2406,8 +2409,8 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
}
@Override
public Map<String, String> addOrderPosScan(OilOrderVo oilOrderVo) throws Exception {
Map<String, String> res = new HashMap<>();
public Map<String, Object> addOrderPosScan(OilOrderVo oilOrderVo) throws Exception {
Map<String, Object> res = new HashMap<>();
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
// 根据日期生成订单信息
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
@ -2415,23 +2418,34 @@ public class OilOrderServiceImpl extends ServiceImpl<OilOrderMapper, OilOrder> i
String randomString = UUID.randomUUID().toString().replace("-", "").substring(0, 6);
String orderNo = "2345" + timestamp + randomString;
oilOrderVo.setOrderNo(orderNo);
oilOrderVo.setStoreId(nowAccountInfo.getStoreId());
oilOrderVo.setStaffId(nowAccountInfo.getStaffId());
oilOrderVo.setTerminal("POS");
oilOrderVo.setOrderStatus("unpaid");
oilOrderVo.setOrderType("主订单");
int row = baseMapper.insert(oilOrderVo);
if (ObjectUtil.isNotEmpty(oilOrderVo.getOrderNo())){
OilOrder oilOrder = this.selectOilOrderByOrderNo(oilOrderVo.getOrderNo());
oilOrderVo.setId(oilOrder.getId());
oilOrderVo.setOrderNo(orderNo);
baseMapper.updateById(oilOrderVo);
}else {
oilOrderVo.setOrderNo(orderNo);
baseMapper.insert(oilOrderVo);
}
ReceiveParameterPos receiveParameterPos = new ReceiveParameterPos();
// receiveParameterPos.setPayType("WECHAT");
receiveParameterPos.setPayType(oilOrderVo.getPayType());
receiveParameterPos.setType("1");
receiveParameterPos.setContent("油品订单");
receiveParameterPos.setOrderNo(orderNo);
receiveParameterPos.setStoreId(oilOrderVo.getStoreId());
receiveParameterPos.setStoreId(oilOrderVo.getUserId());
receiveParameterPos.setUserId(oilOrderVo.getUserId());
receiveParameterPos.setGoodsMoney(oilOrderVo.getPayAmount());
receiveParameterPos.setOilCardAmount(oilOrderVo.getOilCardAmount1());
Map<String, String> mainScan = fyPayService.mainScan(receiveParameterPos);
return mainScan;
res.put("oilOrder",this.selectOilOrderByOrderNo(orderNo));
res.put("scanCode",mainScan);
return res;
}
}

View File

@ -1,20 +1,23 @@
{ // launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version": "0.0",
"configurations": [{
"app-plus" :
{
"launchtype" : "local"
},
"default" :
{
"launchtype" : "local"
},
"mp-weixin" :
{
"launchtype" : "local"
},
"type" : "uniCloud"
}
{
// launch.json configurations app-plus/h5/mp-weixin/mp-baidu/mp-alipay/mp-qq/mp-toutiao/mp-360/
// launchtypelocalremote, localremote
"version" : "0.0",
"configurations" : [
{
"app-plus" : {
"launchtype" : "local"
},
"default" : {
"launchtype" : "local"
},
"mp-weixin" : {
"launchtype" : "local"
},
"type" : "uniCloud"
},
{
"playground" : "standard",
"type" : "uni-app:app-android"
}
]
}

View File

@ -117,7 +117,7 @@
},
goCode() {
uni.navigateTo({
url: '/pagesHome/PaymentCode/PaymentCode'
url: '/pagesHome/PaymentCode/SetUpCode'
})
},
gochangeShifts() {

View File

@ -39,7 +39,6 @@
:key="index" @click="getspearIndex(index,item)">
{{item.gunName}}
</view>
</view>
<view style="width: 100%; height: 500px; "></view>
<view class="bai-kuang">
@ -85,8 +84,8 @@
<u--textarea v-model="value1" placeholder="请输入内容"></u--textarea>
<view
style="width: 100%; display: flex;align-items: center;justify-content: space-around;margin-top: 20px; ">
<view class="anniuq">确定</view>
<view class="anniux">取消</view>
<view class="anniuq" @click="submitRemark()">确定</view>
<view class="anniux" @click="close">取消</view>
</view>
</view>
</u-popup>
@ -228,6 +227,11 @@
headers
},
methods: {
//
submitRemark(){
this.show = false
this.oilOrder.remark = this.value1
},
close() {
this.show = false
},
@ -446,9 +450,12 @@
this.oilOrder.tankId = this.tankId
this.oilOrder.oilPrice = this.oilPrice
this.oilOrder.oilCardAmount1 = this.oilCardAmount
this.oilOrder.userId = this.userInfo.id
this.oilOrder.oilGunNum = this.oilGunNum
this.oilOrder.payUser = this.userInfo.mobile
if (this.userInfo){
this.oilOrder.userId = this.userInfo.id
this.oilOrder.payUser = this.userInfo.mobile
}
request({
url: "business/oilOrder/addOrderPos",
method: 'post',
@ -463,7 +470,7 @@
// })
uni.navigateTo({
url: "/pagesHome/PaymentResults/PaymentResults"
url: "/pagesHome/PaymentResults/PaymentResults?orderNo="+this.orderNo
})
} else if (res.data.code == 2) {
uni.showToast({

View File

@ -22,11 +22,16 @@
data() {
return {
titles: "刷卡支付",
orderNo:"",
qrCode:"",
}
},
onLoad() {
onLoad(e) {
this.orderNo = e.orderNo
this.qrCode = uni.getStorageSync("qrCode")
console.log(this.qrCode);
this.onReady()
},
onShow() {
// this.actList = ["1", "1", "1", "1", "1", ]
@ -49,14 +54,14 @@
//
setAmount() {
uni.navigateTo({
url: "/pagesHome/PaymentCode/SetUpCode"
url: "/pagesHome/PaymentCode/SetUpCode?orderNo="+this.orderNo
})
},
onReady() {
// uQRCode
var qr = new UQRCode();
//
qr.data = "https://uqrcode.cn/doc";
qr.data = this.qrCode;
// canvas
qr.size = 200;
//

View File

@ -4,30 +4,73 @@
<headers :titles="titles"><u-icon name="arrow-left" color="#fff" size="22"></u-icon></headers>
<view class="b-box">
<view class="">金额</view>
<view style="text-align: right;"><input type="text" placeholder="请输入金额" /></view>
<view style="text-align: right;"><input type="text" v-model="oilOrder.orderAmount" placeholder="请输入金额" /></view>
</view>
<view class="b-box">
<view class="">备注</view>
<view style="text-align: right;"><input type="text" placeholder="请输入备注" /></view>
<view style="text-align: right;"><input type="text" v-model="oilOrder.remark" placeholder="请输入备注" /></view>
</view>
<view class="title_">选择油枪</view>
<view class="warp-box">
<view class="w-box" :class="{ 'acv' : spearIndex == index }" v-for="(item,index) in spearList"
:key="index" @click="getspearIndex(index,item)">
{{item.gunName}}
</view>
</view>
<view class="title_">选择支付方式</view>
<view class="warp-box">
<view class="w-box" :class="{ 'acv' : payIndex == index }" v-for="(item,index) in payList"
v-if="item.dictValue != 'CASH' && item.dictValue != 'APPLET_CODE'"
style="width: 100px;"
:key="index" @click="getpayIndex(index,item)">
{{item.dictLabel}}
</view>
</view>
<view class="bottom-b"></view>
<view class="p-bottom" @click="addOrder()">
<view class="anniu">
确定
</view>
</view>
</view>
</view>
</template>
<script>
import request from "../../utils/request";
import headers from '../../components/header/headers.vue'
export default {
data() {
return {
titles: "设置金额",
spearList: [
"1号枪", "2号枪", "3号枪"
],
spearIndex: 0,
payList:[],
payIndex:0,
oilName: "",
tankId: "",
oilPrice: "",
oilGunNum: "",
oilOrder:{},
orderNo:"",
qrCode:"",
}
},
onLoad(e) {
uni.removeStorageSync("qrCode")
this.orderNo = e.orderNo
},
onShow() {
// this.actList = ["1", "1", "1", "1", "1", ]
// this.status = "nomore"
this.getOilGun()
this.getPayList()
},
onPullDownRefresh() {
console.log("刷新");
@ -43,6 +86,64 @@
headers
},
methods: {
//
addOrder(){
if (this.orderNo) this.oilOrder.orderNo = this.orderNo
this.oilOrder.payAmount = this.oilOrder.orderAmount
this.oilOrder.oils = this.oilName
this.oilOrder.tankId = this.tankId
this.oilOrder.oilPrice = this.oilPrice
this.oilOrder.oilGunNum = this.oilGunNum
request({
url: 'business/oilOrder/addOrderScanPos',
method: 'post',
data:this.oilOrder
}).then((res) => {
this.orderNo = res.data.oilOrder.orderNo
this.qrCode = res.data.scanCode.qr_code
uni.setStorageSync("qrCode",this.qrCode)
uni.navigateTo({
url:"/pagesHome/PaymentCode/PaymentCode?orderNo="+this.orderNo
})
})
},
//
getOilGun() {
request({
url: 'business/petrolStationManagement/oilGun/queryOilGunList',
method: 'get',
}).then((res) => {
this.spearList = res.data
if (this.spearList.length > 0) {
this.oilGunNum = this.spearList[0].id
this.oilName = this.spearList[0].oilName
this.tankId = this.spearList[0].tankId
this.oilPrice = this.spearList[0].oilPrice
}
})
},
getspearIndex(num, data) {
this.spearIndex = num
this.oilGunNum = data.id
this.oils = data.oilName
this.tankId = data.tankId
this.oilPrice = data.oilPrice
},
//
getPayList(){
request({
url: '/system/dict/data/type/payment_type',
method: 'get',
}).then((res) => {
this.payList = res.data
this.oilOrder.payType = res.data[0].dictValue
})
},
getpayIndex(num, data) {
this.payIndex = num
this.oilOrder.payType = data.dictValue
},
goback() {
uni.navigateBack()
}
@ -84,4 +185,65 @@
box-sizing: border-box;
padding: 10px;
}
.bottom-b {
width: 100%;
height: 68px;
}
.p-bottom {
width: 100%;
height: 68px;
background: #fff;
position: fixed;
bottom: 0px;
left: 0px;
}
.anniu {
height: 40px;
background: #0864E9;
width: 80%;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
border-radius: 50px;
margin: 5px auto;
}
.title_ {
font-weight: bold;
font-size: 16px;
color: black;
width: 95%;
margin: 10px auto;
}
.warp-box {
width: 95%;
margin: 10px auto;
display: flex;
align-items: center;
flex-wrap: wrap;
}
.w-box {
width: 60px;
height: 32px;
background: #FFFFFF;
border-radius: 6px 6px 6px 6px;
display: flex;
align-items: center;
justify-content: center;
font-weight: 500;
font-size: 14px;
color: #333333;
margin-right: 10px;
}
.acv {
background: #E8F5FF !important;
color: #0864E9 !important;
}
</style>

View File

@ -6,21 +6,33 @@
<image src="../../static/imgs/zfcg.png" mode=""></image>
</view>
<view class="title_">支付成功</view>
<!-- <view class="top_" v-if="oilOrder.orderStatus!='paid'">
<image src="../../static/imgs/zfsb.png" mode=""></image>
</view>
<view class="title_" v-if="oilOrder.orderStatus!='paid'">支付失败</view> -->
<view class="b-bs">
<view class="h-size">应收金额</view>
<view class="red-size">200.00</view>
<view class="red-size">{{oilOrder.orderAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">优惠金额</view>
<view class="red-size">200.00</view>
<view class="red-size">{{oilOrder.discountAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">实收金额</view>
<view class="red-size">200.00</view>
<view class="red-size">{{oilOrder.payAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">储值卡消费金额</view>
<view class="red-size">{{oilOrder.balanceAmount}}</view>
</view>
<view class="b-bs">
<view class="h-size">支付方式</view>
<view class="h-size">现金支付</view>
<view class="h-size" v-if="oilOrder.payType=='ALIPAY'">支付宝支付</view>
<view class="h-size" v-if="oilOrder.payType=='WECHAT'">微信支付</view>
<view class="h-size" v-if="oilOrder.payType=='UNIONPAY'">银联二维码支付</view>
<view class="h-size" v-if="oilOrder.payType=='CASH'">现金支付</view>
<view class="h-size" v-if="oilOrder.payType=='APPLET_CODE'">小程序码支付</view>
</view>
</view>
<view class="p-bottom">
@ -32,18 +44,24 @@
</template>
<script>
import request from "../../utils/request";
import headers from '../../components/header/headers.vue'
export default {
data() {
return {
titles: "支付结果",
orderNo:"",
oilOrder:{},
}
},
onLoad(e) {
this.orderNo = e.orderNo
},
onShow() {
// this.actList = ["1", "1", "1", "1", "1", ]
// this.status = "nomore"
this.getOilOrder()
},
onPullDownRefresh() {
console.log("刷新");
@ -59,8 +77,20 @@
headers
},
methods: {
//
getOilOrder(){
request({
url: '/business/oilOrder/orderNo',
method: 'post',
data:{orderNo:this.orderNo}
}).then((res) => {
this.oilOrder = res.data
})
},
goback() {
uni.navigateBack()
uni.navigateTo({
url:"/pages/index/index"
})
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB