11.19
This commit is contained in:
parent
6c1be3c72f
commit
7f94d5a7d9
@ -116,6 +116,10 @@ public class IntegralOrders extends BaseEntity {
|
||||
* 核销码
|
||||
*/
|
||||
private String checkCode;
|
||||
/**
|
||||
* 手机号
|
||||
*/
|
||||
private String phone;
|
||||
|
||||
}
|
||||
|
||||
|
@ -129,5 +129,14 @@ public interface IntegralOrdersMapper {
|
||||
|
||||
|
||||
Map<Object, Object> queryByBuySum(@Param("integralOrders") IntegralOrdersDTO integralOrders);
|
||||
|
||||
|
||||
/**
|
||||
* 通过订单号
|
||||
*
|
||||
* @param id 主键
|
||||
* @return 实例对象
|
||||
*/
|
||||
IntegralOrders getOneByOrderNo(String orderNo);
|
||||
}
|
||||
|
||||
|
@ -901,7 +901,14 @@
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<select id="getOneByOrderNo" resultType="com.fuint.business.integral.vo.IntegralOrdersVO">
|
||||
select
|
||||
*
|
||||
from
|
||||
integral_orders
|
||||
where
|
||||
order_number=#{orderNo}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
|
@ -419,6 +419,7 @@ public class IntegralOrdersServiceImpl implements IntegralOrdersService {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
integralOrdersList1.get(0).setPhone(ljUserVos.getMobile());
|
||||
return integralOrdersList1.get(0);
|
||||
}
|
||||
|
||||
|
@ -382,7 +382,23 @@ public class printerController extends BaseController {
|
||||
}
|
||||
@PostMapping("printIntegralReport")
|
||||
public void printIntegralReport(@RequestBody Map<String, Object> integral) {
|
||||
printerService.printIntegralReport(integral,TokenUtil.getNowAccountInfo().getStoreId());
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
MtUser mtUser=null;
|
||||
UserBalance userBalance=null;
|
||||
LJUserGrade ljUserGrade=null;
|
||||
String orderNo=null;
|
||||
List<Map<String,String>> o = (List<Map<String,String>>)integral.get("oilOrder");
|
||||
for (Map<String, String> stringStringMap : o) {
|
||||
orderNo=stringStringMap.get("orderNo");
|
||||
if("散客".equals(stringStringMap.get("payUser"))){
|
||||
}else {
|
||||
mtUser=mtUserMapper.selectByPhone(stringStringMap.get("payUser"));
|
||||
userBalance=userBalanceMapper.getUserBalanceByUserId(mtUser.getId().toString());
|
||||
ljUserGrade= ljUserGradeMapper.getUserGradeByUserId(userBalance.getGradeId().toString());
|
||||
}
|
||||
}
|
||||
ReceiptPrinting receiptPrinting = receiptPrintingService.queryReceiptPrintingOne(nowAccountInfo.getStoreId());
|
||||
printerService.printIntegralReport(integral,TokenUtil.getNowAccountInfo().getStoreId(),receiptPrinting,mtUser,userBalance,ljUserGrade,orderNo);
|
||||
|
||||
}
|
||||
|
||||
|
@ -35,6 +35,6 @@ public interface PrinterService {
|
||||
void printFuelDieselReport(Map<String, Object> printCardValue,Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo);
|
||||
|
||||
|
||||
void printIntegralReport(Map<String, Object> integral, Integer storeId);
|
||||
void printIntegralReport(Map<String, Object> integral, Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo);
|
||||
void handoverShiftPrintingReceipt(Map<String, Object> handAll);
|
||||
}
|
||||
|
@ -4,6 +4,8 @@ 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.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.integral.mapper.IntegralOrdersMapper;
|
||||
import com.fuint.business.order.mapper.AllOrderInfoMapper;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.printer.entity.PrintDeviceInfo;
|
||||
@ -369,9 +371,11 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
}
|
||||
}
|
||||
|
||||
public void printIntegralReport(Map<String, Object> integral,Integer storeId) {
|
||||
@Resource
|
||||
private IntegralOrdersMapper integralOrdersMapper;
|
||||
public void printIntegralReport(Map<String, Object> integral,Integer storeId, ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,String orderNo) {
|
||||
PrintDeviceInfo infoByStoreId = printDeviceInfoMapper.getInfoByStoreId(storeId);
|
||||
|
||||
IntegralOrders allOrderInfoVo=integralOrdersMapper.getOneByOrderNo(orderNo);
|
||||
log.info("handover:{}",integral.toString());
|
||||
Methods m=Methods.getInstance();
|
||||
Object accessToken = RedisUtil.get("scancodemodel+" + storeId);
|
||||
@ -388,7 +392,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
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());
|
||||
String url=m.print(infoByStoreId.getMachineCode(), PrintIntegralReport.printIntegral(receiptPrinting,mtUser,userBalance,ljUserGrade,allOrderInfoVo), "Z"+System.currentTimeMillis()+random6.toString());
|
||||
if (ObjectUtil.isNotEmpty(url)) {
|
||||
// 使用 Fastjson 将 JSON 字符串解析为 JSONObject
|
||||
JSONObject jsonObject = JSON.parseObject(url);
|
||||
@ -396,7 +400,7 @@ public class PrinterServiceImpl implements PrinterService {
|
||||
String error = jsonObject.getString("error");
|
||||
if ("18".equals(error)) {
|
||||
getToken(storeId);
|
||||
printIntegralReport(integral,storeId);
|
||||
printIntegralReport(integral,storeId, receiptPrinting, mtUser, userBalance, ljUserGrade, orderNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,14 @@
|
||||
package com.fuint.business.printer.template;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.fuint.business.integral.entity.IntegralOrders;
|
||||
import com.fuint.business.order.vo.AllOrderInfoVo;
|
||||
import com.fuint.business.setting.entity.ReceiptPrinting;
|
||||
import com.fuint.business.userManager.entity.LJUserGrade;
|
||||
import com.fuint.business.userManager.entity.UserBalance;
|
||||
import com.fuint.common.dto.AccountInfo;
|
||||
import com.fuint.common.util.TokenUtil;
|
||||
import com.fuint.repository.model.MtUser;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@ -12,21 +18,89 @@ import java.util.Map;
|
||||
|
||||
public class PrintIntegralReport {
|
||||
public static Map<String, Object> handover = new HashMap<>();
|
||||
public static String printIntegral(){
|
||||
public static String printIntegral(ReceiptPrinting receiptPrinting, MtUser mtUser, UserBalance userBalance, LJUserGrade ljUserGrade,
|
||||
IntegralOrders allOrderInfoVo){
|
||||
// StringBuilder sb=new StringBuilder();
|
||||
//
|
||||
// LocalDateTime now = LocalDateTime.now();
|
||||
// DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
// String formattedDateTime = now.format(formatter);
|
||||
// System.out.println("当前时间:" + formattedDateTime);
|
||||
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
//
|
||||
//
|
||||
// sb.append("<center>积分兑换\r\n</center>");
|
||||
//
|
||||
// sb.append("打印时间:"+formattedDateTime +"\r\n");
|
||||
// sb.append("店铺名称:"+nowAccountInfo.getStoreName() +"\r\n");
|
||||
// sb.append("--------------------------------\r\n");
|
||||
//
|
||||
// if (ObjectUtil.isNotEmpty(handover.get("shoppingCart"))) {
|
||||
// sb.append("<table><tr><td>商品名称</td><td>商品数量</td><td>价格</td></tr>");
|
||||
// List<Map<String,Object>> o = (List<Map<String,Object>>)handover.get("shoppingCart");
|
||||
// for (Map<String, Object> stringStringMap : o) {
|
||||
// sb.append("<tr><td>"+stringStringMap.get("giftName")+"</td>");
|
||||
// sb.append("<td>"+((ObjectUtil.isNotEmpty(stringStringMap.get("markPurchases")))?stringStringMap.get("markPurchases").toString():"0")+"</td>");
|
||||
//
|
||||
// sb.append("<td>"+ stringStringMap.get("price")+"</td></tr>");
|
||||
// }
|
||||
// sb.append("</table>");
|
||||
// sb.append("--------------------------------\r\n");
|
||||
//
|
||||
// }
|
||||
//
|
||||
//
|
||||
// if (ObjectUtil.isNotEmpty(handover.get("allPoints"))) {
|
||||
// sb.append("总积分:"+handover.get("allPoints")+"\r\n");
|
||||
// sb.append("--------------------------------\r\n");
|
||||
// }
|
||||
// if (ObjectUtil.isNotEmpty(handover.get("allAmout"))) {
|
||||
// sb.append("总价格:¥"+handover.get("allAmout")+"\r\n");
|
||||
// sb.append("--------------------------------\r\n");
|
||||
// }
|
||||
//
|
||||
// sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
StringBuilder sb=new StringBuilder();
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
String formattedDateTime = now.format(formatter);
|
||||
System.out.println("当前时间:" + formattedDateTime);
|
||||
AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
// AccountInfo nowAccountInfo = TokenUtil.getNowAccountInfo();
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("zzzzz","积分消费"));
|
||||
|
||||
|
||||
sb.append("<center>积分兑换\r\n</center>");
|
||||
|
||||
sb.append("打印时间:"+formattedDateTime +"\r\n");
|
||||
sb.append("店铺名称:"+nowAccountInfo.getStoreName() +"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
System.out.println( receiptPrinting.getPrintTemplateTop());
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("xxxxx","32131566313655"));
|
||||
if(mtUser!=null&&mtUser.getUserNo()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("kkkkk",mtUser.getUserNo()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("卡号:kkkkk\r\n",""));
|
||||
}
|
||||
if(mtUser!=null&&mtUser.getCarNo()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("ccccc",mtUser.getCarNo()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("车牌号:ccccc\r\n",""));
|
||||
}
|
||||
if(ljUserGrade!=null&&ljUserGrade.getName()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("ddddd",ljUserGrade.getName()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("等级:ddddd\r\n",""));
|
||||
}
|
||||
if(mtUser!=null&&mtUser.getMobile()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("sssss",mtUser.getMobile()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("手机号:sssss\r\n",""));
|
||||
}
|
||||
if(userBalance!=null&&userBalance.getCardBalance().toString()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("yyyyy",userBalance.getCardBalance().toString()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("余额:yyyyy\r\n",""));
|
||||
}
|
||||
if(userBalance!=null&&userBalance.getPoints().toString()!=null){
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("jjjjj",userBalance.getPoints().toString()));
|
||||
}else {
|
||||
receiptPrinting.setPrintTemplateTop(receiptPrinting.getPrintTemplateTop().replace("积分:jjjjj\r\n",""));
|
||||
}
|
||||
|
||||
if (ObjectUtil.isNotEmpty(handover.get("shoppingCart"))) {
|
||||
sb.append("<table><tr><td>商品名称</td><td>商品数量</td><td>价格</td></tr>");
|
||||
@ -51,10 +125,10 @@ public class PrintIntegralReport {
|
||||
sb.append("总价格:¥"+handover.get("allAmout")+"\r\n");
|
||||
sb.append("--------------------------------\r\n");
|
||||
}
|
||||
|
||||
sb.append("<center>谢谢惠顾,欢迎下次光临!</center>");
|
||||
|
||||
return sb.toString();
|
||||
receiptPrinting.setPrintTemplateDown(receiptPrinting.getPrintTemplateDown().
|
||||
replace("ttttt",formattedDateTime));
|
||||
System.out.println(receiptPrinting.getPrintTemplateTop()+sb.toString()+receiptPrinting.getPrintTemplateDown());
|
||||
return receiptPrinting.getPrintTemplateTop()+sb.toString()+receiptPrinting.getPrintTemplateDown();
|
||||
}
|
||||
|
||||
public static Map<String, Object> getHandover() {
|
||||
|
@ -447,7 +447,8 @@ export default {
|
||||
allPoints: 0,
|
||||
allAmout: 0,
|
||||
allMoneyRatio: 0,
|
||||
|
||||
userId:null,
|
||||
orderNo:null,
|
||||
dialogVisible: false, //员工选择
|
||||
dialogVisiblevip: false, // 会员查询
|
||||
dialogVisibleMember: false,// 模糊查询会员
|
||||
@ -985,7 +986,14 @@ export default {
|
||||
}
|
||||
shoppingCart.push(a)
|
||||
})
|
||||
let oo=[];
|
||||
let mm={
|
||||
payUser:this.userId,
|
||||
orderNo:this.orderNo
|
||||
}
|
||||
oo.push(mm)
|
||||
let f = {
|
||||
oilOrder:oo,
|
||||
shoppingCart: shoppingCart,
|
||||
allPoints: this.allPoints,
|
||||
allAmout: this.allAmout
|
||||
@ -1042,6 +1050,8 @@ export default {
|
||||
if (response.data != null) {
|
||||
this_.loading = true
|
||||
orderNumber = response.data.orderNumber
|
||||
this_.userId = response.data.phone
|
||||
this_.orderNo = response.data.orderNumber
|
||||
if (response.data.status == 'un') {
|
||||
this.$message.error('积分已不足')
|
||||
this_.loading = false
|
||||
|
Loading…
Reference in New Issue
Block a user