|
@@ -18,11 +18,15 @@ import thyyxxk.webserver.entity.ca.CaData;
|
|
|
import thyyxxk.webserver.entity.ca.CaReturn;
|
|
|
import thyyxxk.webserver.entity.ca.CaSendParams;
|
|
|
import thyyxxk.webserver.entity.ca.CaSingBizSnReturnData;
|
|
|
+import thyyxxk.webserver.entity.login.UserInfo;
|
|
|
+import thyyxxk.webserver.service.redislike.RedisLikeService;
|
|
|
import thyyxxk.webserver.utils.ResultVoUtil;
|
|
|
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@Service
|
|
@@ -30,9 +34,11 @@ public class CaServer {
|
|
|
|
|
|
private final CaData caData;
|
|
|
private final String SUCCRSS = "success";
|
|
|
+ private final RedisLikeService redisLikeService;
|
|
|
|
|
|
- public CaServer(CaData caData) {
|
|
|
+ public CaServer(CaData caData, RedisLikeService redisLikeService) {
|
|
|
this.caData = caData;
|
|
|
+ this.redisLikeService = redisLikeService;
|
|
|
}
|
|
|
|
|
|
@EqualsAndHashCode(callSuper = true)
|
|
@@ -41,16 +47,28 @@ public class CaServer {
|
|
|
private String id;
|
|
|
private String msg;
|
|
|
private String desc;
|
|
|
+ private Integer count = 1;
|
|
|
}
|
|
|
|
|
|
- public ResultVo<CaReturn.CaData> sendByCode(Send send) {
|
|
|
- // {"ret":"success","msg":"success","data":{"isTrust":1}} 如果没有开免密就这样
|
|
|
+ public List<CaReturn.CaData> sendBatchByCode(Send send) {
|
|
|
+ List<CaReturn.CaData> returnValue = new ArrayList<>();
|
|
|
+ for (int i = 0; i < send.getCount(); i++) {
|
|
|
+ returnValue.add(sendByCode(send));
|
|
|
+ }
|
|
|
+ return returnValue;
|
|
|
+ }
|
|
|
+
|
|
|
+ public CaReturn.CaData sendByCode(Send send) {
|
|
|
+ UserInfo userInfoByCode = redisLikeService.getUserInfoByCode(send.getId());
|
|
|
send.setBizSn(IdUtil.simpleUUID());
|
|
|
CaReturn push = push(send);
|
|
|
signatureAuthentication(send, push);
|
|
|
String timeStamp = generateTimestampByInData(send);
|
|
|
push.getData().setTimeStamp(timeStamp);
|
|
|
- return ResultVoUtil.success(push.getData());
|
|
|
+ push.getData().setBizSn(send.getBizSn());
|
|
|
+ push.getData().setSignature("http://172.16.32.167:8077/doctorSignatureImage/" + send.getId() + ".png");
|
|
|
+ push.getData().setName(userInfoByCode.getName());
|
|
|
+ return push.getData();
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -67,6 +85,7 @@ public class CaServer {
|
|
|
send.setAppId(app.getAppId());
|
|
|
send.setMsg(CaUtils.GetSHA256FormString(send.getMsg()));
|
|
|
send.setMsgWrapper("0");
|
|
|
+ send.setUrl(URLEncoder.encode("http://127.0.0.1/", "UTF-8"));
|
|
|
send.setMode("redirect");
|
|
|
send.setSign(CaUtils.getSign(app.getPrivatekey(), send.getMsg()));
|
|
|
String execute = post.addBody(send).execute(String.class);
|
|
@@ -89,6 +108,12 @@ public class CaServer {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 认证签名
|
|
|
+ *
|
|
|
+ * @param send
|
|
|
+ * @param caReturn
|
|
|
+ */
|
|
|
private void signatureAuthentication(Send send, CaReturn caReturn) {
|
|
|
CaData.SignAuthentication signData = caData.getSignAuthentication();
|
|
|
CaWSDL caWSDL = new CaWSDL(signData.getUrl());
|
|
@@ -124,6 +149,12 @@ public class CaServer {
|
|
|
.replace("${SignData}", caReturn.getData().getSignValue());
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 认证时间戳并返回
|
|
|
+ *
|
|
|
+ * @param send 数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
private String generateTimestampByInData(Send send) {
|
|
|
String data = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
|
|
|
"<Root>\n" +
|