|
@@ -2,6 +2,7 @@ package com.zskk.control;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
import com.jfinal.core.Controller;
|
|
|
+import com.jfinal.kit.HashKit;
|
|
|
import com.jfinal.kit.PropKit;
|
|
|
import com.jfinal.plugin.activerecord.ActiveRecordPlugin;
|
|
|
import com.jfinal.plugin.activerecord.Db;
|
|
@@ -68,7 +69,7 @@ public class ViewController extends Controller {
|
|
|
}
|
|
|
public void testTask() {
|
|
|
try {
|
|
|
- String string = "";
|
|
|
+ String string = "here";
|
|
|
List<Exams> exams = Exams.dao.use("zskk").find("SELECT * FROM pacsonline.exams where exam_status=3 and institution_id=15700002 order by createdAt desc limit 30");
|
|
|
for (Exams exams2 : exams) {
|
|
|
//Studies studies = Studies.dao.use("zskk").findById(exams2.getStudyId());
|
|
@@ -153,7 +154,7 @@ public class ViewController extends Controller {
|
|
|
//时间戳
|
|
|
params.put("timestamp", String.valueOf(getSecondTimestamp(new Date())));
|
|
|
//signature
|
|
|
- params.put("signature", getSign(data, "YgpxjVeIx0yoK6Atz413IAj7hU9dygH4"));
|
|
|
+ params.put("signature", Ksort(data));
|
|
|
//datajson字符串
|
|
|
params.put("data", JSON.toJSONString(data));
|
|
|
//System.out.println(params);
|
|
@@ -288,26 +289,30 @@ public class ViewController extends Controller {
|
|
|
}
|
|
|
|
|
|
|
|
|
- public static String Ksort(Map<String, String> map) {
|
|
|
- String sb = "";
|
|
|
- String[] key = new String[map.size()];
|
|
|
- int index = 0;
|
|
|
- for (String k : map.keySet()) {
|
|
|
- key[index] = k;
|
|
|
- index++;
|
|
|
- }
|
|
|
- Arrays.sort(key);
|
|
|
- for (String s : key) {
|
|
|
- sb += s + "=" + map.get(s) + "&";
|
|
|
- }
|
|
|
- sb = sb.substring(0, sb.length() - 1);
|
|
|
- try {
|
|
|
- sb = URLEncoder.encode(sb, "UTF-8");
|
|
|
- } catch (UnsupportedEncodingException e) {
|
|
|
- e.printStackTrace();
|
|
|
- }// 使用常见的UTF-8编码
|
|
|
- return sb.replace("%3D", "=").replace("%26", "&");
|
|
|
- }
|
|
|
+ public static String Ksort(Map<String, String> map){
|
|
|
+ String sb = "";
|
|
|
+ String[] key = new String[map.size()];
|
|
|
+ int index = 0;
|
|
|
+ for (String k : map.keySet()) {
|
|
|
+ key[index] = k;
|
|
|
+ index++;
|
|
|
+ }
|
|
|
+ Arrays.sort(key);
|
|
|
+ for (String s : key) {
|
|
|
+ sb += s + "=" + map.get(s) + "&";
|
|
|
+ }
|
|
|
+ sb = sb.substring(0, sb.length() - 1);
|
|
|
+ try {
|
|
|
+ sb = URLEncoder.encode(sb, "UTF-8");
|
|
|
+ } catch (UnsupportedEncodingException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }// 使用常见的UTF-8编码
|
|
|
+ sb = sb.replace("%3D", "=").replace("%26", "&");
|
|
|
+
|
|
|
+// System.out.println(sb);
|
|
|
+ String resultString = HashKit.md5(sb+"YgpxjVeIx0yoK6Atz413IAj7hU9dygH4");
|
|
|
+ return resultString;
|
|
|
+ }
|
|
|
|
|
|
public String returnSecondTimestamp(String data) throws ParseException {
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|