密码键盘、扫描仪-- 待测试
This commit is contained in:
parent
5a84be620d
commit
63a9070f56
|
@ -16,4 +16,12 @@ public interface LexMarkConst {
|
|||
* 打印机
|
||||
*/
|
||||
String RECEIPT_PRINTER = "ReceiptPrinter";
|
||||
/**
|
||||
* 数字键盘
|
||||
*/
|
||||
String ENCRYPTOR = "Encryptor";
|
||||
/**
|
||||
* 扫描仪
|
||||
*/
|
||||
String BARCODE_READER = "BarcodeReader";
|
||||
}
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
package com.dpkj.modules.readcard.constant;
|
||||
package com.dpkj.common.constant;
|
||||
|
||||
/**
|
||||
* 读卡模块 方法名
|
||||
* 利盟台式机 中间件 方法名常量
|
||||
*/
|
||||
public interface ReadCardConst {
|
||||
public interface MiddlewareFunctionsConst {
|
||||
|
||||
/**-------------------- 公共模块 ---------------------*/
|
||||
/**
|
||||
* 打开设备(异步)/ (同步)
|
||||
*/
|
||||
|
@ -17,6 +18,8 @@ public interface ReadCardConst {
|
|||
String CLOSE_CONNECTION = "CloseConnection";
|
||||
String CLOSE_CONNECTION_SYNC = "CloseConnectionSync";
|
||||
|
||||
|
||||
/** ------------------- 读卡模块 --------------------*/
|
||||
/**
|
||||
* 进卡读卡(异步)/ (同步)
|
||||
*/
|
||||
|
@ -71,4 +74,46 @@ public interface ReadCardConst {
|
|||
String I_READ_CARD_BAS_HSM_STEP2 = "iReadCardBas_HSM_Step2";
|
||||
|
||||
|
||||
/** -------------------- 数字键盘模块 -----------------*/
|
||||
/**
|
||||
* 明文输入
|
||||
*/
|
||||
String INPUT_DATA = "InputData";
|
||||
|
||||
/**
|
||||
* 密文输入
|
||||
*/
|
||||
String INPUT_PIN = "InputPIN";
|
||||
|
||||
/**
|
||||
* 取消输入 (明文或者密文)
|
||||
*/
|
||||
String CANCEL_INPUT = "CancelInput";
|
||||
|
||||
/** ------------------ 条码读取模块 -------------------*/
|
||||
/**
|
||||
* 复位扫描仪
|
||||
*/
|
||||
String RESET = "Reset";
|
||||
|
||||
/**
|
||||
* 扫描条码
|
||||
*/
|
||||
String SCAN_BARCODE = "ScanBarcode";
|
||||
|
||||
/**
|
||||
* 取消扫描
|
||||
*/
|
||||
String CANCEL_SCAN = "CancelScan";
|
||||
|
||||
/**
|
||||
* 获取扫描仪状态
|
||||
*/
|
||||
String GET_SCANNER_STATUS = "GetStatus";
|
||||
|
||||
/**
|
||||
* 获取能力
|
||||
*/
|
||||
String GET_SCANNER_CAPABILITIES = "GetCapabilities";
|
||||
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
package com.dpkj.modules.barcode.controller;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.barcode.service.BarCodeService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @BelongsProject: 银医通-澜沧中医院-DLL-台式机
|
||||
* @BelongsPackage: com.dpkj.modules.keypad.controller
|
||||
* @Author: wzc
|
||||
* @Description: 条码读取
|
||||
* @CreateTime: 2025-02-10 15:21
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("barcode")
|
||||
public class BarCodeController {
|
||||
|
||||
@Autowired
|
||||
private BarCodeService barcodeService;
|
||||
|
||||
/**
|
||||
* 条码扫描
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("scanBarcode")
|
||||
public Result scanBarcode() {
|
||||
return barcodeService.scanBarcode();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
package com.dpkj.modules.barcode.service;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
|
||||
public interface BarCodeService {
|
||||
|
||||
Result scanBarcode();
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
package com.dpkj.modules.barcode.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.constant.LexMarkConst;
|
||||
import com.dpkj.common.constant.MiddlewareFunctionsConst;
|
||||
import com.dpkj.common.dto.LexMarkDTO;
|
||||
import com.dpkj.common.utils.ThirdServiceUtil;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.barcode.service.BarCodeService;
|
||||
import com.dpkj.modules.readcard.vo.IDCardReadResultVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @BelongsProject: 银医通-澜沧中医院-DLL-台式机
|
||||
* @BelongsPackage: com.dpkj.modules.keypad.service.impl
|
||||
* @Author: wzc
|
||||
* @Description:
|
||||
* @CreateTime: 2025-02-10 15:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class BarCodeServiceImpl implements BarCodeService {
|
||||
|
||||
@Autowired
|
||||
private ThirdServiceUtil thirdServiceUtil;
|
||||
|
||||
@Override
|
||||
public Result scanBarcode() {
|
||||
// 连接扫描仪
|
||||
LexMarkDTO connect = new LexMarkDTO();
|
||||
connect.setDevName(LexMarkConst.BARCODE_READER);
|
||||
connect.setActionName(MiddlewareFunctionsConst.OPEN_CONNECTION);
|
||||
connect.setCallID(1000);
|
||||
JSONObject connectParam = new JSONObject();
|
||||
connectParam.put("TimeOut", 90000);
|
||||
connectParam.put("ServiceName", LexMarkConst.BARCODE_READER);
|
||||
connect.setParam(connectParam.toJSONString());
|
||||
IDCardReadResultVO connectResult = thirdServiceUtil.callDevice(connect, IDCardReadResultVO.class);
|
||||
if (connectResult.getResult() == 0) {
|
||||
// 扫描条码
|
||||
LexMarkDTO scanBarcode = new LexMarkDTO();
|
||||
scanBarcode.setDevName(LexMarkConst.BARCODE_READER);
|
||||
scanBarcode.setActionName(MiddlewareFunctionsConst.SCAN_BARCODE);
|
||||
scanBarcode.setCallID(1000);
|
||||
JSONObject scanBarcodeParam = new JSONObject();
|
||||
scanBarcodeParam.put("BarcodeDataMode", 0);
|
||||
scanBarcodeParam.put("TimeOut", 0);
|
||||
scanBarcode.setParam(scanBarcodeParam.toJSONString());
|
||||
IDCardReadResultVO scanBarcodeResult = thirdServiceUtil.callDevice(scanBarcode, IDCardReadResultVO.class);
|
||||
if (scanBarcodeResult.getResult() == 0) {
|
||||
return Result.ok(scanBarcodeResult);
|
||||
} else {
|
||||
return Result.error("扫描异常!详情:" + connectResult.getDesc());
|
||||
}
|
||||
} else {
|
||||
return Result.error("扫描仪设备连接失败!详情:" + connectResult.getDesc());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
package com.dpkj.modules.keypad.controller;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.keypad.service.KeypadService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* @BelongsProject: 银医通-澜沧中医院-DLL-台式机
|
||||
* @BelongsPackage: com.dpkj.modules.keypad.controller
|
||||
* @Author: wzc
|
||||
* @Description: 数字键盘
|
||||
* @CreateTime: 2025-02-10 15:21
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("keypad")
|
||||
public class KeypadController {
|
||||
|
||||
@Autowired
|
||||
private KeypadService keypadService;
|
||||
/**
|
||||
* 数字键盘 明文输入
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("inputData")
|
||||
public Result inputData() {
|
||||
return keypadService.inputData();
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消输入 (明文或者密文)
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("cancelInput")
|
||||
public Result CancelInput() {
|
||||
return keypadService.cancelInput();
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
package com.dpkj.modules.keypad.service;
|
||||
|
||||
import com.dpkj.common.vo.Result;
|
||||
|
||||
public interface KeypadService {
|
||||
Result inputData();
|
||||
|
||||
Result cancelInput();
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package com.dpkj.modules.keypad.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.constant.LexMarkConst;
|
||||
import com.dpkj.common.constant.MiddlewareFunctionsConst;
|
||||
import com.dpkj.common.dto.LexMarkDTO;
|
||||
import com.dpkj.common.utils.ThirdServiceUtil;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.keypad.service.KeypadService;
|
||||
import com.dpkj.modules.readcard.vo.IDCardReadResultVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* @BelongsProject: 银医通-澜沧中医院-DLL-台式机
|
||||
* @BelongsPackage: com.dpkj.modules.keypad.service.impl
|
||||
* @Author: wzc
|
||||
* @Description:
|
||||
* @CreateTime: 2025-02-10 15:20
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class KeypadServiceImpl implements KeypadService {
|
||||
|
||||
@Autowired
|
||||
private ThirdServiceUtil thirdServiceUtil;
|
||||
|
||||
/**
|
||||
* 数字键盘 明文输入
|
||||
* 1. 连接数字键盘
|
||||
* 2. 明文输入
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result inputData() {
|
||||
// 连接数字键盘
|
||||
LexMarkDTO connect = new LexMarkDTO();
|
||||
connect.setDevName(LexMarkConst.ENCRYPTOR);
|
||||
connect.setActionName(MiddlewareFunctionsConst.OPEN_CONNECTION);
|
||||
connect.setCallID(1000);
|
||||
JSONObject connectParam = new JSONObject();
|
||||
connectParam.put("TimeOut", 90000);
|
||||
connectParam.put("ServiceName", LexMarkConst.ENCRYPTOR);
|
||||
connect.setParam(connectParam.toJSONString());
|
||||
IDCardReadResultVO connectResult = thirdServiceUtil.callDevice(connect, IDCardReadResultVO.class);
|
||||
if (connectResult.getResult() == 0) {
|
||||
// 明文输入
|
||||
LexMarkDTO plaintext = new LexMarkDTO();
|
||||
plaintext.setDevName(LexMarkConst.ENCRYPTOR);
|
||||
plaintext.setActionName(MiddlewareFunctionsConst.INPUT_DATA);
|
||||
plaintext.setCallID(1000);
|
||||
JSONObject plaintextParam = new JSONObject();
|
||||
// 密码最小长度
|
||||
plaintextParam.put("MINLength", 0);
|
||||
// 密码最大长度
|
||||
plaintextParam.put("MAXLength", 6);
|
||||
// 是否自动结束
|
||||
plaintextParam.put("bAutoEnd", 1);
|
||||
// 超时时间
|
||||
plaintextParam.put("TimeOut", 30000);
|
||||
plaintext.setParam(plaintextParam.toJSONString());
|
||||
IDCardReadResultVO plaintextResult = thirdServiceUtil.callDevice(plaintext, IDCardReadResultVO.class);
|
||||
if (plaintextResult.getResult() == 0) {
|
||||
|
||||
return null;
|
||||
} else {
|
||||
return Result.error("密码输入异常!详情:" + connectResult.getDesc());
|
||||
}
|
||||
} else {
|
||||
return Result.error("数字键盘设备连接失败!详情:" + connectResult.getDesc());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消输入 (明文或者密文)
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Result cancelInput() {
|
||||
LexMarkDTO cancelInput = new LexMarkDTO();
|
||||
cancelInput.setDevName(LexMarkConst.ENCRYPTOR);
|
||||
cancelInput.setActionName(MiddlewareFunctionsConst.CANCEL_INPUT);
|
||||
cancelInput.setCallID(1000);
|
||||
cancelInput.setParam("{\"\"}");
|
||||
IDCardReadResultVO connectResult = thirdServiceUtil.callDevice(cancelInput, IDCardReadResultVO.class);
|
||||
if (connectResult.getResult() == 0) {
|
||||
return Result.ok("取消输入 (明文或者密文)完成!");
|
||||
} else {
|
||||
return Result.error("取消输入 (明文或者密文)异常!详情:" + connectResult.getDesc());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -3,11 +3,11 @@ package com.dpkj.modules.readcard.service.impl;
|
|||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.dpkj.common.constant.LexMarkConst;
|
||||
import com.dpkj.common.constant.MiddlewareFunctionsConst;
|
||||
import com.dpkj.common.dto.LexMarkDTO;
|
||||
import com.dpkj.common.utils.ThirdService;
|
||||
import com.dpkj.common.utils.ThirdServiceUtil;
|
||||
import com.dpkj.common.vo.Result;
|
||||
import com.dpkj.modules.readcard.constant.ReadCardConst;
|
||||
import com.dpkj.modules.readcard.service.ReadCardService;
|
||||
import com.dpkj.modules.readcard.vo.IDCardReadResultVO;
|
||||
import com.dpkj.modules.readcard.vo.SocialSecurityCardInfoVO;
|
||||
|
@ -49,7 +49,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
try {
|
||||
// 连接非接身份证读卡模块
|
||||
LexMarkDTO connect = new LexMarkDTO();
|
||||
connect.setActionName(ReadCardConst.OPEN_CONNECTION);
|
||||
connect.setActionName(MiddlewareFunctionsConst.OPEN_CONNECTION);
|
||||
connect.setCallID(19256);
|
||||
connect.setDevName(LexMarkConst.ID_CARD_READ);
|
||||
JSONObject connectParam = new JSONObject();
|
||||
|
@ -60,7 +60,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
if (connectResult.getResult() == 0) {
|
||||
// 身份证读取
|
||||
LexMarkDTO read = new LexMarkDTO();
|
||||
read.setActionName(ReadCardConst.ACCEPT_AND_READ_TRACKS);
|
||||
read.setActionName(MiddlewareFunctionsConst.ACCEPT_AND_READ_TRACKS);
|
||||
read.setCallID(19256);
|
||||
read.setDevName(LexMarkConst.ID_CARD_READ);
|
||||
JSONObject readParam = new JSONObject();
|
||||
|
@ -106,7 +106,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
LexMarkDTO close = new LexMarkDTO();
|
||||
close.setDevName(LexMarkConst.ID_CARD_READ);
|
||||
close.setCallID(0);
|
||||
close.setActionName(ReadCardConst.CLOSE_CONNECTION);
|
||||
close.setActionName(MiddlewareFunctionsConst.CLOSE_CONNECTION);
|
||||
IDCardReadResultVO closeResult = thirdServiceUtil.callDevice(close, IDCardReadResultVO.class);
|
||||
if (closeResult.getResult() != 0) {
|
||||
log.info("身份证读卡设备关闭异常!");
|
||||
|
@ -130,7 +130,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
public Result SocialSecurityCardReader() {
|
||||
// 社保卡读卡设备连接
|
||||
LexMarkDTO connect = new LexMarkDTO();
|
||||
connect.setActionName(ReadCardConst.OPEN_CONNECTION);
|
||||
connect.setActionName(MiddlewareFunctionsConst.OPEN_CONNECTION);
|
||||
connect.setCallID(19256);
|
||||
connect.setDevName(LexMarkConst.CARD_READER);
|
||||
JSONObject connectParam = new JSONObject();
|
||||
|
@ -141,7 +141,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
if (connectResult.getResult() == 0) {
|
||||
// 进卡
|
||||
LexMarkDTO enterTheCard = new LexMarkDTO();
|
||||
enterTheCard.setActionName(ReadCardConst.ACCEPT_AND_READ_TRACKS);
|
||||
enterTheCard.setActionName(MiddlewareFunctionsConst.ACCEPT_AND_READ_TRACKS);
|
||||
enterTheCard.setCallID(19256);
|
||||
enterTheCard.setDevName(LexMarkConst.CARD_READER);
|
||||
JSONObject enterTheCardParam = new JSONObject();
|
||||
|
@ -153,7 +153,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
if (enterTheCardResult.getResult() == 0) {
|
||||
// 上电
|
||||
LexMarkDTO powerOn = new LexMarkDTO();
|
||||
powerOn.setActionName(ReadCardConst.CHIPPOWER);
|
||||
powerOn.setActionName(MiddlewareFunctionsConst.CHIPPOWER);
|
||||
powerOn.setCallID(19256);
|
||||
powerOn.setDevName(LexMarkConst.CARD_READER);
|
||||
JSONObject powerOnParam = new JSONObject();
|
||||
|
@ -164,7 +164,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
if (powerOnResult.getResult() == 0) {
|
||||
// 社保卡信息读取
|
||||
LexMarkDTO socialSecurityCardReader = new LexMarkDTO();
|
||||
socialSecurityCardReader.setActionName(ReadCardConst.I_READ_CARD_BAS);
|
||||
socialSecurityCardReader.setActionName(MiddlewareFunctionsConst.I_READ_CARD_BAS);
|
||||
socialSecurityCardReader.setCallID(19256);
|
||||
socialSecurityCardReader.setDevName(LexMarkConst.CARD_READER);
|
||||
JSONObject socialSecurityCardReaderParam = new JSONObject();
|
||||
|
@ -214,7 +214,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
LexMarkDTO cardRefund = new LexMarkDTO();
|
||||
cardRefund.setDevName(LexMarkConst.CARD_READER);
|
||||
cardRefund.setCallID(19256);
|
||||
cardRefund.setActionName(ReadCardConst.EJECT);
|
||||
cardRefund.setActionName(MiddlewareFunctionsConst.EJECT);
|
||||
JSONObject cardRefundParam = new JSONObject();
|
||||
cardRefundParam.put("position", 1);
|
||||
cardRefundParam.put("ejectpos", 1);
|
||||
|
@ -225,7 +225,7 @@ public class ReadCardServiceImpl implements ReadCardService {
|
|||
LexMarkDTO close = new LexMarkDTO();
|
||||
close.setDevName(LexMarkConst.CARD_READER);
|
||||
close.setCallID(0);
|
||||
close.setActionName(ReadCardConst.CLOSE_CONNECTION);
|
||||
close.setActionName(MiddlewareFunctionsConst.CLOSE_CONNECTION);
|
||||
IDCardReadResultVO closeResult = thirdServiceUtil.callDevice(close, IDCardReadResultVO.class);
|
||||
if (closeResult.getResult() != 0) {
|
||||
log.info("社保卡读卡设备关闭异常!");
|
||||
|
|
Loading…
Reference in New Issue