Commit 982f803cccfb19fc5dcb8f8a7bca97fde5efc4ed
1 parent
e1339f8de6
Exists in
master
and in
6 other branches
秦皇岛就诊卡
Showing 2 changed files with 15 additions and 5 deletions
platform-operate-api/src/main/java/com/lyms/platform/operate/web/controller/TestController.java
View file @
982f803
| ... | ... | @@ -62,6 +62,7 @@ |
| 62 | 62 | import javax.validation.Valid; |
| 63 | 63 | import java.io.File; |
| 64 | 64 | import java.io.IOException; |
| 65 | +import java.io.UnsupportedEncodingException; | |
| 65 | 66 | import java.net.URLDecoder; |
| 66 | 67 | import java.net.URLEncoder; |
| 67 | 68 | import java.util.*; |
| 68 | 69 | |
| ... | ... | @@ -3334,8 +3335,16 @@ |
| 3334 | 3335 | @ResponseBody |
| 3335 | 3336 | public String getVcCardNoPwd(@RequestParam(required = true) String kid) |
| 3336 | 3337 | { |
| 3338 | + System.out.println("kid=" + kid); | |
| 3337 | 3339 | String pwd = QhdvcCardNoUtils.getKey(kid); |
| 3338 | - return pwd; | |
| 3340 | + try { | |
| 3341 | + String result = new String(pwd.getBytes("utf-8"),"iso8859-1"); | |
| 3342 | + System.out.println("pwd=" + result); | |
| 3343 | + return result; | |
| 3344 | + } catch (UnsupportedEncodingException e) { | |
| 3345 | + e.printStackTrace(); | |
| 3346 | + } | |
| 3347 | + return ""; | |
| 3339 | 3348 | } |
| 3340 | 3349 | |
| 3341 | 3350 | } |
platform-operate-api/src/main/java/com/lyms/platform/operate/web/utils/QhdvcCardNoUtils.java
View file @
982f803
| 1 | 1 | package com.lyms.platform.operate.web.utils; |
| 2 | 2 | |
| 3 | +import com.lyms.platform.common.utils.ExceptionUtils; | |
| 3 | 4 | import com.sun.jna.Library; |
| 4 | 5 | import com.sun.jna.Native; |
| 5 | 6 | |
| ... | ... | @@ -21,8 +22,6 @@ |
| 21 | 22 | ReaderDll instanceDll = (ReaderDll) Native.loadLibrary("QHD_Card", ReaderDll.class); |
| 22 | 23 | //读取卡中基本信息 |
| 23 | 24 | public int getKeyA(String data, int iReaderHandle, byte[] dataInfo); |
| 24 | - //public int getKeyStr_ext(byte[] oErrMsg); | |
| 25 | - //public int getKeyStr(IntByReference iReaderPort, int iReaderHandle, byte[] oErrMsg); | |
| 26 | 25 | } |
| 27 | 26 | |
| 28 | 27 | |
| 29 | 28 | |
| 30 | 29 | |
| ... | ... | @@ -37,13 +36,15 @@ |
| 37 | 36 | kid = covertKey(kid); |
| 38 | 37 | byte[] dataInfo = new byte[50]; |
| 39 | 38 | int areaCode = 100; |
| 40 | - int status = ReaderDll.instanceDll.getKeyA(kid,areaCode,dataInfo); | |
| 39 | + | |
| 41 | 40 | try { |
| 41 | + int status = ReaderDll.instanceDll.getKeyA(kid,areaCode,dataInfo); | |
| 42 | 42 | if (status == 0) |
| 43 | 43 | { |
| 44 | 44 | return new String(dataInfo,"utf-8"); |
| 45 | 45 | } |
| 46 | - } catch (UnsupportedEncodingException e) { | |
| 46 | + } catch (Exception e) { | |
| 47 | + ExceptionUtils.catchException(e,"getKey error"); | |
| 47 | 48 | } |
| 48 | 49 | return null; |
| 49 | 50 | } |