You've already forked FrameTour-BE
refactor(print): 优化门票打印逻辑
- 移除了 AppClaimController 中的重复代码 - 在 VoucherPrintServiceImpl 中增加了打印配置的判断和警告日志 - 保留了 FeiETicketPrinter 的调用逻辑,增加了配置判断
This commit is contained in:
@@ -49,7 +49,6 @@ public class AppClaimController {
|
|||||||
if (voucherPrintResp != null) {
|
if (voucherPrintResp != null) {
|
||||||
claimResp.setHasCoupon(false);
|
claimResp.setHasCoupon(false);
|
||||||
claimResp.setHasPrint(true);
|
claimResp.setHasPrint(true);
|
||||||
claimResp.setHasPrint(voucherPrintResp.getPrintStatus() == 1);
|
|
||||||
claimResp.setPrintCode(voucherPrintResp.getCode());
|
claimResp.setPrintCode(voucherPrintResp.getCode());
|
||||||
claimResp.setPrintType(voucherPrintResp.getType());
|
claimResp.setPrintType(voucherPrintResp.getType());
|
||||||
return ApiResponse.success(claimResp);
|
return ApiResponse.success(claimResp);
|
||||||
@@ -66,7 +65,6 @@ public class AppClaimController {
|
|||||||
if (voucherPrintResp != null) {
|
if (voucherPrintResp != null) {
|
||||||
claimResp.setHasCoupon(false);
|
claimResp.setHasCoupon(false);
|
||||||
claimResp.setHasPrint(true);
|
claimResp.setHasPrint(true);
|
||||||
claimResp.setHasPrint(voucherPrintResp.getPrintStatus() == 1);
|
|
||||||
claimResp.setPrintCode(voucherPrintResp.getCode());
|
claimResp.setPrintCode(voucherPrintResp.getCode());
|
||||||
claimResp.setPrintType(voucherPrintResp.getType());
|
claimResp.setPrintType(voucherPrintResp.getType());
|
||||||
return ApiResponse.success(claimResp);
|
return ApiResponse.success(claimResp);
|
||||||
|
@@ -327,7 +327,7 @@ public class VoucherPrintServiceImpl implements VoucherPrintService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 调用打印机接口(待实现)
|
* 调用打印机接口
|
||||||
*/
|
*/
|
||||||
private void printTicket(VoucherPrintRecord record, VoucherPrintResp voucherPrintResp) throws Exception {
|
private void printTicket(VoucherPrintRecord record, VoucherPrintResp voucherPrintResp) throws Exception {
|
||||||
FaceEntity face = faceRepository.getFace(record.getFaceId());
|
FaceEntity face = faceRepository.getFace(record.getFaceId());
|
||||||
@@ -362,7 +362,11 @@ public class VoucherPrintServiceImpl implements VoucherPrintService {
|
|||||||
content += "<CB>"+voucherPrintResp.getCode()+"</CB>";
|
content += "<CB>"+voucherPrintResp.getCode()+"</CB>";
|
||||||
content += "<C>"+voucherPrintResp.getType()+"</C>";
|
content += "<C>"+voucherPrintResp.getType()+"</C>";
|
||||||
content += "<C>有效期:"+sdf2.format(new Date())+"</C>";
|
content += "<C>有效期:"+sdf2.format(new Date())+"</C>";
|
||||||
// FeiETicketPrinter.doPrint("550519002", content, 1);
|
ScenicConfigManager config = scenicRepository.getScenicConfigManager(face.getScenicId());
|
||||||
log.info("打印完成->内容:\n{}", content);
|
if (Strings.isNotBlank(config.getString("ticket_print_sn"))) {
|
||||||
|
FeiETicketPrinter.doPrint(config.getString("ticket_print_sn"), content, 1);
|
||||||
|
} else {
|
||||||
|
log.warn("打印没有配置->内容:\n{}", content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user