diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java index a41f78e3a..404acf702 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/api/fuyou/service/impl/FyPayServiceImpl.java @@ -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 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) { diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java index d85e75b9a..bc035309f 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardFule/service/impl/CardFuelRecordServiceImpl.java @@ -221,8 +221,16 @@ public class CardFuelRecordServiceImpl implements CardFuelRecordService { CardFuelRecord cardFuelRecord = new CardFuelRecord(); if (ObjectUtils.isNotEmpty(cardFuelRecords)){ - Optional max = cardFuelRecords.stream().max(Comparator.comparing(CardFuelRecord::getLockupPrice)); - cardFuelRecord = max.get(); + ArrayList list = new ArrayList<>(); + for (CardFuelRecord fuelRecord : cardFuelRecords) { + if (ObjectUtils.isNotEmpty(fuelRecord.getLockupPrice())){ + list.add(fuelRecord); + } + } + if (ObjectUtils.isNotEmpty(list)){ + Optional 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); diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java index 807b852f1..d83b5ce45 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/CardValueOrdersService.java @@ -33,5 +33,7 @@ public interface CardValueOrdersService extends IService { * @param status 支付状态 */ void updateOrderStatus(String orderNo,String status); + + void updateBalance(String orderNo,String status); } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java index d6306f584..d20d1110a 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/marketingActivity/cardValueOrders/service/impl/CardValueOrdersServiceImpl.java @@ -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 favorableRecordsList = page1.getRecords(); + for (FavorableRecords favorableRecords1 : favorableRecordsList) { + + } return page1; } diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/PrintDeviceInfoController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/controller/PrintDeviceInfoController.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/controller/PrintDeviceInfoController.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/controller/PrintDeviceInfoController.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/controller/printerController.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/controller/printerController.java new file mode 100644 index 000000000..3aba10ed1 --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/controller/printerController.java @@ -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 callback(Map map){ + log.info("------print/callback-------"); + Map objectObjectHashMap = new HashMap<>(); + objectObjectHashMap.put("message","ok"); + return objectObjectHashMap; + } + + @GetMapping("push") + public Map push( Map map){ + log.info("------接收GET回调-------"); + Map objectObjectHashMap = new HashMap<>(); + objectObjectHashMap.put("message","ok"); + return objectObjectHashMap; + } + + @PostMapping("push") + public Map 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 objectObjectHashMap = new HashMap<>(); +//// {"order_payment":{"pay_amount":"支付金额","pay_amount_source":3},"processed_state":0} +// +// +// Map orderPaymentMap = new HashMap<>(); +// orderPaymentMap.put("pay_amount", payAmount); +//// orderPaymentMap.put("pay_amount", 0.01); +// orderPaymentMap.put("pay_amount_source", 3); +// +// Map processedStateMap = new HashMap<>(); +// processedStateMap.put("processed_state", 0); +// +// Map 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+""; +// 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 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 testList = new ArrayList(); + 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 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 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 oilOrder) { + printerService.reOilOrderReport(oilOrder,TokenUtil.getNowAccountInfo().getStoreId()); + } + /** + * 余额充值订单 + * @param cardValue + */ + @PostMapping("printCardValueReport") + public void printCardValueReport(@RequestBody Map 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 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 integral) { + printerService.printIntegralReport(integral,TokenUtil.getNowAccountInfo().getStoreId()); + + } +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/entity/PrintDeviceInfo.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/entity/PrintDeviceInfo.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/entity/PrintDeviceInfo.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/entity/PrintDeviceInfo.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/entity/Test.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/entity/Test.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/entity/Test.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/entity/Test.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/mapper/PrintDeviceInfoMapper.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/mapper/PrintDeviceInfoMapper.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/mapper/PrintDeviceInfoMapper.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/mapper/PrintDeviceInfoMapper.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/mapper/xml/PrintDeviceInfoMapper.xml b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/mapper/xml/PrintDeviceInfoMapper.xml similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/mapper/xml/PrintDeviceInfoMapper.xml rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/mapper/xml/PrintDeviceInfoMapper.xml diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrintDeviceInfoService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/PrintDeviceInfoService.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrintDeviceInfoService.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/PrintDeviceInfoService.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/PrinterService.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/PrinterService.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/PrinterService.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrintDeviceInfoServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/impl/PrintDeviceInfoServiceImpl.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/service/impl/PrintDeviceInfoServiceImpl.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/impl/PrintDeviceInfoServiceImpl.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/impl/PrinterServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/impl/PrinterServiceImpl.java new file mode 100644 index 000000000..50bf3268a --- /dev/null +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/service/impl/PrinterServiceImpl.java @@ -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 PostPush(String ciphertext, String nonce, String tag, String additional_data, String iv, String signature) { + System.out.println("PostMapping"+ciphertext); + code = new String(); + Map 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 map = jsonObject.getInnerMap(); + //获取支付参数 + Map orderPaymentMap = (Map) 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 objectObjectHashMap = new HashMap<>(); + Map orderPaymentMap = new HashMap<>(); + orderPaymentMap.put("pay_amount", payAmount); +// orderPaymentMap.put("pay_amount", 0.01); + + orderPaymentMap.put("pay_amount_source", 3); + Map processedStateMap = new HashMap<>(); + processedStateMap.put("processed_state", 0); + Map 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+""; + 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 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 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 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 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 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 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 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 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("
收款码打印\r\n
"); + 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("
谢谢惠顾,欢迎下次光临!
"); + + 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); + } + +} diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/Handover.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/Handover.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/Handover.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/Handover.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/Prient.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/Prient.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/Prient.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/Prient.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintCardValueReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintCardValueReport.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintCardValueReport.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintCardValueReport.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintFuelDieselReport.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintFuelDieselReport.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintFuelDieselReport.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintIntegralReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintIntegralReport.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintIntegralReport.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintIntegralReport.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintOilOrderReport.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/PrintOilOrderReport.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/PrintOilOrderReport.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/RePrintOilOrderReport.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/RePrintOilOrderReport.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/template/RePrintOilOrderReport.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/template/RePrintOilOrderReport.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/ApiConst.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/ApiConst.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/ApiConst.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/ApiConst.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/DeCode.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/DeCode.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/DeCode.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/DeCode.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/HttpUtil.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/HttpUtil.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/HttpUtil.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/HttpUtil.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/LAVApi.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/LAVApi.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/LAVApi.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/LAVApi.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/Methods.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/Methods.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/Methods.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/Methods.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/TestSrvlet.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/TestSrvlet.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/unit/TestSrvlet.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/unit/TestSrvlet.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/vo/OrderPayment.java b/fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/vo/OrderPayment.java similarity index 100% rename from fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/vo/OrderPayment.java rename to fuintBackend/fuint-application/src/main/java/com/fuint/business/printer/printer/vo/OrderPayment.java diff --git a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/service/impl/SysDictTypeServiceImpl.java b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/service/impl/SysDictTypeServiceImpl.java index 73f61eaf0..52bafa680 100644 --- a/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/service/impl/SysDictTypeServiceImpl.java +++ b/fuintBackend/fuint-application/src/main/java/com/fuint/system/dict/service/impl/SysDictTypeServiceImpl.java @@ -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 selectDictDataByType(String dictType) { - List dictDatas = DictUtils.getDictCache(dictType); + List dictDatas = new ArrayList<>(); + /* List 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 - + diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Goods.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Goods.vue index 5057f1b7e..af095ed99 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Goods.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Goods.vue @@ -254,7 +254,7 @@

- 退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理 + 退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理
取 消 @@ -541,7 +541,7 @@ export default { 'UNIONPAY': '银联二维码', 'credit': '挂账', 'oilCard': '囤油卡', - 'balance': '储值卡', + 'balance': '电子储值卡', '0': '兑换卷核销' }; let payTypeText = payTypeMap[this.goods.payType] || '小程序码'; diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Integral.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Integral.vue index 57371d0e2..5f49cbc6d 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Integral.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Integral.vue @@ -64,7 +64,7 @@ - + @@ -182,7 +182,7 @@ - + diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue index 409cbc7f8..f6e885245 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Oil.vue @@ -42,8 +42,8 @@ :label="item.dictLabel" :value="item.dictValue"> - - + + @@ -198,14 +198,14 @@ - + @@ -287,7 +287,7 @@

- 退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、储值卡等原路退回处理 + 退款仅支持全额退款,退款金额将按照支付信息原路退回、优惠券、电子储值卡等原路退回处理
取 消 @@ -309,7 +309,7 @@
微信
支付宝
银联二维码
-
储值卡
+
电子储值卡
囤油卡
小程序码
@@ -322,7 +322,7 @@
¥{{ oilOrder.discountAmount }}
-
储值卡付款金额
+
电子储值卡付款金额
¥{{ oilOrder.balanceAmount }}
@@ -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, diff --git a/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue b/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue index 1679ebae4..a066103e1 100644 --- a/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue +++ b/fuintCashierWeb/src/views/cashier/orderComponents/order_Ordinary.vue @@ -114,7 +114,7 @@
- +