对接接口方法:1.获取token2.更新案件状态3.上传文件4.推送案件附件信息
This commit is contained in:
@@ -0,0 +1,69 @@
|
||||
package com.ruoyi.web.controller.tool;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import com.ruoyi.common.annotation.Anonymous;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.enums.PushCaseStatusEnum;
|
||||
import com.ruoyi.system.service.impl.BeiMingInterfaceService;
|
||||
import com.ruoyi.wisdomarbitrate.domain.vo.mscase.MsCaseStatusInfo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import static com.ruoyi.common.utils.EncryptUtils.sm4Decrypt;
|
||||
import static com.ruoyi.common.utils.EncryptUtils.sm4Encrypt;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/beiming/api")
|
||||
public class TestApiController {
|
||||
@Autowired
|
||||
BeiMingInterfaceService beiMingInterfaceService;
|
||||
@Value("${beimingprivatekey}")
|
||||
public String privateKey;
|
||||
|
||||
@GetMapping("/test")
|
||||
@Anonymous
|
||||
public AjaxResult selectCaseFlow() {
|
||||
String token = beiMingInterfaceService.getApiToken("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", System.currentTimeMillis());
|
||||
// token = "f910e1441fc56e49d3f31396e8d9aa04228045815ee986a9587d7a5cb7312f9d11c7f80041745f38ec686ea1f819c8b8227f9c03196c6dd004f89215c4805c24355be4b57abeddb7b9d2cbda45fae74c49f4a83fb6496d84302ca8c07245786d682ecb68aed966fcbda3188b9c4d4376089471bb5aee371a62073b0ce15d72dccd6fbc8fd13957e2fb7aa018cb5937938bfc9773e570ac06ac633617cea8405759cf609c832074aaa03f972c0a6a93cde531da0d91d07770c037fdea1368ee5772941ba2a55ef155979d1ed8222faad92ed342530ef04f3746aa96499dee6ea4869ce46bd0dcfe7a69e7db49eb2aec388c47824c201b49825f24ffe82dde41b5";
|
||||
System.out.println("toke:" + token);
|
||||
//解密
|
||||
if (token != null && !token.isEmpty()) {
|
||||
JSONObject jsonObject = JSON.parseObject(token);
|
||||
String tokenString = jsonObject.getString("data");
|
||||
System.out.println("data信息:" + tokenString);
|
||||
String tokenstr = sm4Decrypt(tokenString, privateKey);
|
||||
System.out.println("解密后的字符串:" + tokenstr);
|
||||
if (tokenstr != null && !tokenstr.isEmpty()) {
|
||||
JSONObject tokenObject = JSON.parseObject(tokenstr);
|
||||
String resultToken = tokenObject.getString("token");
|
||||
MsCaseStatusInfo info = MsCaseStatusInfo.builder().caseNo("zc2024032700012").statusCode(PushCaseStatusEnum.MEDIATE.getCode()).caseClosureExplanation(PushCaseStatusEnum.MEDIATE.getName()).build();
|
||||
JSONObject result = beiMingInterfaceService.submitCaseStatusInfo(resultToken, "zc2024032700012", "BWT_MEDIATION", info);
|
||||
System.out.println("jieguo:" + result.toString());
|
||||
if (result != null) {
|
||||
String data = result.getString("data");
|
||||
String datastr = sm4Decrypt(data, privateKey);
|
||||
System.out.println("最终解密后的字符串:" + datastr);
|
||||
}
|
||||
}
|
||||
}
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@GetMapping("/testfile")
|
||||
@Anonymous
|
||||
public AjaxResult testfile() {
|
||||
// File file = new File("D:/WorkDoc/TJ/File/证据1.png");
|
||||
File file = new File("D:/WorkDoc/TJ/File/证据3.png");
|
||||
JSONObject jsonObject1 = beiMingInterfaceService.pushAttachmentInfo("BWT_MEDIATION", "86251b190e3a40f3942v215d1762c663", file, "123abc", "BWT_MEDIATION", "zc2024032700012");
|
||||
System.out.println("fanhui:" + jsonObject1.toString());
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user