|
|
@ -23,10 +23,17 @@ public class WaterRequestUtil { |
|
|
|
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(WaterRequestUtil.class); |
|
|
|
|
|
|
|
@Value("${water.paasToken}") |
|
|
|
public String paasToken; |
|
|
|
@Value("${water.paasId}") |
|
|
|
public String paasId; |
|
|
|
@Value("${water.tspToken}") |
|
|
|
public String tspToken; |
|
|
|
@Value("${water.tspPaasId}") |
|
|
|
public String tspPaasId; |
|
|
|
|
|
|
|
@Value("${water.tifToken}") |
|
|
|
public String tifToken; |
|
|
|
@Value("${water.tifPaasId}") |
|
|
|
public String tifPaasId; |
|
|
|
|
|
|
|
|
|
|
|
//网关
|
|
|
|
@Value("${water.url}") |
|
|
|
public String url; |
|
|
@ -103,22 +110,24 @@ public class WaterRequestUtil { |
|
|
|
private void setHead(HttpRequest httpRequest,String serviceId,String appsecret){ |
|
|
|
String timestamp = String.valueOf(new Date().getTime()); |
|
|
|
String tifTimestamp = String.valueOf(new Date().getTime() / 1000); |
|
|
|
String xTifPaasid=paasId; |
|
|
|
String nonce = IdUtil.fastSimpleUUID(); |
|
|
|
String signature = tifTimestamp + paasToken + nonce + tifTimestamp; |
|
|
|
String tifSignature = tifTimestamp + tifToken + nonce + tifTimestamp; |
|
|
|
String tspSignature = tifTimestamp + tspToken + nonce + tifTimestamp; |
|
|
|
// System.out.println(signature);
|
|
|
|
try { |
|
|
|
signature = SHACoder.encodeSHA256Hex(signature).toUpperCase(); |
|
|
|
tifSignature = SHACoder.encodeSHA256Hex(tifSignature).toUpperCase(); |
|
|
|
tspSignature = SHACoder.encodeSHA256Hex(tspSignature).toUpperCase(); |
|
|
|
|
|
|
|
} catch (Exception e) { |
|
|
|
e.printStackTrace(); |
|
|
|
} |
|
|
|
httpRequest |
|
|
|
.header("x-tsp-paasid",paasId) |
|
|
|
.header("x-tsp-signature",signature) |
|
|
|
.header("x-tsp-paasid",tspPaasId) |
|
|
|
.header("x-tsp-signature",tspSignature) |
|
|
|
.header("x-tsp-timestamp",tifTimestamp) |
|
|
|
.header("x-tsp-nonce", nonce) |
|
|
|
.header("x-tif-paasid",paasId) |
|
|
|
.header("x-tif-signature",signature) |
|
|
|
.header("x-tif-paasid",tifPaasId) |
|
|
|
.header("x-tif-signature",tifSignature) |
|
|
|
.header("x-tif-timestamp",tifTimestamp) |
|
|
|
.header("x-tif-nonce",nonce) |
|
|
|
.header("x-tsp-serviceid",serviceId) |
|
|
|