|
@@ -0,0 +1,60 @@
|
|
|
+package com.diagbot.facade;
|
|
|
+
|
|
|
+import com.diagbot.util.AESCipher;
|
|
|
+import com.diagbot.vo.PrecMapVO;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+
|
|
|
+import java.text.ParseException;
|
|
|
+import java.util.HashMap;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author wangfeng
|
|
|
+ * @Description:
|
|
|
+ * @date 2020-05-11 15:08
|
|
|
+ */
|
|
|
+@Component
|
|
|
+public class PrecEncryptFacade {
|
|
|
+ private static final String IV_STRING = "z76rxggpnykxeyb1";
|
|
|
+
|
|
|
+
|
|
|
+ public PrecMapVO getEncryption(PrecMapVO precMapVO) throws ParseException {
|
|
|
+ //patientInfo patientName
|
|
|
+ Map<String,String> map = precMapVO.getMap();
|
|
|
+ Map<String,String> mapNew =new HashMap<String, String>();
|
|
|
+ try {
|
|
|
+ for(String key : map.keySet()){
|
|
|
+ String value = map.get(key);
|
|
|
+ String aesEncrypValue = AESCipher.aesEncryptString(value,IV_STRING);
|
|
|
+ mapNew.put(key,aesEncrypValue);
|
|
|
+ System.out.println(key+" "+aesEncrypValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ PrecMapVO data = new PrecMapVO();
|
|
|
+ data.setMap(mapNew);
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+
|
|
|
+ public PrecMapVO getDecode(PrecMapVO precVO) {
|
|
|
+ //patientInfo patientName
|
|
|
+ Map<String,String> map = precVO.getMap();
|
|
|
+ Map<String,String> mapNew =new HashMap<String, String>();
|
|
|
+ try {
|
|
|
+ for(String key : map.keySet()){
|
|
|
+ String value = map.get(key);
|
|
|
+ String aesEncrypValue = AESCipher.aesDecryptString(value,IV_STRING);
|
|
|
+ mapNew.put(key,aesEncrypValue);
|
|
|
+ System.out.println(key+" "+aesEncrypValue);
|
|
|
+ }
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ PrecMapVO data = new PrecMapVO();
|
|
|
+ data.setMap(mapNew);
|
|
|
+ return data;
|
|
|
+ }
|
|
|
+}
|