|
|
@@ -19,7 +19,6 @@ import com.yc.ship.framework.security.core.LoginUser;
|
|
|
import com.yc.ship.framework.tenant.core.aop.TenantIgnore;
|
|
|
import com.yc.ship.module.trade.controller.admin.orderjzdetail.vo.OrderJzDetailPageReqVO;
|
|
|
import com.yc.ship.module.trade.controller.admin.orderjzdetail.vo.OrderJzDetailSaveReqVO;
|
|
|
-import com.yc.ship.module.trade.controller.app.ota.vo.OtaVoucherVO;
|
|
|
import com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO;
|
|
|
import com.yc.ship.module.trade.dal.dataobject.orderjz.OrderJzDO;
|
|
|
import com.yc.ship.module.trade.dal.dataobject.orderjzdetail.OrderJzDetailDO;
|
|
|
@@ -36,6 +35,7 @@ import org.springframework.stereotype.Service;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
+import java.nio.charset.StandardCharsets;
|
|
|
import java.time.LocalDateTime;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
@@ -106,9 +106,7 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
long count = 0;
|
|
|
String batchNo = IdUtil.getSnowflake(0, 0).nextIdStr();
|
|
|
// 先删除当前传入游客的历史接站数据
|
|
|
- List<Long> visitorIds = new ArrayList<>();
|
|
|
for (OrderJzDetailSaveReqVO orderJzDetailSaveReqVO : createReqVOList) {
|
|
|
- visitorIds.add(orderJzDetailSaveReqVO.getVisitorId());
|
|
|
orderJzDetailMapper.delete(new LambdaQueryWrapper<OrderJzDetailDO>().eq(OrderJzDetailDO::getVisitorId, orderJzDetailSaveReqVO.getVisitorId()));
|
|
|
}
|
|
|
//处理三方系统退票
|
|
|
@@ -118,19 +116,26 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
createOrderJzDetail(orderJzDetailSaveReqVO);
|
|
|
count++;
|
|
|
}
|
|
|
- try {
|
|
|
- cancelSupplierJz(visitorIds,orderJzDO.getId(),createReqVOList);
|
|
|
|
|
|
+ return count;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public void sendJz(List<Map<String, Object>> list, Long jzId) {
|
|
|
+ try {
|
|
|
+ List<Long> visitorIds = list.stream().map(item -> MapUtils.getLong(item, "visitorId")).collect(Collectors.toList());
|
|
|
+ cancelSupplierJz(visitorIds, jzId);
|
|
|
//处理三方系统出票 二期接站
|
|
|
- String supplierOrderId = createSupplierJz(createReqVOList, orderDo);
|
|
|
- paySupplierJz(supplierOrderId, orderJzDO.getId(),createReqVOList);
|
|
|
+ String supplierOrderId = createSupplierJz(list);
|
|
|
+ paySupplierJz(supplierOrderId, jzId);
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
- return count;
|
|
|
}
|
|
|
|
|
|
- private String createSupplierJz(List<OrderJzDetailSaveReqVO> createReqVOList, TradeOrderDO tradeOrderDO) throws Exception {
|
|
|
+
|
|
|
+ private String createSupplierJz(List<Map<String, Object>> createReqVOList) throws Exception {
|
|
|
Long id = null;
|
|
|
String productId = "2034198456717037761";
|
|
|
String method = "createOrder";
|
|
|
@@ -140,14 +145,16 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
String bookname = "";
|
|
|
String mobile = "";
|
|
|
String idcard = "";
|
|
|
- for (OrderJzDetailSaveReqVO orderJzDetailSaveReqVO : createReqVOList) {
|
|
|
- id = orderJzDetailSaveReqVO.getJzId();
|
|
|
- mobile = orderJzDetailSaveReqVO.getPhone();
|
|
|
- idcard = orderJzDetailSaveReqVO.getIdCard();
|
|
|
+ String useDate = "";
|
|
|
+ for (Map<String, Object> orderJzDetailSaveReqVO : createReqVOList) {
|
|
|
+ id = MapUtils.getLong(orderJzDetailSaveReqVO, "jz_id");
|
|
|
+ mobile = MapUtils.getString(orderJzDetailSaveReqVO, "phone");
|
|
|
+ idcard = MapUtils.getString(orderJzDetailSaveReqVO, "id_card");
|
|
|
+ useDate = MapUtils.getString(orderJzDetailSaveReqVO, "use_date");
|
|
|
}
|
|
|
JSONObject rep_body = new JSONObject();
|
|
|
rep_body.put("orderId", id);
|
|
|
- rep_body.put("travelDate", tradeOrderDO.getTravelDate());
|
|
|
+ rep_body.put("travelDate", useDate);
|
|
|
rep_body.put("travelTime", "");
|
|
|
rep_body.put("quantity", createReqVOList.size());
|
|
|
rep_body.put("productId", productId);
|
|
|
@@ -156,12 +163,13 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
rep_body.put("idCard", idcard);
|
|
|
|
|
|
JSONArray vistorList = new JSONArray();
|
|
|
- for (OrderJzDetailSaveReqVO tradeVisitorDO : createReqVOList) {
|
|
|
+ for (Map<String, Object> tradeVisitorDO : createReqVOList) {
|
|
|
JSONObject vistor = new JSONObject();
|
|
|
- vistor.put("name", tradeVisitorDO.getName());
|
|
|
- vistor.put("mobile", tradeVisitorDO.getPhone());
|
|
|
- vistor.put("idCard", tradeVisitorDO.getIdCard());
|
|
|
- if(tradeVisitorDO.getIdCard().length()!=18){
|
|
|
+ vistor.put("name", MapUtils.getString(tradeVisitorDO, "name"));
|
|
|
+ vistor.put("mobile", MapUtils.getString(tradeVisitorDO, "phone"));
|
|
|
+ String idCard = MapUtils.getString(tradeVisitorDO, "id_card");
|
|
|
+ vistor.put("idCard", idCard);
|
|
|
+ if (idCard.length() != 18) {
|
|
|
vistor.put("idType", "1");
|
|
|
}
|
|
|
|
|
|
@@ -173,7 +181,7 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
Long timestamp = System.currentTimeMillis() / 1000;
|
|
|
String signStr = userId + method + timestamp + bodyStr + userKey;
|
|
|
log.info("三峡二期系统预下单开始,signStr:{}", signStr);
|
|
|
- String sign = MD5Utils.getMD5(signStr.getBytes("UTF-8"));
|
|
|
+ String sign = MD5Utils.getMD5(signStr.getBytes(StandardCharsets.UTF_8));
|
|
|
|
|
|
JSONObject rep_head = new JSONObject();
|
|
|
rep_head.put("user_id", userId);
|
|
|
@@ -207,16 +215,16 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
log.info(e.toString());
|
|
|
}
|
|
|
log.error("二期下单完成,响应body参数:{}", body);
|
|
|
- JSONObject responseBody =JSONUtil.parseObj(body);
|
|
|
+ JSONObject responseBody = JSONUtil.parseObj(body);
|
|
|
return responseBody.getStr("orderId");
|
|
|
} else {
|
|
|
log.error("二期下单失败,响应response参数:{}", res);
|
|
|
}
|
|
|
- return null;
|
|
|
+ return null;
|
|
|
}
|
|
|
|
|
|
|
|
|
- private void paySupplierJz(String supplierOrderId, Long jzId,List<OrderJzDetailSaveReqVO> createReqVOList) throws Exception {
|
|
|
+ private void paySupplierJz(String supplierOrderId, Long jzId) throws Exception {
|
|
|
String method = "payOrder";
|
|
|
String createOrderUrl = "http://10.3.10.50/app-api/travelhub-ops-trade/trade/ota/zshl/212/" + method;
|
|
|
String userId = "67fd6a5e6a2a453a98f288b08d571234";
|
|
|
@@ -263,8 +271,8 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
log.info(e.toString());
|
|
|
}
|
|
|
log.error("二期支付完成,响应body参数:{}", body);
|
|
|
- JSONObject responseBody =JSONUtil.parseObj(body);
|
|
|
- JSONArray vistors =responseBody.getJSONArray("visitPersons");
|
|
|
+ JSONObject responseBody = JSONUtil.parseObj(body);
|
|
|
+ JSONArray vistors = responseBody.getJSONArray("visitPersons");
|
|
|
for (int i = 0; i < vistors.size(); i++) {
|
|
|
JSONObject vistor = vistors.getJSONObject(i);
|
|
|
String idCard = vistor.getStr("idCard");
|
|
|
@@ -276,15 +284,15 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void cancelSupplierJz(List<Long> visitorIds, Long jzId,List<OrderJzDetailSaveReqVO> createReqVOList) throws Exception {
|
|
|
+ private void cancelSupplierJz(List<Long> visitorIds, Long jzId) {
|
|
|
String method = "cancelTicket";
|
|
|
String createOrderUrl = "http://10.3.10.50/app-api/travelhub-ops-trade/trade/ota/zshl/212/" + method;
|
|
|
String userId = "67fd6a5e6a2a453a98f288b08d571234";
|
|
|
String userKey = "TFD9BEOK";
|
|
|
List<OrderJzDetailDO> jzDetailList = orderJzDetailMapper.selectList(new QueryWrapper<OrderJzDetailDO>().in("visitor_id", visitorIds));
|
|
|
Map<String, List<OrderJzDetailDO>> groupList = jzDetailList.stream().filter(item -> StringUtils.isNotBlank(item.getExtendOrderNo())).collect(Collectors.groupingBy(OrderJzDetailDO::getExtendOrderNo));
|
|
|
- if(groupList.isEmpty()){
|
|
|
- log.error("无可退二期票信息"+jzId);
|
|
|
+ if (groupList.isEmpty()) {
|
|
|
+ log.error("无可退二期票信息" + jzId);
|
|
|
return;
|
|
|
}
|
|
|
groupList.forEach((supplierOrderId, list) -> {
|
|
|
@@ -338,7 +346,7 @@ public class OrderJzDetailServiceImpl implements OrderJzDetailService {
|
|
|
} else {
|
|
|
log.error("二期系统退票失败,响应response参数:{}", json);
|
|
|
}
|
|
|
- }catch (Exception e){
|
|
|
+ } catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
|
}
|
|
|
});
|