同步: 调度明细表的拼团号字段与拼团表的拼团号字段,统一去除中文的空格;

财务表: 重新生成时删除旧的记录
feature/trippest
lyt 7 years ago
parent 5c3b1bfde1
commit e2a0ccdb7d

@ -360,7 +360,7 @@ class TulanduoApi extends CI_Controller
/** groupcombineinfo */ /** groupcombineinfo */
$this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "' and GCI_VEI_SN in (" . implode(',', $this->vendor_ids) . ")"; // 不明确指定供应商id,出现过不对应的情况 $this->Order_update->gci_where_update = " GCI_VendorOrderId='" . $detail_jsonResp->orderDetail->orderId . "' and GCI_VEI_SN in (" . implode(',', $this->vendor_ids) . ")"; // 不明确指定供应商id,出现过不对应的情况
$gci_update_column = array( $gci_update_column = array(
"GCI_combineNo" => isset($detail_jsonResp->orderDetail->groupOrderNo) ? $detail_jsonResp->orderDetail->groupOrderNo : null "GCI_combineNo" => isset($detail_jsonResp->orderDetail->groupOrderNo) ? trim_str($detail_jsonResp->orderDetail->groupOrderNo) : null
,"GCI_VEI_SN" => $vei_SN ,"GCI_VEI_SN" => $vei_SN
,"GCI_GRI_SN" => $groupSN ,"GCI_GRI_SN" => $groupSN
,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate ,"GCI_travelDate" => $detail_jsonResp->orderDetail->travelDate
@ -535,11 +535,11 @@ class TulanduoApi extends CI_Controller
/*BIZ_GroupCombineOperationDetail*/ /*BIZ_GroupCombineOperationDetail*/
if ( isset($detail_jsonResp->orderDetail->groupOrderNo) ) { if ( isset($detail_jsonResp->orderDetail->groupOrderNo) ) {
// 删除旧的录入 // 删除旧的录入
$this->Orders_model->biz_groupcombineoperationdetail_cut($detail_jsonResp->orderDetail->groupOrderNo); $this->Orders_model->biz_groupcombineoperationdetail_cut(trim_str($detail_jsonResp->orderDetail->groupOrderNo));
// 门票 // 门票
if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations)) { if (isset($detail_jsonResp->orderDetail->operationDetails->sceneryOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) { foreach ($detail_jsonResp->orderDetail->operationDetails->sceneryOperations as $ks => $vso) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo);
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "sceneryOperations"; $this->Orders_model->GCOD_operationType = "sceneryOperations";
$this->Orders_model->GCOD_subType = $vso->type; $this->Orders_model->GCOD_subType = $vso->type;
@ -561,7 +561,7 @@ class TulanduoApi extends CI_Controller
// 用餐 // 用餐
if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) ) { if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) { foreach ($detail_jsonResp->orderDetail->operationDetails->restraurantOperations as $vro) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo) ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "restraurantOperations"; $this->Orders_model->GCOD_operationType = "restraurantOperations";
$this->Orders_model->GCOD_subType = $vro->type; $this->Orders_model->GCOD_subType = $vro->type;
@ -582,7 +582,7 @@ class TulanduoApi extends CI_Controller
// 用车 // 用车
if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations)) { if (isset($detail_jsonResp->orderDetail->operationDetails->touristCarOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) { foreach ($detail_jsonResp->orderDetail->operationDetails->touristCarOperations as $vco) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo) ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "touristCarOperations"; $this->Orders_model->GCOD_operationType = "touristCarOperations";
$this->Orders_model->GCOD_subType = $vco->type; $this->Orders_model->GCOD_subType = $vco->type;
@ -603,7 +603,7 @@ class TulanduoApi extends CI_Controller
// 导游服务 // 导游服务
if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) { if (isset($detail_jsonResp->orderDetail->operationDetails->guiderOperations) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) { foreach ($detail_jsonResp->orderDetail->operationDetails->guiderOperations as $vgo) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo) ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "guiderOperations"; $this->Orders_model->GCOD_operationType = "guiderOperations";
$this->Orders_model->GCOD_subType = ""; $this->Orders_model->GCOD_subType = "";
@ -624,7 +624,7 @@ class TulanduoApi extends CI_Controller
// 其他支出 // 其他支出
if (isset($detail_jsonResp->orderDetail->operationDetails->otherCosts) ) { if (isset($detail_jsonResp->orderDetail->operationDetails->otherCosts) ) {
foreach ($detail_jsonResp->orderDetail->operationDetails->otherCosts as $voc) { foreach ($detail_jsonResp->orderDetail->operationDetails->otherCosts as $voc) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo) ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "otherCosts"; $this->Orders_model->GCOD_operationType = "otherCosts";
$this->Orders_model->GCOD_subType = $voc->type; $this->Orders_model->GCOD_subType = $voc->type;
@ -665,7 +665,7 @@ class TulanduoApi extends CI_Controller
// } // }
if (isset($detail_jsonResp->orderDetail->operationDetails->trafficOperations)) { if (isset($detail_jsonResp->orderDetail->operationDetails->trafficOperations)) {
foreach ($detail_jsonResp->orderDetail->operationDetails->trafficOperations as $vto) { foreach ($detail_jsonResp->orderDetail->operationDetails->trafficOperations as $vto) {
$this->Orders_model->GCOD_GCI_combineNo = $detail_jsonResp->orderDetail->groupOrderNo ; $this->Orders_model->GCOD_GCI_combineNo = trim_str($detail_jsonResp->orderDetail->groupOrderNo) ;
$this->Orders_model->GCOD_VEI_SN = $vei_SN; $this->Orders_model->GCOD_VEI_SN = $vei_SN;
$this->Orders_model->GCOD_operationType = "trafficOperations"; $this->Orders_model->GCOD_operationType = "trafficOperations";
$this->Orders_model->GCOD_subType = $vto->birthland . " " . $vto->destination; $this->Orders_model->GCOD_subType = $vto->birthland . " " . $vto->destination;
@ -690,6 +690,76 @@ class TulanduoApi extends CI_Controller
return; return;
} }
public function order_complement()
{
// $start_date = $this->input->get_post("start_date");
// $end_date = $this->input->get_post("end_date");
$group_code = $this->input->get_post("group_code");
/**
* 解析输入字段, 可能为拼团号或原始团号
* * 拼团号: 直接解析为发团时间, 按发团时间查询列表
* * 原始团号: 按团号查询
*/
$start_date = NULL; $end_date = NULL;
$order_list = $this->new_order_to_ht("travel", $start_date, $end_date, $group_code);
}
public function new_order_to_ht($date_type="travel", $start_date=NULL, $end_date=NULL, $group_code=NULL)
{
$ret = array();
$ret['data'] = array();
$ret['msg'] = "";
$this->tld_order->setUserId($this->userId)
->setKey($this->key)
->setPageSize(50)
->setPageIndex(1);
if ( ! empty($group_code)) {
$this->tld_order->setAgcOrderNo($group_code);
} else {
if ($date_type === "travel") {
$this->tld_order->setStartTravelDate($start_date)
->setEndTravelDate($end_date) ;
} else {
$this->tld_order->setStartOrderDate($start_date)
->setEndOrderDate($end_date) ;
}
}
$resp = $this->excute_curl($this->list_url, $this->tld_order);
$resp_arr = json_decode($resp, true);
if (intval($resp_arr['status']) !== 1) {
log_message('error','TulanduoApi order_list failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
$ret['msg'] = "failed";
return $ret;
}
if ($resp_arr["responseData"]["totalRows"] == 0) {
$ret['msg'] = "total0";
return $ret;
}
$all_list = $resp_arr["responseData"]["orders"];
for($pi=2; $pi <= $resp_arr['responseData']['pageCount']; $pi++) {
$this->tld_order->setPageIndex($pi);
$f_resp = $this->excute_curl($this->list_url, $this->tld_order);
$f_resp_arr = json_decode($f_resp, true);
if ($resp_arr['status'] !== 1) {
log_message('error','TulanduoApi order_list failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
$ret['msg'] = "failed";
continue;
}
$all_list = array_merge($all_list, $f_resp_arr["responseData"]["orders"]);
}
$all_vendor_order_id = array_map(function($ele){ return $ele['orderId'];}, $all_list);
$all_vendor_order_id_str = implode(',', $all_vendor_order_id);
$exists_ht = $exists_ht_order_id = null;
$exists_ht = $this->sync_model->get_exists_vendorOrderId($all_vendor_order_id_str);
$exists_ht_order_id = array_map(function($ele){ return intval($ele->GCI_VendorOrderId);}, $exists_ht);
$to_insert = array_diff($all_vendor_order_id, $exists_ht_order_id);
if (empty($to_insert)) {
$ret['msg'] = "empty";
}
$ret['data'] = $to_insert;
return $ret;
}
/*! /*!
* 往前获取历史数据 * 往前获取历史数据
* @date 2018-08-21 * @date 2018-08-21

@ -223,7 +223,10 @@ class OrderFinance_model extends CI_Model {
{ {
$sql = "SELECT top 10 ordernumber from report_tour where ordernumber=? "; $sql = "SELECT top 10 ordernumber from report_tour where ordernumber=? ";
if ($tourBz) { if ($tourBz) {
$tourBz = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]', '', strstr($tourBz, ",", true)); $tourBz = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]$', '', strstr($tourBz, ",", true));
if (stripos($tourBz, "pvt") === false) {
$tourBz = str_replace("]", "", $tourBz);
}
$tourBz = str_replace("[", "[[]", $tourBz); $tourBz = str_replace("[", "[[]", $tourBz);
$sql .= " and (tourBz like '%" . $this->HT->escape_like_str($tourBz) . "%' $sql .= " and (tourBz like '%" . $this->HT->escape_like_str($tourBz) . "%'
OR tourBz='') "; OR tourBz='') ";
@ -259,7 +262,10 @@ class OrderFinance_model extends CI_Model {
$tourBz_tmp = ""; $tourBz_tmp = "";
if ($this->report_tour_exists($vrt['ordernumber'], $vrt['tourCode'], $vrt['tourBZ']) === TRUE) { if ($this->report_tour_exists($vrt['ordernumber'], $vrt['tourCode'], $vrt['tourBZ']) === TRUE) {
$where = " ordernumber='" . $vrt['ordernumber'] . "' "; //AND tourCode='" . $vrt['tourCode'] . "' "; $where = " ordernumber='" . $vrt['ordernumber'] . "' "; //AND tourCode='" . $vrt['tourCode'] . "' ";
$tourBz_tmp = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]', '', strstr($vrt['tourBZ'], ",", true)); $tourBz_tmp = mb_ereg_replace('[^a-zA-Z0-9\-\[\]]$', '', strstr($vrt['tourBZ'], ",", true));
if (stripos($tourBz_tmp, "pvt") === false) {
$tourBz_tmp = str_replace("]", "", $tourBz_tmp);
}
$tourBz_tmp = str_replace("[", "[[]", $tourBz_tmp); $tourBz_tmp = str_replace("[", "[[]", $tourBz_tmp);
$where .= " AND (tourBZ like '%" . $this->HT->escape_like_str($tourBz_tmp) . "%' $where .= " AND (tourBZ like '%" . $this->HT->escape_like_str($tourBz_tmp) . "%'
OR tourBZ='') "; OR tourBZ='') ";

Loading…
Cancel
Save