Althars123 4 роки тому
батько
коміт
3c7637719d

+ 40 - 1
zzjs-admin/src/main/java/com/miaxis/app/controller/film/NotifyController.java

@@ -73,6 +73,7 @@ public class NotifyController {
         WxNotifyReturnDTO wxNotifyReturnDTO = new WxNotifyReturnDTO();
         wxNotifyReturnDTO.setCode("SUCCESS");
         wxNotifyReturnDTO.setMessage("成功");
+
         return wxNotifyReturnDTO;
     }
 
@@ -81,7 +82,7 @@ public class NotifyController {
      */
     @PostMapping(value = "/filmOrder")
     @ApiOperation("电影订单回调")
-    public FilmNotifyReturnDTO filmOrderNotify(@RequestBody FilmOrderNotifyDTO filmOrderNotifyDTO) throws GeneralSecurityException, IOException {
+    public FilmNotifyReturnDTO filmOrderNotify(FilmOrderNotifyDTO filmOrderNotifyDTO) {
         FilmOrder filmOrder = filmOrderService.getByOutTradeNo(filmOrderNotifyDTO.getThirdOrderId());
        //todo 检查sign
         filmOrder.setOrderState(filmOrderNotifyDTO.getEventName());
@@ -96,10 +97,47 @@ public class NotifyController {
         FilmNotifyReturnDTO filmNotifyReturnDTO = new FilmNotifyReturnDTO();
         filmNotifyReturnDTO.setCode("200");
         filmNotifyReturnDTO.setMessage("请求成功");
+        filmNotifyReturnDTO.setSuccess(true);
         return filmNotifyReturnDTO;
     }
 
 
+    /**
+     * 电影下单测试
+     */
+    @PostMapping(value = "/filmOrder-test")
+    @ApiOperation("电影订单下单测试")
+    public Response filmOrderNotifytest(String outTradeNo) throws GeneralSecurityException, IOException {
+        FilmOrder filmOrder = filmOrderService.getByOutTradeNo(outTradeNo);
+        FilmDTO filmDTO = new FilmDTO();
+        filmDTO.setUrl("api/order/create");
+        StringBuffer paramData =  new StringBuffer();
+        paramData.append("showId="+filmOrder.getShowId()+"&");
+        paramData.append("seat="+filmOrder.getSeat()+"&");
+        if (filmOrder.getReservedPhone() != null){
+            paramData.append("reservedPhone="+filmOrder.getReservedPhone()+"&");
+        }
+        paramData.append("thirdOrderId="+filmOrder.getOutTradeNo()+"&");
+        paramData.append("notifyUrl="+notifyUrl+"&");
+        if (filmOrder.getSeatId() != null){
+            paramData.append("seatId="+filmOrder.getSeatId()+"&");
+        }
+        if (filmOrder.getSeatNo() != null){
+            paramData.append("seatNo="+filmOrder.getSeatNo()+"&");
+        }
+        paramData.append("acceptChangeSeat="+filmOrder.getAcceptChangeSeat());
+        filmDTO.setParamData(paramData.toString());
+        try {
+
+            String s = filmOrderService.excuteFilmApi(filmDTO);
+            log.info("电影下单返回值:"+s);
+        } catch (IOException e) {
+            e.printStackTrace();
+        }
+        return  Response.success();
+    }
+
+
 
 
     @Transactional
@@ -149,6 +187,7 @@ public class NotifyController {
                         paramData.append("seatNo="+filmOrder.getSeatNo()+"&");
                     }
                     paramData.append("acceptChangeSeat="+filmOrder.getAcceptChangeSeat());
+                    filmDTO.setParamData(paramData.toString());
                     try {
                         String s = filmOrderService.excuteFilmApi(filmDTO);
                         log.info("电影下单返回值:"+s);

+ 6 - 1
zzjs-service/src/main/java/com/miaxis/film/service/impl/FilmOrderServiceImpl.java

@@ -70,7 +70,12 @@ public class FilmOrderServiceImpl extends ServiceImpl<FilmOrderMapper, FilmOrder
         // 创建一个http客户端
         CloseableHttpClient httpClient = HttpClientBuilder.create().build();
         try {
-            HttpPost post = new HttpPost("http://movieapi2-test.taototo.cn/"+filmDTO.getUrl());
+            HttpPost post = null;
+            if ("api/automation/orderHandle".equals(filmDTO.getUrl())) {
+                post = new HttpPost("http://movieapi-test.taototo.cn/"+filmDTO.getUrl());
+            }else{
+                post = new HttpPost("http://movieapi2-test.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);