Browse Source

优化推送现实效果

刘韬 6 years ago
parent
commit
4c000d8808

+ 35 - 15
PacsOnline_Wechat_Patient/src/main/java/com/zskk/service/WeixinService.java

@@ -1,9 +1,9 @@
 package com.zskk.service;
 
 import java.io.UnsupportedEncodingException;
-import java.net.URI;
-import java.net.URISyntaxException;
+import java.net.URLDecoder;
 import java.net.URLEncoder;
+import java.text.DecimalFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.UUID;
@@ -143,8 +143,18 @@ public class WeixinService {
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
+			String name_utf8 = null;
+			try {
+				name_utf8 = URLDecoder.decode(name, "UTF-8");
+			} catch (UnsupportedEncodingException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 			String total_fee = contentJson.getString("total_fee");
-			apiResult = sendRemoteDiagnosisPatientPayMsg(openid, urlString, out_trade_no, name, total_fee);
+			Double total_fee_double_value =  Double.valueOf(total_fee);
+            DecimalFormat df = new DecimalFormat("######0.00");
+            String total_fee_to_yuan = df.format(total_fee_double_value);
+			apiResult = sendRemoteDiagnosisPatientPayMsg(openid, urlString, out_trade_no, name_utf8, total_fee_to_yuan);
 		}
 			break;
 			
@@ -154,8 +164,15 @@ public class WeixinService {
 			JSONObject contentJson = JSON.parseObject(content);
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
+			String name_utf8 = null;
+			try {
+				name_utf8 = URLDecoder.decode(name, "UTF-8");
+			} catch (UnsupportedEncodingException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
 			String total_fee = contentJson.getString("total_fee");
-			apiResult = sendRemoteDiagnosisFinishMsg(openid, urlString,name);
+			apiResult = sendRemoteDiagnosisFinishMsg(openid, urlString, name_utf8);
 		}
 			break;
 			
@@ -177,7 +194,10 @@ public class WeixinService {
 			String out_trade_no = contentJson.getString("out_trade_no");
 			String name = contentJson.getString("name");
 			String total_fee = contentJson.getString("total_fee");
-			apiResult = sendRemoteDiagnosisRefundMsg(openid, urlString, out_trade_no, total_fee);
+			Double total_fee_double_value =  Double.valueOf(total_fee);
+            DecimalFormat df = new DecimalFormat("######0.00");
+            String total_fee_to_yuan = df.format(total_fee_double_value);
+			apiResult = sendRemoteDiagnosisRefundMsg(openid, urlString, out_trade_no, total_fee_to_yuan);
 		}
 			break;
 
@@ -372,17 +392,17 @@ public class WeixinService {
 //		}
 //		PUSH_TYPE dType = PUSH_TYPE.REMOTE_DIAGNOSIS_PATIENT_PAY;
 ////			System.out.println(dType.getPushType());
-		try {
-			URI fUri =new URI("http://www.163.com?a=aw&b-cd");
-			
-			fUri.getQuery();
-			String aString = getParamByUrl("http://www.163.com?a=aw&b-cd", "a");
-			System.out.println(aString);
+//			URI fUri =new URI("http://www.163.com?a=aw&b-cd");
+//			
+//			fUri.getQuery();
+//			String aString = getParamByUrl("http://www.163.com?a=aw&b-cd", "a");
+//			System.out.println(aString);
+			Double ddString =  Double.valueOf("2");
+            DecimalFormat df = new DecimalFormat("######0.00");
+
+
+			 System.out.println(df.format(ddString));
 
-		} catch (URISyntaxException e) {
-			// TODO Auto-generated catch block
-			e.printStackTrace();
-		}
 
 	}
 }