|
@@ -23,6 +23,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.Data;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
+import org.apache.commons.lang.RandomStringUtils;
|
|
|
import org.apache.http.HttpResponse;
|
|
|
import org.apache.http.HttpStatus;
|
|
|
import org.apache.http.client.HttpClient;
|
|
@@ -66,7 +67,7 @@ public class FilmController extends BaseController {
|
|
|
*/
|
|
|
@GetMapping(value = "/prepareOrder")
|
|
|
@ApiOperation("微信支付获取预订单id")
|
|
|
- public Response<PrepareOrderEntity> getPrepareOrderId() throws Exception{
|
|
|
+ public Response getPrepareOrderId() throws Exception{
|
|
|
HttpPost httpPost = new HttpPost(wxpayConfig.getV3url());
|
|
|
httpPost.addHeader("Accept", "application/json");
|
|
|
httpPost.addHeader("Content-type","application/json; charset=utf-8");
|
|
@@ -88,8 +89,14 @@ public class FilmController extends BaseController {
|
|
|
httpPost.setEntity(new StringEntity(bos.toString("UTF-8")));
|
|
|
HttpResponse response = httpClient.execute(httpPost);
|
|
|
String bodyAsString = EntityUtils.toString(response.getEntity());
|
|
|
- PrepareOrderEntity prepareOrderEntity = JSON.parseObject(bodyAsString,PrepareOrderEntity.class);
|
|
|
- return Response.success(prepareOrderEntity);
|
|
|
+ JSONObject jsonObject = new JSONObject();
|
|
|
+ jsonObject.put("package",bodyAsString.replaceAll("\"",""));
|
|
|
+ String nonce_str = RandomStringUtils.randomAlphanumeric(32);
|
|
|
+ jsonObject.put("nonceStr",nonce_str);
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ return Response.success();
|
|
|
|
|
|
}
|
|
|
|
|
@@ -107,7 +114,7 @@ public class FilmController extends BaseController {
|
|
|
// 用于接收返回的结果
|
|
|
String resultData ="";
|
|
|
try {
|
|
|
- HttpPost post = new HttpPost("http://movieapi-test.taototo.cn/"+filmDTO.getUrl());
|
|
|
+ HttpPost post = new HttpPost("http://movieapi2.taototo.cn/"+filmDTO.getUrl());
|
|
|
post.setHeader("Content-Type","application/x-www-form-urlencoded");
|
|
|
Map<String, Object> sortMap = new TreeMap<String, Object>();
|
|
|
String time = String.valueOf(System.currentTimeMillis()/1000);
|
|
@@ -177,10 +184,7 @@ public class FilmController extends BaseController {
|
|
|
}
|
|
|
|
|
|
|
|
|
- @Data
|
|
|
- public static class PrepareOrderEntity{
|
|
|
- String prepay_id;
|
|
|
- }
|
|
|
+
|
|
|
|
|
|
|
|
|
|