38 lines
1.1 KiB
Java
38 lines
1.1 KiB
Java
|
package com.dpkj.modules.cardReader.controller;
|
||
|
|
||
|
import com.dpkj.common.vo.Result;
|
||
|
import com.dpkj.modules.cardReader.service.CardReaderService;
|
||
|
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.RequestParam;
|
||
|
import org.springframework.web.bind.annotation.RestController;
|
||
|
|
||
|
/**
|
||
|
* 多合一读卡器
|
||
|
*/
|
||
|
@Slf4j
|
||
|
@RestController
|
||
|
@RequestMapping("cardReader")
|
||
|
public class CardReaderController {
|
||
|
@Autowired
|
||
|
private CardReaderService cardReaderService;
|
||
|
|
||
|
/**
|
||
|
* 连接设备
|
||
|
* @return
|
||
|
*/
|
||
|
@GetMapping("connectedDevice")
|
||
|
public Result<?> connectedDevice(@RequestParam(name = "devName") String devName) {
|
||
|
try {
|
||
|
return cardReaderService.connectedDevice(devName);
|
||
|
} catch (Exception e) {
|
||
|
e.printStackTrace();
|
||
|
log.info("设备连接失败 {}", e.getMessage());
|
||
|
return Result.error("设备连接失败");
|
||
|
}
|
||
|
}
|
||
|
|
||
|
}
|