Merge branch 'master' of http://192.168.31.244:3000/byx/oilSystem
This commit is contained in:
commit
1c3248a275
@ -21,9 +21,12 @@ import com.fuint.business.marketingActivity.cardFule.entity.CardFuelRecord;
|
||||
import com.fuint.business.marketingActivity.cardFule.service.CardFuelRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValue.entity.CardValueRecord;
|
||||
import com.fuint.business.marketingActivity.cardValue.service.CardValueRecordService;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.business.order.entity.*;
|
||||
import com.fuint.business.order.service.*;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.LJUserService;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.business.userManager.vo.LJUserVo;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
@ -57,6 +60,12 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
@Resource
|
||||
private IntegralSettingsService integralSettingsService;
|
||||
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
|
||||
@Resource
|
||||
private CardValueOrdersService cardValueOrdersService;
|
||||
|
||||
/**
|
||||
* 条码支付
|
||||
*
|
||||
@ -185,6 +194,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
List<ReturnRecord> returnRecords = returnRecordService.selectReturnRecordByOrderNo(orderNo);
|
||||
Date date = new Date();
|
||||
if (reqMap.get("trans_stat").equals("SUCCESS")) {
|
||||
|
||||
payStatus = "paid";
|
||||
if (!ObjectUtil.isEmpty(oilOrder)) {
|
||||
// 油品订单
|
||||
@ -281,6 +291,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
if ("CVR".equals(type)) {
|
||||
payStates = "paid";
|
||||
receiveParameter.setType("2");
|
||||
|
||||
if (ObjectUtil.isNotEmpty(goodsOrder) && ObjectUtil.isNotEmpty(goodsOrder.getUserId())) {
|
||||
receiveParameter.setUserId(goodsOrder.getUserId());
|
||||
}
|
||||
@ -290,6 +301,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CFR".equals(type)) {
|
||||
payStates = "paid";
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
}
|
||||
if ("IOS".equals(type)) { // 积分商城
|
||||
payStates = "paid";
|
||||
@ -338,6 +350,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CFR".equals(type)) {
|
||||
payStates = "payFail";
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
}
|
||||
if ("IOS".equals(type)) {
|
||||
payStates = "payFail";
|
||||
@ -383,6 +396,8 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
}
|
||||
if ("CVR".equals(type) && !ObjectUtil.isEmpty(map1.get("orderId"))) {
|
||||
// 储值卡
|
||||
|
||||
|
||||
Integer id = Integer.parseInt(map1.get("orderId"));
|
||||
cardValueRecordService.editPayStatus(id, payStates);
|
||||
|
||||
@ -397,7 +412,7 @@ public class FyPayServiceImpl implements FyPayService {
|
||||
// 囤油卡
|
||||
Integer id = Integer.parseInt(map1.get("orderId"));
|
||||
cardFuelRecordService.editPayStatus(id, payStates);
|
||||
|
||||
cardValueOrdersService.updateBalance(orderNo,payStatus);
|
||||
CardFuelRecord cardFuelRecord = cardFuelRecordService.queryById(id);
|
||||
receiveParameter.setType("5");
|
||||
if (cardFuelRecord.getMtUserId() != null) {
|
||||
|
@ -221,8 +221,16 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
CardFuelRecord cardFuelRecord = new CardFuelRecord();
|
||||
|
||||
if (ObjectUtils.isNotEmpty(cardFuelRecords)){
|
||||
Optional<CardFuelRecord> max = cardFuelRecords.stream().max(Comparator.comparing(CardFuelRecord::getLockupPrice));
|
||||
cardFuelRecord = max.get();
|
||||
ArrayList<CardFuelRecord> list = new ArrayList<>();
|
||||
for (CardFuelRecord fuelRecord : cardFuelRecords) {
|
||||
if (ObjectUtils.isNotEmpty(fuelRecord.getLockupPrice())){
|
||||
list.add(fuelRecord);
|
||||
}
|
||||
}
|
||||
if (ObjectUtils.isNotEmpty(list)){
|
||||
Optional<CardFuelRecord> max = list.stream().max(Comparator.comparing(CardFuelRecord::getLockupPrice));
|
||||
cardFuelRecord = max.get();
|
||||
}
|
||||
}
|
||||
CardFuelDiesel cardFuelDiesel = cardFuelDieselService.getById(cardFuelRecord.getCardFuelId());
|
||||
|
||||
@ -292,6 +300,9 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService {
|
||||
map.put("privateKey", merchantConfig.getPrivateKey());
|
||||
map.put("type", "CFR");
|
||||
map.put("orderId", cardFuelRecordDTO.getId().toString());
|
||||
map.put("userId", cardFuelRecordDTO.getMtUserId().toString());
|
||||
map.put("storeId", cardFuelRecordDTO.getStoreId().toString());
|
||||
map.put("storeId", nowAccountInfo.getStoreId().toString());
|
||||
// 调用支付接口
|
||||
try {
|
||||
fyPayService.pay(map);
|
||||
|
@ -33,5 +33,7 @@ public interface CardValueOrdersService extends IService<CardValueOrders> {
|
||||
* @param status 支付状态
|
||||
*/
|
||||
void updateOrderStatus(String orderNo,String status);
|
||||
|
||||
void updateBalance(String orderNo,String status);
|
||||
}
|
||||
|
||||
|
@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.mapper.CardValueOrdersMapper;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.service.CardValueOrdersService;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.business.userManager.service.UserBalanceService;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
@ -24,6 +26,9 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
|
||||
|
||||
@Resource
|
||||
private CardValueOrdersMapper cardValueOrdersMapper;
|
||||
|
||||
@Resource
|
||||
private UserBalanceService userBalanceService;
|
||||
/**
|
||||
* 根据订单编号返回订单信息
|
||||
* @param orderNo
|
||||
@ -49,5 +54,26 @@ public class CardValueOrdersServiceImpl extends ServiceImpl<CardValueOrdersMappe
|
||||
baseMapper.updateById(oneByOrderNo);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateBalance(String orderNo, String status) {
|
||||
CardValueOrders oneByOrderNo = cardValueOrdersMapper.getOneByOrderNo(orderNo);
|
||||
if (ObjectUtil.isNotEmpty(oneByOrderNo)){
|
||||
|
||||
if ("paid".equals(status)){
|
||||
UserBalance userBalance = userBalanceService.selectUserBalanceByStorId(oneByOrderNo.getMtUserId(),oneByOrderNo.getStoreId());
|
||||
Double cardBalance = 0.0;
|
||||
if ("1".equals(oneByOrderNo.getRechargeType())){
|
||||
cardBalance = oneByOrderNo.getRechargeBalance() + oneByOrderNo.getGiftBalance();
|
||||
}else {
|
||||
cardBalance = userBalance.getCardBalance() + oneByOrderNo.getBidBalance() + oneByOrderNo.getGiftBalance();
|
||||
}
|
||||
userBalance.setCardBalance(cardBalance);
|
||||
userBalanceService.updateUserBalance(userBalance);
|
||||
}
|
||||
oneByOrderNo.setStatus(status);
|
||||
baseMapper.updateById(oneByOrderNo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,9 +1,7 @@
|
||||
package com.fuint.business.marketingActivity.favorableRecords.controller;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.fuint.business.marketingActivity.cardValueOrders.entity.CardValueOrders;
|
||||
import com.fuint.business.marketingActivity.favorableRecords.entity.FavorableRecords;
|
||||
import com.fuint.business.marketingActivity.favorableRecords.service.FavorableRecordsService;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
|
@ -17,6 +17,7 @@ import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.HashMap;
|
||||
@ -52,6 +53,7 @@ public class FavorableRecordsServiceImpl extends ServiceImpl<FavorableRecordsMap
|
||||
return save(favorableRecords);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public IPage selectList(Page page, FavorableRecords favorableRecords) {
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
@ -65,6 +67,10 @@ public class FavorableRecordsServiceImpl extends ServiceImpl<FavorableRecordsMap
|
||||
if (ObjectUtil.isNotEmpty(favorableRecords.getFavConsumptionType()))
|
||||
queryWrapper.eq(FavorableRecords::getFavConsumptionType, favorableRecords.getFavConsumptionType());
|
||||
IPage page1 = page(page, queryWrapper);
|
||||
List<FavorableRecords> favorableRecordsList = page1.getRecords();
|
||||
for (FavorableRecords favorableRecords1 : favorableRecordsList) {
|
||||
|
||||
}
|
||||
return page1;
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,306 @@
|
||||
package com.fuint.business.printer.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.internal.util.codec.Base64;
|
||||
import com.fuint.business.printer.entity.Test;
|
||||
import com.fuint.business.printer.service.PrinterService;
|
||||
import com.fuint.business.printer.template.*;
|
||||
import com.fuint.business.printer.unit.Methods;
|
||||
import com.fuint.business.printer.vo.OrderPayment;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.Constants;
|
||||
import com.fuint.common.util.RedisUtil;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.framework.web.BaseController;
|
||||
import com.fuint.framework.web.ResponseObject;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
//import com.yly.print_sdk_librar.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.autoconfigure.cache.CacheProperties;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.PrintWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/business/printer")
|
||||
//@EnableWebMvc
|
||||
@Slf4j
|
||||
public class printerController extends BaseController {
|
||||
|
||||
@Resource
|
||||
PrinterService printerService;
|
||||
|
||||
@GetMapping("callback")
|
||||
public Map<String, String> callback(Map<String , String> map){
|
||||
log.info("------print/callback-------");
|
||||
Map<String, String> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("message","ok");
|
||||
return objectObjectHashMap;
|
||||
}
|
||||
|
||||
@GetMapping("push")
|
||||
public Map<String, String> push( Map<String , String> map){
|
||||
log.info("------接收GET回调-------");
|
||||
Map<String, String> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("message","ok");
|
||||
return objectObjectHashMap;
|
||||
}
|
||||
|
||||
@PostMapping("push")
|
||||
public Map<String, String> PostPush(
|
||||
@RequestParam("ciphertext") String ciphertext,
|
||||
@RequestParam("nonce") String nonce,
|
||||
@RequestParam("tag") String tag,
|
||||
@RequestParam("additional_data") String additional_data,
|
||||
@RequestParam("iv") String iv,
|
||||
@RequestParam("signature") String signature){
|
||||
log.info("12222222222222222222222222");
|
||||
|
||||
return printerService.PostPush(ciphertext,nonce,tag,additional_data,iv,signature);
|
||||
}
|
||||
|
||||
@GetMapping("returnCode")
|
||||
public ResponseObject returnCode(String payAmount) {
|
||||
return getSuccessResult(printerService.returnCode(payAmount));
|
||||
}
|
||||
|
||||
//
|
||||
// public static final String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuiQQsY9lbZhtRoZIaBVN\n" +
|
||||
// "XKuAme47UCUv3RG2AYJXKQ/TyXBBY0JULSf4637Ug7JqGR1ohHFpY9XotG5J/7Ne\n" +
|
||||
// "safQApAz8QHKOa6+jqS0edafegjE7P0KqfQWvjUIbhAl5iXmiGLA/R6zLXxk8+PU\n" +
|
||||
// "toRu1rmzMPCsbGRG0uHOZ0nYez1LSM4k4k8o4/dl7NDr2CqXrfYQCEvGAAJay/bg\n" +
|
||||
// "h1B05cqFNuhQGvv55EX377QVZX7V0ZipIZhlzoh8pA0ZpzW/KndZ+pRYw6cPLvey\n" +
|
||||
// "qymRnTlCSQUDYQRlxaDppPbZcU1Krb9tZUmhJp+R9l73tJX8yN5wzbq6HATZbD1v\n" +
|
||||
// "BwIDAQAB";
|
||||
|
||||
|
||||
// @GetMapping("getToken")
|
||||
// public ResponseObject getToken(){
|
||||
//// Methods.()
|
||||
// //初始化控制器类
|
||||
// Methods m=Methods.getInstance();
|
||||
// //初始化终端信息
|
||||
// m.init("1038835098", "1595cb28ea30e98908e6334e735f4b8a");
|
||||
// //获取token
|
||||
// m.getFreedomToken();
|
||||
// System.out.println("123123123123123");
|
||||
// return getSuccessResult("");
|
||||
// }
|
||||
private static final String APP_KEY = "1073000501";
|
||||
private static final String APP_SECRET = "e0292ae66d9d21feaa895370d3a875aa";
|
||||
|
||||
// 授权
|
||||
@GetMapping("scancodemodel")
|
||||
public ResponseObject scancodemodel(){
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
String token = printerService.getToken(nowAccountInfo.getStoreId());
|
||||
// String token = printerService.getToken(138);
|
||||
return getSuccessResult(token);
|
||||
|
||||
}
|
||||
|
||||
// 发起网络支付
|
||||
@GetMapping("printIndex")
|
||||
public ResponseObject printIndex(BigDecimal payAmount) {
|
||||
|
||||
|
||||
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
//
|
||||
//// m.addPrinter("4004872261", "628023865417");
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
||||
//// <JSON>{"order_payment":{"pay_amount":"支付金额","pay_amount_source":3},"processed_state":0}</JSON>
|
||||
//
|
||||
//
|
||||
// Map<String, Object> orderPaymentMap = new HashMap<>();
|
||||
// orderPaymentMap.put("pay_amount", payAmount);
|
||||
//// orderPaymentMap.put("pay_amount", 0.01);
|
||||
// orderPaymentMap.put("pay_amount_source", 3);
|
||||
//
|
||||
// Map<String, Integer> processedStateMap = new HashMap<>();
|
||||
// processedStateMap.put("processed_state", 0);
|
||||
//
|
||||
// Map<String, Object> jsonDataMap = new HashMap<>();
|
||||
// jsonDataMap.put("order_payment", orderPaymentMap);
|
||||
// jsonDataMap.putAll(processedStateMap);
|
||||
//
|
||||
// Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
// String json = gson.toJson(jsonDataMap);
|
||||
//
|
||||
// String a = "<JSON>"+json+"</JSON>";
|
||||
// log.info("json:{}",a);
|
||||
//
|
||||
// String url=m.print("4004872261",a, System.currentTimeMillis()+random6.toString());
|
||||
//
|
||||
// // 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
// JSONObject jsonObject = JSON.parseObject(url);
|
||||
//
|
||||
// // 将 JSONObject 转换为 Map
|
||||
// Map<String, Object> map = jsonObject.getInnerMap();
|
||||
// //获取支付参数
|
||||
// log.info("url:{}",url);
|
||||
// return getSuccessResult(map.get("error_description"));
|
||||
String s = printerService.printIndex(payAmount, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
return getSuccessResult(s);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("doGet")
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response)
|
||||
throws ServletException, IOException {
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
// m.init(APP_KEY,APP_SECRET);
|
||||
m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
|
||||
|
||||
response.setContentType("text/html");
|
||||
PrintWriter out = response.getWriter();
|
||||
//测试数据
|
||||
List<Test> testList = new ArrayList<Test>();
|
||||
Test t1 = new Test("麻辣牛肉", 23.00, 1,"1");
|
||||
Test t2 = new Test("麻辣牛肉", 23.00, 2,"2");
|
||||
Test t3 = new Test("精品千层肚", 24.00, 3,"3");
|
||||
Test t4 = new Test("麻辣牛肉", 23.00, 2,"1");
|
||||
Test t5 = new Test("极品鲜毛肚", 26.00, 2,"1");
|
||||
Test t6 = new Test("极品鲜毛肚", 26.00, 1,"2");
|
||||
Test t7 = new Test("极品鲜毛肚", 26.00, 3,"2");
|
||||
Test t8 = new Test("极品鲜毛肚", 26.00, 1,"1");
|
||||
Test t9 = new Test("极品鲜毛肚", 26.00, 2,"3");
|
||||
testList.add(t1);
|
||||
testList.add(t2);
|
||||
testList.add(t3);
|
||||
testList.add(t4);
|
||||
testList.add(t5);
|
||||
testList.add(t6);
|
||||
testList.add(t7);
|
||||
testList.add(t8);
|
||||
testList.add(t9);
|
||||
Prient.setTestList(testList);
|
||||
|
||||
//关键代码,自己的程序发送请求
|
||||
//初始化控制器类
|
||||
// Methods m=Methods.getInstance();
|
||||
//初始化终端信息
|
||||
m.init(APP_KEY, APP_SECRET);
|
||||
//获取token
|
||||
// m.getFreedomToken();
|
||||
//刷新token
|
||||
// m.refreshToken();
|
||||
//添加授权
|
||||
m.addPrinter("4004872261", "628023865417");
|
||||
//打印
|
||||
//终端编号 打印内容 订单号
|
||||
//生成6位随机数
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print("4004872261", Prient.print(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
response.sendRedirect(url);
|
||||
out.flush();
|
||||
out.close();
|
||||
}
|
||||
|
||||
@PostMapping("getHandover")
|
||||
public void getHandover(@RequestBody Map<String, Object> handover) {
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// Handover.setHandover(handover);
|
||||
// // m.addPrinter("4004872261", "628023865417");
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", Handover.printHandover(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.getHandover(handover,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 收银台商品打印
|
||||
* @param oilOrder
|
||||
*/
|
||||
@PostMapping("printOilOrderReport")
|
||||
public void oilOrderReport(@RequestBody Map<String, Object> oilOrder) {
|
||||
// log.info("handover:{}",handover.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintOilOrderReport.setHandover(handover);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintOilOrderReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.oilOrderReport(oilOrder,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
|
||||
@PostMapping("rePrintOilOrderReport")
|
||||
public void reOilOrderReport(@RequestBody Map<String, Object> oilOrder) {
|
||||
printerService.reOilOrderReport(oilOrder,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
}
|
||||
/**
|
||||
* 余额充值订单
|
||||
* @param cardValue
|
||||
*/
|
||||
@PostMapping("printCardValueReport")
|
||||
public void printCardValueReport(@RequestBody Map<String, Object> cardValue) {
|
||||
// log.info("handover:{}",cardValue.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintCardValueReport.setHandover(cardValue);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintCardValueReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.printCardValueReport(cardValue, TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
/**
|
||||
* 油卡充值订单
|
||||
* @param fuelDiesel
|
||||
*/
|
||||
@PostMapping("printFuelDieselReport")
|
||||
public void printFuelDieselReport(@RequestBody Map<String, Object> fuelDiesel) {
|
||||
// log.info("handover:{}",fuelDiesel.toString());
|
||||
// Methods m=Methods.getInstance();
|
||||
// m.init("26845ee50f13467cacbaa099489a2fc152abd6f5");
|
||||
//
|
||||
// m.init(APP_KEY, APP_SECRET);
|
||||
// PrintFuelDieselReport.setHandover(fuelDiesel);
|
||||
// Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
// String url=m.print("4004872261", PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
printerService.printFuelDieselReport(fuelDiesel,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
@PostMapping("printIntegralReport")
|
||||
public void printIntegralReport(@RequestBody Map<String, Object> integral) {
|
||||
printerService.printIntegralReport(integral,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,474 @@
|
||||
package com.fuint.business.printer.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.internal.util.codec.Base64;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
import com.fuint.business.printer.mapper.PrintDeviceInfoMapper;
|
||||
import com.fuint.business.printer.service.PrintDeviceInfoService;
|
||||
import com.fuint.business.printer.service.PrinterService;
|
||||
import com.fuint.business.printer.template.*;
|
||||
import com.fuint.business.printer.unit.Methods;
|
||||
import com.fuint.business.printer.vo.OrderPayment;
|
||||
import com.fuint.common.util.RedisUtil;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import com.yly.print_sdk_library.RequestMethod;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.spec.GCMParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.math.BigDecimal;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.GeneralSecurityException;
|
||||
import java.security.KeyFactory;
|
||||
import java.security.PublicKey;
|
||||
import java.security.Signature;
|
||||
import java.security.spec.X509EncodedKeySpec;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class PrinterServiceImpl implements PrinterService {
|
||||
|
||||
private static String code = new String();
|
||||
|
||||
public static final String publicKey = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuiQQsY9lbZhtRoZIaBVN\n" +
|
||||
"XKuAme47UCUv3RG2AYJXKQ/TyXBBY0JULSf4637Ug7JqGR1ohHFpY9XotG5J/7Ne\n" +
|
||||
"safQApAz8QHKOa6+jqS0edafegjE7P0KqfQWvjUIbhAl5iXmiGLA/R6zLXxk8+PU\n" +
|
||||
"toRu1rmzMPCsbGRG0uHOZ0nYez1LSM4k4k8o4/dl7NDr2CqXrfYQCEvGAAJay/bg\n" +
|
||||
"h1B05cqFNuhQGvv55EX377QVZX7V0ZipIZhlzoh8pA0ZpzW/KndZ+pRYw6cPLvey\n" +
|
||||
"qymRnTlCSQUDYQRlxaDppPbZcU1Krb9tZUmhJp+R9l73tJX8yN5wzbq6HATZbD1v\n" +
|
||||
"BwIDAQAB";
|
||||
|
||||
|
||||
@Resource
|
||||
PrintDeviceInfoService printDeviceInfoService;
|
||||
@Resource
|
||||
PrintDeviceInfoMapper printDeviceInfoMapper;
|
||||
|
||||
@Override
|
||||
public Map<String, String> PostPush(String ciphertext, String nonce, String tag, String additional_data, String iv, String signature) {
|
||||
System.out.println("PostMapping"+ciphertext);
|
||||
code = new String();
|
||||
Map<String, String> objectObjectHashMap = new HashMap<>();
|
||||
objectObjectHashMap.put("message","ok");
|
||||
verifySign(ciphertext,signature);
|
||||
try {
|
||||
String decrypte = decrypte(ciphertext, iv, tag);
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(decrypte);
|
||||
|
||||
// 将 JSONObject 转换为 Map
|
||||
Map<String, Object> map = jsonObject.getInnerMap();
|
||||
//获取支付参数
|
||||
Map<String, Object> orderPaymentMap = (Map<String, Object>) map.get("order_payment");
|
||||
OrderPayment orderPayment = new OrderPayment();
|
||||
orderPayment.setOrderPayment(orderPaymentMap.get("pay_amount").toString());
|
||||
orderPayment.setScannedCode(orderPaymentMap.get("scanned_code").toString());
|
||||
|
||||
RedisUtil.set(orderPaymentMap.get("scanned_code").toString(), orderPaymentMap.get("pay_amount").toString(), 100);
|
||||
code = orderPaymentMap.get("scanned_code").toString();
|
||||
log.info("--获取打印回调--{}",jsonObject);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return objectObjectHashMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String returnCode(String payAmount) {
|
||||
String thisCode = code;
|
||||
code = new String();
|
||||
if (ObjectUtil.isEmpty(thisCode)) {
|
||||
return "300";
|
||||
}
|
||||
// if (RedisUtil.get(thisCode)) {
|
||||
return thisCode;
|
||||
// }else {
|
||||
// return getSuccessResult("301");
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String getToken(Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
if (ObjectUtil.isEmpty(infoByStoreId)){
|
||||
return "error";
|
||||
}
|
||||
RequestMethod.getInstance().init(infoByStoreId.getAppKey(),infoByStoreId.getAppSecret());
|
||||
|
||||
try {
|
||||
// String resJson = RequestMethod.getInstance().scanCodeModel_msign("4004872261", "628023865417");
|
||||
String resJson = RequestMethod.getInstance().scanCodeModel_msign(infoByStoreId.getMachineCode(), infoByStoreId.getMsign());
|
||||
log.info("--yilianyunAccessToken--{}",resJson);
|
||||
|
||||
JSONObject jsonObject = JSONObject.parseObject(resJson);
|
||||
String errorDescription = jsonObject.getString("error_description"); // success
|
||||
if ("success".equals(errorDescription)) {
|
||||
JSONObject body = jsonObject.getJSONObject("body");
|
||||
String accessToken = body.getString("access_token");
|
||||
RedisUtil.set("scancodemodel+"+storeId,accessToken,60*60*24);
|
||||
return accessToken;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return "error";
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public String printIndex(BigDecimal payAmount,Integer storeId){
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
|
||||
// HashMap<String, String> objectObjectHashMap = new HashMap<>();
|
||||
Map<String, Object> orderPaymentMap = new HashMap<>();
|
||||
orderPaymentMap.put("pay_amount", payAmount);
|
||||
// orderPaymentMap.put("pay_amount", 0.01);
|
||||
|
||||
orderPaymentMap.put("pay_amount_source", 3);
|
||||
Map<String, Integer> processedStateMap = new HashMap<>();
|
||||
processedStateMap.put("processed_state", 0);
|
||||
Map<String, Object> jsonDataMap = new HashMap<>();
|
||||
jsonDataMap.put("order_payment", orderPaymentMap);
|
||||
jsonDataMap.putAll(processedStateMap);
|
||||
|
||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
||||
String json = gson.toJson(jsonDataMap);
|
||||
|
||||
String jsonData = "<JSON>"+json+"</JSON>";
|
||||
log.info("json:{}",jsonData);
|
||||
|
||||
String url=m.print(infoByStoreId.getMachineCode(),jsonData, System.currentTimeMillis()+random6.toString());
|
||||
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
// 将 JSONObject 转换为 Map
|
||||
Map<String, Object> map = jsonObject.getInnerMap();
|
||||
//获取支付参数
|
||||
log.info("url:{}",url);
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
printIndex(payAmount,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
return map.get("error_description").toString();
|
||||
}
|
||||
|
||||
// 打印交接班
|
||||
public void getHandover(Map<String, Object> handover,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
Handover.setHandover(handover);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), Handover.printHandover(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
|
||||
}
|
||||
|
||||
public void oilOrderReport(Map<String, Object> oilOrder,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
} }
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintOilOrderReport.setHandover(oilOrder);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintOilOrderReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(oilOrder,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void reOilOrderReport(Map<String, Object> oilOrder,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
RePrintOilOrderReport.setHandover(oilOrder);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), RePrintOilOrderReport.rePrintOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(oilOrder,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void printCardValueReport(Map<String, Object> cardValue,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",cardValue.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintCardValueReport.setHandover(cardValue);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintCardValueReport.printOilOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(cardValue,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void printFuelDieselReport(Map<String, Object> fuelDiesel,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",fuelDiesel.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintFuelDieselReport.setHandover(fuelDiesel);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintFuelDieselReport.printFeulOrder(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(fuelDiesel,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void printIntegralReport(Map<String, Object> integral,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",integral.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
PrintIntegralReport.setHandover(integral);
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintIntegralReport.printIntegral(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(integral,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
public void printTagReport(Map<String, Object> integral,Integer storeId) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
log.info("handover:{}",integral.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
if (ObjectUtil.isNotEmpty(accessToken)) {
|
||||
m.init(accessToken.toString());
|
||||
} else {
|
||||
String token = getToken(storeId);
|
||||
if ("error".equals(token)) {
|
||||
throw new RuntimeException("获取参数失败,无法打印");
|
||||
}else {
|
||||
m.init(token);
|
||||
}
|
||||
}
|
||||
m.init(infoByStoreId.getAppKey(), infoByStoreId.getAppSecret());
|
||||
// PrintIntegralReport.setHandover(integral);
|
||||
|
||||
StringBuilder sb=new StringBuilder();
|
||||
sb.append("<center>收款码打印\r\n</center>");
|
||||
sb.append("------------------------------------\r\n");
|
||||
sb.append("油枪:¥"+integral.get("gunName")+"\r\n");
|
||||
sb.append("升数:¥"+integral.get("oilNum")+"\r\n");
|
||||
sb.append("价格:¥"+integral.get("payAmount")+"\r\n");
|
||||
sb.append("------------------------------------\r\n");
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
Integer random6 = (int) ((Math.random() * 9 + 1) * 100000);
|
||||
String url=m.print(infoByStoreId.getMachineCode(), sb.toString(), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
reOilOrderReport(integral,storeId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void verifySign(String ciphertext, String signature) {
|
||||
// 交易报文中ciphertext与signature
|
||||
byte[] signatureByte = Base64.decodeBase64String(signature);
|
||||
byte[] publicKeyByte = Base64.decodeBase64String(publicKey);
|
||||
try {
|
||||
System.out.println("验签结果:" + verify(ciphertext.getBytes(), signatureByte, publicKeyByte));
|
||||
boolean verify = verify(ciphertext.getBytes(), signatureByte, publicKeyByte);
|
||||
} catch (GeneralSecurityException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 第二步:解析参数
|
||||
*/
|
||||
public String decrypte(String ciphertext,
|
||||
String iv,
|
||||
String tag) throws Exception {
|
||||
// 交易报文中ciphertext与tag和iv
|
||||
// String ciphertext = "";
|
||||
// String tag = "";
|
||||
// String iv = "";
|
||||
// 应用设置 -> K8推送 -> 设置 -> 接口加签名方式(密钥) -> 应用公钥
|
||||
String key = "e0292ae66d9d21feaa895370d3a875aa";
|
||||
try {
|
||||
String plaintext = decrypte(Base64.decodeBase64String(ciphertext), key.getBytes(), iv.getBytes(), Base64.decodeBase64String(tag));
|
||||
System.out.println(plaintext);
|
||||
return plaintext;
|
||||
} catch (Exception e) {
|
||||
throw new Exception(e);
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean verify(byte[] data, byte[] signature, byte[] publicKey) throws GeneralSecurityException {
|
||||
X509EncodedKeySpec pubKeySpec = new X509EncodedKeySpec(publicKey);
|
||||
KeyFactory keyFactory = KeyFactory.getInstance("RSA");
|
||||
PublicKey pubKey = keyFactory.generatePublic(pubKeySpec);
|
||||
Signature sig = Signature.getInstance("SHA256withRSA");
|
||||
sig.initVerify(pubKey);
|
||||
sig.update(data);
|
||||
return sig.verify(signature);
|
||||
}
|
||||
|
||||
/**
|
||||
* AES-GCM-256对称解密
|
||||
*/
|
||||
private static String decrypte(byte[] encryptedBytes, byte[] keyBytes, byte[] ivBytes, byte[] tagBytes) throws Exception {
|
||||
|
||||
SecretKeySpec secretKey = new SecretKeySpec(keyBytes, "AES");
|
||||
Cipher cipher = Cipher.getInstance("AES/GCM/NoPadding");
|
||||
GCMParameterSpec gcmParameterSpec = new GCMParameterSpec(128, ivBytes);
|
||||
cipher.init(Cipher.DECRYPT_MODE, secretKey, gcmParameterSpec);
|
||||
cipher.updateAAD("transaction".getBytes(StandardCharsets.UTF_8));
|
||||
cipher.update(encryptedBytes);
|
||||
byte[] decryptedBytes = cipher.doFinal(tagBytes);
|
||||
String decryptedString = new String(decryptedBytes, StandardCharsets.UTF_8);
|
||||
byte[] content = Base64.decodeBase64String(decryptedString);
|
||||
return new String(content);
|
||||
}
|
||||
|
||||
}
|
@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -27,7 +28,7 @@ import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 字典 业务层处理
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
*/
|
||||
@Service
|
||||
@ -48,7 +49,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据条件分页查询字典类型
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型信息
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@ -60,7 +61,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据所有字典类型
|
||||
*
|
||||
*
|
||||
* @return 字典类型集合信息
|
||||
*/
|
||||
@Override
|
||||
@ -71,18 +72,19 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型查询字典数据
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典数据集合信息
|
||||
*/
|
||||
@Override
|
||||
public List<SysDictData> selectDictDataByType(String dictType)
|
||||
{
|
||||
List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||
List<SysDictData> dictDatas = new ArrayList<>();
|
||||
/* List<SysDictData> dictDatas = DictUtils.getDictCache(dictType);
|
||||
if (CollectionUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
return dictDatas;
|
||||
}
|
||||
}*/
|
||||
dictDatas = dictDataMapper.selectDictDataByType(dictType);
|
||||
if (CollectionUtils.isNotEmpty(dictDatas))
|
||||
{
|
||||
@ -94,7 +96,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型ID查询信息
|
||||
*
|
||||
*
|
||||
* @param dictId 字典类型ID
|
||||
* @return 字典类型
|
||||
*/
|
||||
@ -106,7 +108,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 根据字典类型查询信息
|
||||
*
|
||||
*
|
||||
* @param dictType 字典类型
|
||||
* @return 字典类型
|
||||
*/
|
||||
@ -118,7 +120,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 批量删除字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dictIds 需要删除的字典ID
|
||||
*/
|
||||
@Override
|
||||
@ -172,7 +174,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 新增保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -189,7 +191,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 修改保存字典类型信息
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型信息
|
||||
* @return 结果
|
||||
*/
|
||||
@ -210,7 +212,7 @@ public class SysDictTypeServiceImpl extends ServiceImpl<SysDictTypeMapper, SysDi
|
||||
|
||||
/**
|
||||
* 校验字典类型称是否唯一
|
||||
*
|
||||
*
|
||||
* @param dict 字典类型
|
||||
* @return 结果
|
||||
*/
|
||||
|
@ -59,7 +59,7 @@
|
||||
</div>
|
||||
<!-- <div class="center-left-hj" v-show="isMember">-->
|
||||
<!-- <div>-->
|
||||
<!-- 储值卡-->
|
||||
<!-- 电子储值卡-->
|
||||
<!-- <span>(账户余额:{{ balance }}元)</span>-->
|
||||
<!-- </div>-->
|
||||
<!-- <div>-¥{{ allAmout }}</div>-->
|
||||
|
@ -254,7 +254,7 @@
|
||||
<div>
|
||||
<el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
|
||||
<br/>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理</span>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRefund = false">取 消</el-button>
|
||||
@ -541,7 +541,7 @@ export default {
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡',
|
||||
'balance': '电子储值卡',
|
||||
'0': '兑换卷核销'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.goods.payType] || '小程序码';
|
||||
|
@ -64,7 +64,7 @@
|
||||
<!-- <el-table-column label="余额">-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="name"-->
|
||||
<!-- label="储值卡"-->
|
||||
<!-- label="电子储值卡"-->
|
||||
<!-- width="120">-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
@ -182,7 +182,7 @@
|
||||
<!-- <el-table-column label="余额">-->
|
||||
<!-- <el-table-column-->
|
||||
<!-- prop="name"-->
|
||||
<!-- label="储值卡"-->
|
||||
<!-- label="电子储值卡"-->
|
||||
<!-- width="120">-->
|
||||
<!-- </el-table-column>-->
|
||||
<!-- <el-table-column-->
|
||||
|
@ -42,8 +42,8 @@
|
||||
:label="item.dictLabel"
|
||||
:value="item.dictValue">
|
||||
</el-option>
|
||||
<el-option label="囤油卡" value="oilCard"/>
|
||||
<el-option label="储值卡" value="balance"/>
|
||||
<el-option label="电子囤油卡" value="oilCard"/>
|
||||
<el-option label="电子电子储值卡" value="balance"/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="手机号">
|
||||
@ -198,14 +198,14 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="付款信息" align="center">
|
||||
<el-table-column prop="payAmount" label="实付金额" align="center"> </el-table-column>
|
||||
<el-table-column prop="balanceAmount" label="储值卡付款金额" align="center" width="115"/>
|
||||
<el-table-column prop="balanceAmount" label="电子储值卡付款金额" align="center" width="115"/>
|
||||
<!-- <el-table-column prop="oilCardAmount" label="囤油卡付款升数" align="center" width="115"/>-->
|
||||
<el-table-column prop="payUser" label="付款用户" align="center" width="110"> </el-table-column>
|
||||
<el-table-column prop="payType" label="付款方式" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{getType(payList,scope.row.payType)}}</span>
|
||||
<span v-if="scope.row.payType=='oilCard'">囤油卡</span>
|
||||
<span v-if="scope.row.payType=='balance'">储值卡</span>
|
||||
<span v-if="scope.row.payType=='balance'">电子储值卡</span>
|
||||
<span v-if="scope.row.payType=='credit'">挂账</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
@ -287,7 +287,7 @@
|
||||
<div>
|
||||
<el-input placeholder="请输入退款原因" v-model="refundRemark"></el-input>
|
||||
<br/>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理</span>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRefund = false">取 消</el-button>
|
||||
@ -309,7 +309,7 @@
|
||||
<div v-else-if="oilOrder.payType == 'WECHAT'">微信</div>
|
||||
<div v-else-if="oilOrder.payType == 'ALIPAY'">支付宝</div>
|
||||
<div v-else-if="oilOrder.payType == 'UNIONPAY'">银联二维码</div>
|
||||
<div v-else-if="oilOrder.payType == 'balance'">储值卡</div>
|
||||
<div v-else-if="oilOrder.payType == 'balance'">电子储值卡</div>
|
||||
<div v-else-if="oilOrder.payType == 'oilCard'">囤油卡</div>
|
||||
<div v-else>小程序码</div>
|
||||
</div>
|
||||
@ -322,7 +322,7 @@
|
||||
<div>¥{{ oilOrder.discountAmount }}</div>
|
||||
</div>
|
||||
<div class="input-box" v-if="oilOrder.balanceAmount>0">
|
||||
<div>储值卡付款金额</div>
|
||||
<div>电子储值卡付款金额</div>
|
||||
<div>¥{{ oilOrder.balanceAmount }}</div>
|
||||
</div>
|
||||
<!-- <div class="input-box" v-if="oilOrder.oilCardAmount>0">-->
|
||||
@ -534,7 +534,7 @@
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
'balance': '电子储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.oilOrder.payType] || '小程序码';
|
||||
|
||||
@ -550,7 +550,7 @@
|
||||
creditAmount: "",//挂账金额
|
||||
// 优惠合计
|
||||
discount:this.oilOrder.discountAmount, // 油惠合计
|
||||
// 储值卡付款
|
||||
// 电子储值卡付款
|
||||
consumeAmount:this.oilOrder.balanceAmount,
|
||||
// 屯油卡付款
|
||||
consumeRefuelMoney:this.oilOrder.oilCardAmount,
|
||||
|
@ -114,7 +114,7 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="付款信息" align="center">
|
||||
<el-table-column prop="payAmount" label="实付金额" align="center" width="120"> </el-table-column>
|
||||
<el-table-column prop="payAmount" label="储值卡或囤油卡付款金额" align="center" width="120">
|
||||
<el-table-column prop="payAmount" label="电子储值卡或囤油卡付款金额" align="center" width="120">
|
||||
<template slot-scope="props">
|
||||
<span v-if="props.row.orderAmount - props.row.discountAmount - props.row.payAmount>0 && props.row.userId && props.row.orderStatus=='paid'">{{ (props.row.orderAmount - props.row.discountAmount - props.row.payAmount).toFixed(2) || 0 }}</span>
|
||||
<span v-else>0</span>
|
||||
@ -205,7 +205,7 @@
|
||||
<div>
|
||||
<el-input placeholder="请输入密码" v-model="password"></el-input>
|
||||
<br/>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理</span>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRefund = false">取 消</el-button>
|
||||
@ -238,7 +238,7 @@
|
||||
<div>¥{{ oilOrder.discountAmount }}</div>
|
||||
</div>
|
||||
<div class="input-box" v-if="oilOrder.userId && oilOrder.orderStatus=='paid' &&(oilOrder.orderAmount - oilOrder.discountAmount - oilOrder.payAmount)>0">
|
||||
<div>储值卡或囤油卡付款</div>
|
||||
<div>电子储值卡或囤油卡付款</div>
|
||||
<div>¥{{ (oilOrder.orderAmount - oilOrder.discountAmount - oilOrder.payAmount).toFixed(2) }}</div>
|
||||
</div>
|
||||
<div class="input-box">
|
||||
|
@ -151,8 +151,8 @@
|
||||
<el-table-column prop="mobile" label="会员手机号" align="center"> </el-table-column>
|
||||
<el-table-column prop="bidBalance" label="到账金额" align="center"> </el-table-column>
|
||||
<el-table-column prop="amount" label="自定义充值金额" align="center"> </el-table-column>
|
||||
<el-table-column prop="rechargeBalance" label="储值卡实售金额" align="center"> </el-table-column>
|
||||
<el-table-column prop="giftBalance" label="储值卡赠送金额" align="center"></el-table-column>
|
||||
<el-table-column prop="rechargeBalance" label="电子储值卡实售金额" align="center"> </el-table-column>
|
||||
<el-table-column prop="giftBalance" label="电子储值卡赠送金额" align="center"></el-table-column>
|
||||
<el-table-column prop="paymentType" label="支付方式" align="center">
|
||||
<template slot-scope="scope">
|
||||
<span>{{getType(payList,scope.row.paymentType)}}</span>
|
||||
@ -230,7 +230,7 @@
|
||||
<div>
|
||||
<el-input placeholder="请输入密码" v-model="password" show-password></el-input>
|
||||
<br/>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理</span>
|
||||
<span style="color: grey;font-size: 12px">退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理</span>
|
||||
</div>
|
||||
<span slot="footer" class="dialog-footer">
|
||||
<el-button @click="dialogRefund = false">取 消</el-button>
|
||||
@ -472,7 +472,7 @@ export default {
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
'balance': '电子储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.oilOrder.paymentType]
|
||||
// let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills
|
||||
|
@ -201,7 +201,7 @@
|
||||
<span>{{ scope.row.gradeId ? getName(userGradeList, scope.row.gradeId) : '-' }}</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="储值卡" align="center" prop="cardBalance">
|
||||
<el-table-column label="电子储值卡" align="center" prop="cardBalance">
|
||||
<template slot-scope="scope">
|
||||
<div>{{ scope.row.cardBalance ? scope.row.cardBalance.toFixed(2) : '0.00' }}</div>
|
||||
</template>
|
||||
@ -561,6 +561,7 @@
|
||||
gradeId: [{ required: true, message: "会员等级", trigger: "blur" }],
|
||||
mobile: [
|
||||
{ required: true, message: "请输入手机号", trigger: "blur" },
|
||||
{ pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/, message: "请输入正确的手机号码", trigger: "blur" }
|
||||
],
|
||||
status: [{ required: true, message: "请选择会员状态", trigger: "blur" }],
|
||||
},
|
||||
|
@ -135,7 +135,7 @@
|
||||
<el-tab-pane label="商品订单" name="shopOrder">
|
||||
<goodsOrder :key="childComponentKey" :pUserId="form.id"></goodsOrder>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="余额记录(储值卡/囤油卡消费、充值记录)" name="balanceRecord">
|
||||
<el-tab-pane label="余额记录(电子储值卡/囤油卡消费、充值记录)" name="balanceRecord">
|
||||
<balanceRecord :key="childComponentKey" :pUserId="form.id"></balanceRecord>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="积分记录" name="pointRecord">
|
||||
@ -366,7 +366,7 @@
|
||||
<el-button @click="cancel">取 消</el-button>
|
||||
</div>
|
||||
</el-tab-pane>
|
||||
<el-tab-pane label="礼品卡兑换电子储值卡余额" name="giftCard">
|
||||
<el-tab-pane label="礼品卡兑换电子电子储值卡余额" name="giftCard">
|
||||
<el-form ref="form2" :model="form2" :rules="rules1" label-width="120px">
|
||||
<el-row>
|
||||
<el-col :span="24">
|
||||
@ -550,7 +550,7 @@
|
||||
<el-table-column prop="date" label="账户ID"/>
|
||||
<el-table-column prop="date" label="账户名称"/>
|
||||
<el-table-column label="余额">
|
||||
<el-table-column prop="name" label="储值卡"/>
|
||||
<el-table-column prop="name" label="电子储值卡"/>
|
||||
<el-table-column prop="address" label="升数卡"/>
|
||||
</el-table-column>
|
||||
<el-table-column label="会员等级">
|
||||
@ -961,12 +961,12 @@ export default {
|
||||
// 充值余额列表
|
||||
cardValueList: [],
|
||||
cardValueForm: {
|
||||
cardValueId: '', // 储值卡id
|
||||
cardValueId: '', // 电子储值卡id
|
||||
mtStaffId: '', //
|
||||
realName: '',
|
||||
staffMobile: '',
|
||||
amount: '', // 自定义充值字段
|
||||
bidBalance: '', // 储值卡面值
|
||||
bidBalance: '', // 电子储值卡面值
|
||||
rechargeBalance: '', // 实际支付
|
||||
giftBalance: '',// 赠送金额
|
||||
points: '', //赠送积分
|
||||
@ -980,7 +980,7 @@ export default {
|
||||
rechargeType: '0'
|
||||
},
|
||||
|
||||
// 存油卡列表
|
||||
// 电子囤油卡列表
|
||||
cardFuelDieselList: [],
|
||||
sourceCardFuelDieselList: [],
|
||||
cardFuelDieselForm: {
|
||||
@ -1278,7 +1278,7 @@ export default {
|
||||
this.openLevel = true;
|
||||
this.title = '固定等级(原专车认证)'
|
||||
},
|
||||
// 储值卡查询
|
||||
// 电子储值卡查询
|
||||
async getCardValueList() {
|
||||
let quy = {
|
||||
pageNo: 1,
|
||||
@ -1387,7 +1387,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 存油卡查询
|
||||
// 电子囤油卡查询
|
||||
async getCardFuelDieselList() {
|
||||
let quy = {
|
||||
pageNo: 1,
|
||||
@ -1433,7 +1433,7 @@ export default {
|
||||
this.cardValueForm.realName = ''
|
||||
this.cardValueForm.staffMobile = ''
|
||||
},
|
||||
// 查询参加存油卡油品
|
||||
// 查询参加电子囤油卡油品
|
||||
getCountOilType() {
|
||||
getCountOilTypeApi().then(res => {
|
||||
this.oilTypeList = res.data
|
||||
@ -1444,7 +1444,7 @@ export default {
|
||||
}
|
||||
})
|
||||
},
|
||||
// 根据油品过滤查询存油卡
|
||||
// 根据油品过滤查询电子囤油卡
|
||||
async tabOilTypeClick(data) {
|
||||
// console.log("aaaaaaaaaaaaaa",data)
|
||||
await this.getCardFuelDieselList()
|
||||
@ -1474,7 +1474,7 @@ export default {
|
||||
this.openRecharge = true;
|
||||
this.title = '会员充值'
|
||||
|
||||
// 存油卡列表
|
||||
// 电子囤油卡列表
|
||||
},
|
||||
// 确认充值
|
||||
async confirm(flag) {
|
||||
@ -2019,12 +2019,12 @@ export default {
|
||||
|
||||
iniz() {
|
||||
this.cardValueForm = {
|
||||
cardValueId: '', // 储值卡id
|
||||
cardValueId: '', // 电子储值卡id
|
||||
mtStaffId: '', //
|
||||
realName: '',
|
||||
staffMobile: '',
|
||||
amount: '', // 自定义充值字段
|
||||
bidBalance: '', // 储值卡面值
|
||||
bidBalance: '', // 电子储值卡面值
|
||||
rechargeBalance: '', // 实际支付
|
||||
giftBalance: '',// 赠送金额
|
||||
points: '', //赠送积分
|
||||
@ -2117,7 +2117,7 @@ export default {
|
||||
goBack() {
|
||||
this.$router.back(-1);
|
||||
},
|
||||
// 积分表、储值卡详情表、积分详情表、储值卡表、储值卡模板表、用户储值卡关联表、
|
||||
// 积分表、电子储值卡详情表、积分详情表、电子储值卡表、电子储值卡模板表、用户电子储值卡关联表、
|
||||
|
||||
cardValueReport() {
|
||||
// 支付方式
|
||||
@ -2128,7 +2128,7 @@ export default {
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
'balance': '电子储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardValueForm.paymentType]
|
||||
let actualPay = this.cardValueForm.paymentType == 'CASH' ? this.authCode:this.realyPayBills
|
||||
@ -2190,7 +2190,7 @@ export default {
|
||||
'UNIONPAY': '银联二维码',
|
||||
'credit': '挂账',
|
||||
'oilCard': '囤油卡',
|
||||
'balance': '储值卡'
|
||||
'balance': '电子储值卡'
|
||||
};
|
||||
let payTypeText = payTypeMap[this.cardFuelDieselForm.paymentType]
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<template>
|
||||
<div>
|
||||
<el-radio-group v-model="tabPosition" size="mini" style="margin-bottom: 30px;" @click="changeCard">
|
||||
<el-radio-button label="giftCard">储值卡记录</el-radio-button>
|
||||
<el-radio-button label="giftCard">电子储值卡记录</el-radio-button>
|
||||
<el-radio-button label="literCard">囤油卡记录</el-radio-button>
|
||||
</el-radio-group>
|
||||
<div v-if="tabPosition=='giftCard'">
|
||||
|
@ -18,7 +18,7 @@
|
||||
|
||||
<el-table-column label="订单金额" align="center" prop="orderAmount"/>
|
||||
<el-table-column label="优惠金额" align="center" prop="discountAmount"/>
|
||||
<el-table-column label="储值卡消费金额" align="center" prop="balanceAmount"/>
|
||||
<el-table-column label="电子储值卡消费金额" align="center" prop="balanceAmount"/>
|
||||
<el-table-column label="囤油卡消费升数" align="center" prop="oilCardAmount"/>
|
||||
<el-table-column label="实付金额" align="center" prop="payAmount"/>
|
||||
<el-table-column label="付款类型" align="center" prop="payType">
|
||||
@ -27,7 +27,7 @@
|
||||
<span v-else-if="scope.row.payType == 'WECHAT'">微信</span>
|
||||
<span v-else-if="scope.row.payType == 'ALIPAY'">支付宝</span>
|
||||
<span v-else-if="scope.row.payType == 'UNIONPAY'">银联二维码</span>
|
||||
<div v-else-if="scope.row.payType == 'balance'">储值卡</div>
|
||||
<div v-else-if="scope.row.payType == 'balance'">电子储值卡</div>
|
||||
<div v-else-if="scope.row.payType == 'oilCard'">囤油卡</div>
|
||||
<span v-else>小程序码</span>
|
||||
<!-- <span>{{getName(payTypeList,scope.row.payType)}}</span>-->
|
||||
|
@ -108,7 +108,7 @@
|
||||
</view>
|
||||
</view>
|
||||
<view class="bottom-b"></view>
|
||||
<view class="p-bottom" @click="govipjs()">
|
||||
<view class="p-bottom" @click="scanQrcode()">
|
||||
<view class="anniu">
|
||||
确认支付
|
||||
</view>
|
||||
@ -172,9 +172,11 @@
|
||||
},
|
||||
methods: {
|
||||
// 自定义金额
|
||||
custom(val) {
|
||||
this.order.amount = val
|
||||
custom() {
|
||||
console.log(this.value);
|
||||
this.order.amount = this.value
|
||||
this.realyPayBills = this.order.amount
|
||||
this.order.rechargeBalance = this.order.amount
|
||||
},
|
||||
// 获取充值金额列表
|
||||
getRechargeAmount() {
|
||||
@ -187,6 +189,11 @@
|
||||
}
|
||||
}).then((res) => {
|
||||
this.numList = res.data.records
|
||||
|
||||
this.order.amount = this.numList.rechargeBalance
|
||||
this.order.rechargeBalance = this.numList.rechargeBalance
|
||||
this.order.points = this.numList.points
|
||||
this.realyPayBills = this.numList.rechargeBalance
|
||||
})
|
||||
},
|
||||
getmemberId(num, payType) {
|
||||
@ -207,13 +214,18 @@
|
||||
url: "/pagesHome/searchVip/searchVip?type=1"
|
||||
})
|
||||
},
|
||||
getindex(index,data) {
|
||||
getindex(index, data) {
|
||||
this.listindex = index
|
||||
if (data){
|
||||
if (data) {
|
||||
this.order.amount = data.rechargeBalance
|
||||
this.order.rechargeBalance = data.rechargeBalance
|
||||
this.order.points = data.points
|
||||
this.realyPayBills = data.rechargeBalance
|
||||
this.order.rechargeBalance = data.rechargeBalance
|
||||
} else {
|
||||
this.order.amount = this.value
|
||||
this.realyPayBills = this.value
|
||||
this.order.rechargeBalance = this.value
|
||||
}
|
||||
},
|
||||
// 二维码
|
||||
@ -223,25 +235,32 @@
|
||||
title: "请先选择会员",
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (!this.order.amount){
|
||||
if (!this.order.amount) {
|
||||
uni.showToast({
|
||||
title:"请先选择充值金额",
|
||||
icon:"none"
|
||||
title: "请先选择充值金额",
|
||||
icon: "none"
|
||||
})
|
||||
return;
|
||||
}
|
||||
if (this.order.paymentType == "CASH") {
|
||||
this.authCode = this.order.amount
|
||||
this.govipjs()
|
||||
} else {
|
||||
let _this = this
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: (res) => {
|
||||
console.log('扫描二维码成功,结果:' + JSON.stringify(res) + res.result);
|
||||
_this.authCode = res.result
|
||||
_this.govipjs()
|
||||
},
|
||||
error: (res) => {
|
||||
console.log('扫描二维码出现错误')
|
||||
}
|
||||
})
|
||||
}
|
||||
let _this = this
|
||||
uni.scanCode({
|
||||
onlyFromCamera: true,
|
||||
success: (res) => {
|
||||
console.log('扫描二维码成功,结果:' + JSON.stringify(res) + res.result);
|
||||
_this.authCode = res.result
|
||||
_this.govipjs()
|
||||
},
|
||||
error: (res) => {
|
||||
console.log('扫描二维码出现错误')
|
||||
}
|
||||
})
|
||||
},
|
||||
govipjs() {
|
||||
let actualPayment = 0
|
||||
@ -254,17 +273,17 @@
|
||||
this.order.authCode = this.authCode
|
||||
this.order.realyPayBills = this.realyPayBills
|
||||
this.order.actualPayment = actualPayment
|
||||
|
||||
|
||||
request({
|
||||
url: 'business/marketingActivity/cardFuelRecord/prepaidFuelTopUp',
|
||||
method: 'post',
|
||||
data:this.order
|
||||
data: this.order
|
||||
}).then((res) => {
|
||||
// uni.navigateTo({
|
||||
// url: '/pagesHome/PaymentResults/PaymentResults'
|
||||
// })
|
||||
})
|
||||
|
||||
|
||||
},
|
||||
goback() {
|
||||
uni.navigateBack()
|
||||
|
Loading…
Reference in New Issue
Block a user