打印
This commit is contained in:
parent
d54741be7f
commit
c68906e59e
@ -1,33 +1,35 @@
|
|||||||
package com.zbkj.admin.controller;
|
package com.zbkj.admin.controller;
|
||||||
|
|
||||||
|
import com.zbkj.common.enums.EnumPintNode;
|
||||||
import com.zbkj.common.response.CommonResult;
|
import com.zbkj.common.response.CommonResult;
|
||||||
import com.zbkj.service.service.YlyPrintService;
|
import com.zbkj.service.service.impl.printer.PrintHandle;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 易联云打印订单
|
* 打印订单
|
||||||
|
|
||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("api/admin/yly")
|
@RequestMapping("api/admin/yly")
|
||||||
@Api(tags = "易联云 打印订单小票") //配合swagger使用
|
@Api(tags = "打印订单小票") //配合swagger使用
|
||||||
public class YlyPrintController {
|
public class PrintController {
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private YlyPrintService ylyPrintService;
|
private PrintHandle printHandle;
|
||||||
|
|
||||||
@PreAuthorize("hasAuthority('admin:yly:print')")
|
@PreAuthorize("hasAuthority('admin:yly:print')")
|
||||||
@ApiOperation(value = "打印小票")
|
@ApiOperation(value = "打印小票")
|
||||||
@RequestMapping(value = "/print/{ordid}", method = RequestMethod.GET)
|
@RequestMapping(value = "/print/{ordid}", method = RequestMethod.GET)
|
||||||
public CommonResult<String> updateStatus(@PathVariable String ordid) {
|
public CommonResult<String> updateStatus(@PathVariable String ordid) {
|
||||||
ylyPrintService.YlyPrint(ordid,false);
|
printHandle.print(ordid, EnumPintNode.PLATFORM);
|
||||||
return CommonResult.success();
|
return CommonResult.success();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -212,32 +212,32 @@ public class StoreOrderController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* 核销码核销订单
|
// * 核销码核销订单
|
||||||
*
|
// *
|
||||||
* @author stivepeim
|
// * @author stivepeim
|
||||||
* @since 2020-09-01
|
// * @since 2020-09-01
|
||||||
*/
|
// */
|
||||||
@PreAuthorize("hasAuthority('admin:order:write:update')")
|
// @PreAuthorize("hasAuthority('admin:order:write:update')")
|
||||||
@ApiOperation(value = "核销码核销订单")
|
// @ApiOperation(value = "核销码核销订单")
|
||||||
@RequestMapping(value = "/writeUpdate/{vCode}", method = RequestMethod.GET)
|
// @RequestMapping(value = "/writeUpdate/{vCode}", method = RequestMethod.GET)
|
||||||
public CommonResult<Object> verificationOrder(@PathVariable String vCode) {
|
// public CommonResult<Object> verificationOrder(@PathVariable String vCode) {
|
||||||
return CommonResult.success(storeOrderVerification.verificationOrderByCode(vCode));
|
// return CommonResult.success(storeOrderVerification.verificationOrderByCode(vCode));
|
||||||
}
|
// }
|
||||||
|
//
|
||||||
/**
|
// /**
|
||||||
* 核销码查询待核销订单
|
// * 核销码查询待核销订单
|
||||||
*
|
// *
|
||||||
* @author stivepeim
|
// * @author stivepeim
|
||||||
* @since 2020-09-01
|
// * @since 2020-09-01
|
||||||
*/
|
// */
|
||||||
@PreAuthorize("hasAuthority('admin:order:write:confirm')")
|
// @PreAuthorize("hasAuthority('admin:order:write:confirm')")
|
||||||
@ApiOperation(value = "核销码查询待核销订单")
|
// @ApiOperation(value = "核销码查询待核销订单")
|
||||||
@RequestMapping(value = "/writeConfirm/{vCode}", method = RequestMethod.GET)
|
// @RequestMapping(value = "/writeConfirm/{vCode}", method = RequestMethod.GET)
|
||||||
public CommonResult<Object> verificationConfirmOrder(
|
// public CommonResult<Object> verificationConfirmOrder(
|
||||||
@PathVariable String vCode) {
|
// @PathVariable String vCode) {
|
||||||
return CommonResult.success(storeOrderVerification.getVerificationOrderByCode(vCode));
|
// return CommonResult.success(storeOrderVerification.getVerificationOrderByCode(vCode));
|
||||||
}
|
// }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单统计详情
|
* 订单统计详情
|
||||||
|
@ -562,4 +562,11 @@ public class Constants {
|
|||||||
/** 失效 */
|
/** 失效 */
|
||||||
public static final Integer STATUS_INVALID = 0;
|
public static final Integer STATUS_INVALID = 0;
|
||||||
|
|
||||||
|
// 支付成功自动打印开关
|
||||||
|
public static final String PRINT_AUTO_STATUS = "print_auto_status";
|
||||||
|
// 打印开关
|
||||||
|
public static final String PRINT_STATUS = "print_status";
|
||||||
|
// 打印类型,1佳博,2易联云
|
||||||
|
public static final String PRINT_TYPE = "pint_type";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,8 @@ public class YlyConstants {
|
|||||||
public static final String YLY_PRINT_APP_MACHINE_CODE = "ylyprint_app_machine_code";
|
public static final String YLY_PRINT_APP_MACHINE_CODE = "ylyprint_app_machine_code";
|
||||||
// 易联云打印机设备密钥
|
// 易联云打印机设备密钥
|
||||||
public static final String YLY_PRINT_APP_MACHINE_MSIGN = "ylyprint_app_machine_msign";
|
public static final String YLY_PRINT_APP_MACHINE_MSIGN = "ylyprint_app_machine_msign";
|
||||||
// 易联云打印开关
|
|
||||||
public static final String YLY_PRINT_AUTO_STATUS = "ylyprint_auto_status";
|
|
||||||
public static final String YLY_PRINT_STATUS = "ylyprint_status";
|
|
||||||
|
|
||||||
//
|
//
|
||||||
public static final String YLY_REDIS_TOKEN = "yly_token";
|
public static final String YLY_REDIS_TOKEN = "yly_token";
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
package com.zbkj.common.enums;
|
||||||
|
|
||||||
|
public enum EnumPintNode {
|
||||||
|
|
||||||
|
CREATE_ORDER("1","下单自动打印"),
|
||||||
|
PLATFORM("2","平台手动打印"),
|
||||||
|
;
|
||||||
|
|
||||||
|
private String name;
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
EnumPintNode(String name, String code) {
|
||||||
|
this.name = name;
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCode() {
|
||||||
|
return code;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCode(String code) {
|
||||||
|
this.code = code;
|
||||||
|
}
|
||||||
|
}
|
@ -22,6 +22,10 @@
|
|||||||
<artifactId>food-common</artifactId>
|
<artifactId>food-common</artifactId>
|
||||||
<version>${food-common}</version>
|
<version>${food-common}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>net.java.dev.jna</groupId>
|
||||||
|
<artifactId>jna</artifactId>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.zbkj.service.service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印机打印订单 service
|
||||||
|
*/
|
||||||
|
public interface PrintService {
|
||||||
|
|
||||||
|
String code();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 打印商品信息
|
||||||
|
*
|
||||||
|
* @param ordId 订单id
|
||||||
|
*/
|
||||||
|
void print(String ordId);
|
||||||
|
|
||||||
|
}
|
@ -1,14 +0,0 @@
|
|||||||
package com.zbkj.service.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 易联云打印订单 service
|
|
||||||
|
|
||||||
*/
|
|
||||||
public interface YlyPrintService {
|
|
||||||
/**
|
|
||||||
* 易联云打印商品信息
|
|
||||||
* @param ordId 订单id
|
|
||||||
* @param isAuto 是否自动打印
|
|
||||||
*/
|
|
||||||
void YlyPrint(String ordId,boolean isAuto);
|
|
||||||
}
|
|
@ -6,6 +6,7 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.zbkj.common.constants.*;
|
import com.zbkj.common.constants.*;
|
||||||
|
import com.zbkj.common.enums.EnumPintNode;
|
||||||
import com.zbkj.common.exception.CrmebException;
|
import com.zbkj.common.exception.CrmebException;
|
||||||
import com.zbkj.common.model.combination.StoreCombination;
|
import com.zbkj.common.model.combination.StoreCombination;
|
||||||
import com.zbkj.common.model.combination.StorePink;
|
import com.zbkj.common.model.combination.StorePink;
|
||||||
@ -28,6 +29,7 @@ import com.zbkj.common.utils.WxPayUtil;
|
|||||||
import com.zbkj.common.vo.*;
|
import com.zbkj.common.vo.*;
|
||||||
import com.zbkj.service.delete.OrderUtils;
|
import com.zbkj.service.delete.OrderUtils;
|
||||||
import com.zbkj.service.service.*;
|
import com.zbkj.service.service.*;
|
||||||
|
import com.zbkj.service.service.impl.printer.PrintHandle;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
@ -144,7 +146,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
private UserExperienceRecordService userExperienceRecordService;
|
private UserExperienceRecordService userExperienceRecordService;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private YlyPrintService ylyPrintService;
|
private PrintHandle printHandle;
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemNotificationService systemNotificationService;
|
private SystemNotificationService systemNotificationService;
|
||||||
@ -300,7 +302,7 @@ public class OrderPayServiceImpl implements OrderPayService {
|
|||||||
autoSendCoupons(storeOrder);
|
autoSendCoupons(storeOrder);
|
||||||
|
|
||||||
// 根据配置 打印小票
|
// 根据配置 打印小票
|
||||||
ylyPrintService.YlyPrint(storeOrder.getOrderId(),true);
|
printHandle.print(storeOrder.getOrderId(), EnumPintNode.CREATE_ORDER);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -0,0 +1,73 @@
|
|||||||
|
package com.zbkj.service.service.impl.printer;
|
||||||
|
|
||||||
|
import com.zbkj.service.service.PrintService;
|
||||||
|
import com.zbkj.service.service.StoreOrderInfoService;
|
||||||
|
import com.zbkj.service.service.StoreOrderService;
|
||||||
|
import com.zbkj.service.util.jiab.JiabUtil;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 佳博打印机
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class JiabPrintServiceImpl implements PrintService {
|
||||||
|
|
||||||
|
private static final Logger logger = LoggerFactory.getLogger(JiabPrintServiceImpl.class);
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreOrderService storeOrderService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private StoreOrderInfoService storeOrderInfoService;
|
||||||
|
|
||||||
|
private static JiabUtil pjb = JiabUtil.INSTANCE;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String code() {
|
||||||
|
return "1";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void print(String ordId) {
|
||||||
|
System.out.println("1111");
|
||||||
|
// System.setProperty("jna.encoding", "GBK");
|
||||||
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyMMddHHmmss");
|
||||||
|
//
|
||||||
|
// pjb.openport("GP-L80160 Series");
|
||||||
|
// pjb.setup("100", "200", "5", "8", "0", "0", "0");
|
||||||
|
// pjb.clearbuffer();
|
||||||
|
// pjb.windowsfont(120, 0, 48, 0, 0, 0, "宋体", "领料清单");
|
||||||
|
//
|
||||||
|
// int height = 100;
|
||||||
|
// pjb.windowsfont(5, height, 26, 0, 0, 0, "宋体", "单号:" + sdf.format(new Date()));
|
||||||
|
// height += 70;
|
||||||
|
// pjb.windowsfont(5, height, 32, 0, 0, 0, "宋体", "PO号");
|
||||||
|
// pjb.windowsfont(160, height, 32, 0, 0, 0, "宋体", "物料描述");
|
||||||
|
// pjb.windowsfont(330, height, 32, 0, 0, 0, "宋体", "数量");
|
||||||
|
//
|
||||||
|
// height = height + 45;
|
||||||
|
// pjb.windowsfont(5, height, 26, 0, 0, 0, "宋体", "111");
|
||||||
|
// pjb.windowsfont(380, height, 26, 0, 0, 0, "宋体", 2 + "");
|
||||||
|
//// if (line > 1) {
|
||||||
|
//// for (int j = 0; j < line; j++) {
|
||||||
|
//// String substring = desc.substring(8 * j, 8 * (j + 1) > desc.length() ? desc.length() : 8 * (j + 1));
|
||||||
|
//// pjb.windowsfont(130, height, 26, 0, 0, 0, "宋体", substring);
|
||||||
|
//// height = height + 45;
|
||||||
|
//// if(height > 800) {
|
||||||
|
//// pjb.printlabel("1", "1");
|
||||||
|
//// pjb.clearbuffer();
|
||||||
|
//// height = 0;
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
//// }
|
||||||
|
// pjb.windowsfont(200, height + 100, 28, 0, 0, 0, "宋体", "签字:");
|
||||||
|
// pjb.printlabel("1", "1");
|
||||||
|
// pjb.closeport();
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,56 @@
|
|||||||
|
package com.zbkj.service.service.impl.printer;
|
||||||
|
|
||||||
|
import com.zbkj.common.constants.Constants;
|
||||||
|
import com.zbkj.common.constants.YlyConstants;
|
||||||
|
import com.zbkj.common.enums.EnumPintNode;
|
||||||
|
import com.zbkj.common.exception.CrmebException;
|
||||||
|
import com.zbkj.service.service.PrintService;
|
||||||
|
import com.zbkj.service.service.SystemConfigService;
|
||||||
|
import com.zbkj.service.util.YlyUtil;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.annotation.PostConstruct;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class PrintHandle {
|
||||||
|
|
||||||
|
private final Logger logger = LoggerFactory.getLogger(PrintHandle.class);
|
||||||
|
@Autowired private YlyUtil ylyUtil;
|
||||||
|
@Autowired private List<PrintService> printServices;
|
||||||
|
@Autowired private SystemConfigService systemConfigService;
|
||||||
|
private Map<String, PrintService> printHashMap = new HashMap<>();
|
||||||
|
|
||||||
|
@PostConstruct
|
||||||
|
public void init() {
|
||||||
|
printServices.stream().forEach(i -> {
|
||||||
|
printHashMap.put(i.code(), i);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void print(String orderId, EnumPintNode pintNode) {
|
||||||
|
if (pintNode == pintNode.CREATE_ORDER && ylyUtil.checkYlyPrintAfterPaySuccess()) {
|
||||||
|
logger.info("未开启支付成功自动打印开关,略过");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (ylyUtil.checkYlyPrintStatus()) {
|
||||||
|
logger.info("未开启打印开关,略过");
|
||||||
|
}
|
||||||
|
String printType = systemConfigService.getValueByKey(Constants.PRINT_TYPE);
|
||||||
|
if (StringUtils.isEmpty(printType)) {
|
||||||
|
logger.info("未配置打印类型,略过");
|
||||||
|
}
|
||||||
|
PrintService printService = printHashMap.get(printType);
|
||||||
|
if (null == printService) {
|
||||||
|
logger.info("未配置打印类型,略过");
|
||||||
|
}
|
||||||
|
printService.print(orderId);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -1,4 +1,4 @@
|
|||||||
package com.zbkj.service.service.impl;
|
package com.zbkj.service.service.impl.printer;
|
||||||
|
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
@ -9,10 +9,7 @@ import com.zbkj.common.model.order.StoreOrder;
|
|||||||
import com.zbkj.common.request.YlyPrintRequest;
|
import com.zbkj.common.request.YlyPrintRequest;
|
||||||
import com.zbkj.common.request.YlyPrintRequestGoods;
|
import com.zbkj.common.request.YlyPrintRequestGoods;
|
||||||
import com.zbkj.common.vo.StoreOrderInfoOldVo;
|
import com.zbkj.common.vo.StoreOrderInfoOldVo;
|
||||||
import com.zbkj.service.service.StoreOrderInfoService;
|
import com.zbkj.service.service.*;
|
||||||
import com.zbkj.service.service.StoreOrderService;
|
|
||||||
import com.zbkj.service.service.SystemConfigService;
|
|
||||||
import com.zbkj.service.service.YlyPrintService;
|
|
||||||
import com.zbkj.service.util.YlyUtil;
|
import com.zbkj.service.util.YlyUtil;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@ -26,7 +23,7 @@ import java.util.List;
|
|||||||
* 易联云打印订单 service
|
* 易联云打印订单 service
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class YlyPrintServiceImpl implements YlyPrintService {
|
public class YlyPrintServiceImpl implements PrintService {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(YlyPrintServiceImpl.class);
|
private static final Logger logger = LoggerFactory.getLogger(YlyPrintServiceImpl.class);
|
||||||
@Autowired
|
@Autowired
|
||||||
private StoreOrderService storeOrderService;
|
private StoreOrderService storeOrderService;
|
||||||
@ -40,21 +37,26 @@ public class YlyPrintServiceImpl implements YlyPrintService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private YlyUtil ylyUtil;
|
private YlyUtil ylyUtil;
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String code() {
|
||||||
|
return "2";
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 易联云打印商品信息
|
* 易联云打印商品信息
|
||||||
*
|
*
|
||||||
* @param orderId 订单id
|
* @param orderId 订单id
|
||||||
* @param isAuto 是否自动打印
|
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void YlyPrint(String orderId, boolean isAuto) {
|
public void print(String orderId) {
|
||||||
if (ylyUtil.checkYlyPrintStatus()) {
|
// if (ylyUtil.checkYlyPrintStatus()) {
|
||||||
throw new CrmebException("易联云 未开启打印");
|
// throw new CrmebException("易联云 未开启打印");
|
||||||
}
|
// }
|
||||||
// 判断是否开启自动打印
|
// // 判断是否开启自动打印
|
||||||
if (isAuto && ylyUtil.checkYlyPrintAfterPaySuccess()) {
|
// if (isAuto && ylyUtil.checkYlyPrintAfterPaySuccess()) {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
StoreOrder exitOrder = storeOrderService.getByOderId(orderId);
|
StoreOrder exitOrder = storeOrderService.getByOderId(orderId);
|
||||||
if (ObjectUtil.isNull(exitOrder)) {
|
if (ObjectUtil.isNull(exitOrder)) {
|
||||||
throw new CrmebException("易联云 打印时未找到 订单信息");
|
throw new CrmebException("易联云 打印时未找到 订单信息");
|
@ -3,6 +3,7 @@ package com.zbkj.service.util;
|
|||||||
|
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.zbkj.common.constants.Constants;
|
||||||
import com.zbkj.common.constants.YlyConstants;
|
import com.zbkj.common.constants.YlyConstants;
|
||||||
import com.zbkj.common.exception.CrmebException;
|
import com.zbkj.common.exception.CrmebException;
|
||||||
import com.zbkj.common.request.YlyPrintRequest;
|
import com.zbkj.common.request.YlyPrintRequest;
|
||||||
@ -63,7 +64,7 @@ public class YlyUtil {
|
|||||||
client_secret = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_SECRET);
|
client_secret = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_SECRET);
|
||||||
machine_code = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_MACHINE_CODE);
|
machine_code = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_MACHINE_CODE);
|
||||||
msign = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_MACHINE_MSIGN);
|
msign = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_APP_MACHINE_MSIGN);
|
||||||
status = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_STATUS);
|
status = systemConfigService.getValueByKey(Constants.PRINT_STATUS);
|
||||||
if(StringUtils.isBlank(client_id) || StringUtils.isBlank(client_secret)
|
if(StringUtils.isBlank(client_id) || StringUtils.isBlank(client_secret)
|
||||||
|| StringUtils.isBlank(machine_code) || StringUtils.isBlank(msign)){
|
|| StringUtils.isBlank(machine_code) || StringUtils.isBlank(msign)){
|
||||||
throw new CrmebException("易联云配置数据不完整");
|
throw new CrmebException("易联云配置数据不完整");
|
||||||
@ -180,7 +181,7 @@ public class YlyUtil {
|
|||||||
* 付款成后打印易联云订单
|
* 付款成后打印易联云订单
|
||||||
*/
|
*/
|
||||||
public boolean checkYlyPrintAfterPaySuccess(){
|
public boolean checkYlyPrintAfterPaySuccess(){
|
||||||
String printAuto = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_AUTO_STATUS);
|
String printAuto = systemConfigService.getValueByKey(Constants.PRINT_AUTO_STATUS);
|
||||||
return !StringUtils.isBlank(printAuto) && "'0'".equals(printAuto);
|
return !StringUtils.isBlank(printAuto) && "'0'".equals(printAuto);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -188,7 +189,7 @@ public class YlyUtil {
|
|||||||
* 检查是否开启打印
|
* 检查是否开启打印
|
||||||
*/
|
*/
|
||||||
public boolean checkYlyPrintStatus(){
|
public boolean checkYlyPrintStatus(){
|
||||||
String printAuto = systemConfigService.getValueByKey(YlyConstants.YLY_PRINT_STATUS);
|
String printAuto = systemConfigService.getValueByKey(Constants.PRINT_STATUS);
|
||||||
return !StringUtils.isBlank(printAuto) && "'0'".equals(printAuto);
|
return !StringUtils.isBlank(printAuto) && "'0'".equals(printAuto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -0,0 +1,38 @@
|
|||||||
|
package com.zbkj.service.util.jiab;
|
||||||
|
|
||||||
|
import com.sun.jna.Library;
|
||||||
|
import com.sun.jna.Native;
|
||||||
|
|
||||||
|
public interface JiabUtil extends Library {
|
||||||
|
|
||||||
|
JiabUtil INSTANCE = (JiabUtil) Native.loadLibrary("TSCLIB", JiabUtil.class);
|
||||||
|
|
||||||
|
int about();
|
||||||
|
|
||||||
|
int openport(String pirnterName);
|
||||||
|
|
||||||
|
int closeport();
|
||||||
|
|
||||||
|
int sendcommand(String printerCommand);
|
||||||
|
|
||||||
|
int setup(String width, String height, String speed, String density, String sensor, String vertical, String offset);
|
||||||
|
|
||||||
|
int downloadpcx(String filename, String image_name);
|
||||||
|
|
||||||
|
int barcode(String x, String y, String type, String height, String readable, String rotation, String narrow,
|
||||||
|
String wide, String code);
|
||||||
|
|
||||||
|
int printerfont(String x, String y, String fonttype, String rotation, String xmul, String ymul, String text);
|
||||||
|
|
||||||
|
int clearbuffer();
|
||||||
|
|
||||||
|
int printlabel(String set, String copy);
|
||||||
|
|
||||||
|
int formfeed();
|
||||||
|
|
||||||
|
int nobackfeed();
|
||||||
|
|
||||||
|
int windowsfont(int x, int y, int fontheight, int rotation, int fontstyle, int fontunderline, String szFaceName,
|
||||||
|
String content);
|
||||||
|
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user