trippest 存入HT供应商计划相关表

feature/pay
lyt 7 years ago
parent 4b22574baf
commit 462cfa20b9

@ -50,6 +50,7 @@ class TulanduoApi extends CI_Controller
public function __construct(){ public function __construct(){
parent::__construct(); parent::__construct();
$this->load->model('Orders_model'); $this->load->model('Orders_model');
$this->load->model('Order_insert');
$this->load->model('TuLanDuo_queryContentBuilder', 'tld_order'); $this->load->model('TuLanDuo_queryContentBuilder', 'tld_order');
$this->load->helper('array'); $this->load->helper('array');
@ -74,15 +75,15 @@ class TulanduoApi extends CI_Controller
->setKey($this->key) ->setKey($this->key)
->setPageSize(20) ->setPageSize(20)
->setPageIndex(1) ->setPageIndex(1)
->setStartTravelDate("2018-04-19") ->setStartTravelDate("2018-04-18")
->setEndTravelDate("2018-04-19") ->setEndTravelDate("2018-04-18")
// ->setStartOrderDate("2018-04-13") // ->setStartOrderDate("2018-04-13")
// ->setEndOrderDate("2018-04-13") // ->setEndOrderDate("2018-04-13")
; ;
$resp = $this->excute_curl($this->list_url, $this->tld_order); $resp = $this->excute_curl($this->list_url, $this->tld_order);
$resp_arr = json_decode($resp, true); $resp_arr = json_decode($resp, true);
if ($resp_arr['status'] !== 1) { if ($resp_arr['status'] !== 1) {
log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . json_encode($this->params)); log_message('error','TulanduoApi get_orderlist failed. Msg:' . $resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
return; return;
} }
$all_list = $resp_arr["responseData"]["orders"]; $all_list = $resp_arr["responseData"]["orders"];
@ -97,7 +98,7 @@ class TulanduoApi extends CI_Controller
$f_resp = $this->excute_curl($this->list_url, $this->tld_order); $f_resp = $this->excute_curl($this->list_url, $this->tld_order);
$f_resp_arr = json_decode($f_resp, true); $f_resp_arr = json_decode($f_resp, true);
if ($resp_arr['status'] !== 1) { if ($resp_arr['status'] !== 1) {
log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . json_encode($this->params)); log_message('error','TulanduoApi get_orderlist failed. Msg:' . $f_resp_arr['errMsg'] . "; Request: " . ($this->tld_order->getBizContent()));
continue; continue;
} }
$f_order_to_HT = array_map( $f_order_to_HT = array_map(
@ -112,14 +113,6 @@ class TulanduoApi extends CI_Controller
$cnt = 0; $cnt = 0;
foreach ($all_list as $k => $vo) { foreach ($all_list as $k => $vo) {
$vo['agcOrderNo'] = mb_ereg_replace('(\s| )', '', $vo['agcOrderNo']); // 去掉中文的全角空格 $vo['agcOrderNo'] = mb_ereg_replace('(\s| )', '', $vo['agcOrderNo']); // 去掉中文的全角空格
// get order detail
// $this->tld_order->setOrderId($vo["orderId"]);
// $detail_resp = $this->excute_curl($this->detail_url, $this->tld_order);
// $detail_jsonResp = json_decode($detail_resp);
// if ($detail_jsonResp->status !== 1) {
// log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . json_encode($this->params));
// return;
// }
$PAG_Code = $pag_sub = null; $PAG_Code = $pag_sub = null;
preg_match('^[a-zA-Z]+\-[0-9\-]+^', $this->characet($vo['routeName'], "UTF-8"), $temp_array); preg_match('^[a-zA-Z]+\-[0-9\-]+^', $this->characet($vo['routeName'], "UTF-8"), $temp_array);
if (empty($temp_array) && isset($this->pag_no_tmp()[$vo['routeName']])) { if (empty($temp_array) && isset($this->pag_no_tmp()[$vo['routeName']])) {
@ -139,7 +132,7 @@ class TulanduoApi extends CI_Controller
$COLD_MemoText = json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic'])); $COLD_MemoText = json_encode(array("Pick up"=>$vo['toTraffic'], "Drop off"=>$vo['backTraffic']));
$this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null; $this->Orders_model->BIZ_COLI_SN = $this->Orders_model->GRI_SN = $this->Orders_model->GCI_SN = null;
$this->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过 $this->Orders_model->get_SN_by_vendorOrderId($vo['orderId']); // 查询订单是否已经录入过
if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) { if ($this->Orders_model->BIZ_COLI_SN === null && in_array($vo['agcName'], array("D目的地桂林组"))) {
$tmp_groupCode = explode("-", $vo['agcOrderNo']); $tmp_groupCode = explode("-", $vo['agcOrderNo']);
$real_groupCode = $tmp_groupCode[0] . "-"; $real_groupCode = $tmp_groupCode[0] . "-";
@ -165,7 +158,7 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->GRI_IsCancel = 0; $this->Orders_model->GRI_IsCancel = 0;
$this->Orders_model->DeleteFlag = 0; $this->Orders_model->DeleteFlag = 0;
$this->Orders_model->groupinfo_save(); $this->Orders_model->groupinfo_save();
/*BIZ_ConfirmLineInfo*/ /**BIZ_ConfirmLineInfo*/
$this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null; $this->Orders_model->BIZ_COLI_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null;
$this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : ""; $this->Orders_model->BIZ_COLI_GroupCode = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_No : "";
$this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN; $this->Orders_model->BIZ_GUT_SN = $this->Orders_model->GUT_SN;
@ -179,7 +172,8 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName']; $this->Orders_model->BIZ_COLI_OrderDetailText = "来自图兰朵系统同步测试" . $vo["orderId"] . ";线路:" . $vo['routeName'];
$this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null; $this->Orders_model->BIZ_COLI_GUT_SN = $this->Orders_model->BIZ_GUT_SN ? $this->Orders_model->BIZ_GUT_SN : null;
$coli_sn[] = $this->Orders_model->biz_confirm_save(); $coli_sn[] = $this->Orders_model->biz_confirm_save();
/*BIZ_ConfirmLineDetail*/ log_message('error','new coli ' . $this->Orders_model->BIZ_COLI_ID);
/**BIZ_ConfirmLineDetail*/
$this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN; $this->Orders_model->COLD_COLI_SN = $this->Orders_model->BIZ_COLI_SN;
$this->Orders_model->COLD_ServiceType = "D"; $this->Orders_model->COLD_ServiceType = "D";
$this->Orders_model->COLD_ServiceSN = $serviceSN; $this->Orders_model->COLD_ServiceSN = $serviceSN;
@ -193,6 +187,20 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->COLD_PlanVEI_SN = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN']; $this->Orders_model->COLD_PlanVEI_SN = empty($this->city_info[$vo['operationDep']]) ? 1343 : $this->city_info[$vo['operationDep']]['PlanVEI_SN'];
$this->Orders_model->COLD_MemoText = $COLD_MemoText; $this->Orders_model->COLD_MemoText = $COLD_MemoText;
$this->Orders_model->biz_confirm_detail_save(); $this->Orders_model->biz_confirm_detail_save();
/** VendorArrangeState */
$vendor_contact = $this->Orders_model->get_vendorContact($this->Orders_model->COLD_PlanVEI_SN);
$this->Order_insert->VAS_GRI_SN = $this->Orders_model->GRI_SN ? $this->Orders_model->GRI_SN : null;
$this->Order_insert->VAS_VEI_SN = $this->Orders_model->COLD_PlanVEI_SN;
$this->Order_insert->VAS_IsSendSucceed = 1;
$this->Order_insert->VAS_IsConfirm = $vo['orderStatus'];
$this->Order_insert->VAS_IsCancel = 0;
$this->Order_insert->VAS_SendTime = $vo['orderDate'];
$this->Order_insert->VAS_ConfirmTime = $vo['orderStatus'] == 1 ? $vo['orderDate'] : null;
$this->Order_insert->VAS_LMI_SN = !empty($vendor_contact) ? $vendor_contact->LMI_SN : null;
$this->Order_insert->VAS_FaxNo = !empty($vendor_contact) ? $vendor_contact->LMI_AutoFax : null;
$this->Order_insert->VAS_VendorEmail = !empty($vendor_contact) ? $vendor_contact->LMI_ListMail : null;
$this->Order_insert->vendorarrangestate_save();
$cnt++; $cnt++;
} }
if ($this->Orders_model->GCI_SN === null) { if ($this->Orders_model->GCI_SN === null) {
@ -231,7 +239,7 @@ class TulanduoApi extends CI_Controller
$detail_resp = $this->excute_curl($this->detail_url, $this->tld_order); $detail_resp = $this->excute_curl($this->detail_url, $this->tld_order);
$detail_jsonResp = json_decode($detail_resp); $detail_jsonResp = json_decode($detail_resp);
if ($detail_jsonResp->status !== 1) { if ($detail_jsonResp->status !== 1) {
log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . json_encode($this->params)); log_message('error','TulanduoApi get_orderdetail failed. Msg:' . $detail_jsonResp->errMsg . "; Request: " . $this->tld_order->getBizContent());
return; return;
} }
$allDetails_to_HT = "日程: "; $allDetails_to_HT = "日程: ";
@ -297,7 +305,7 @@ class TulanduoApi extends CI_Controller
$this->Orders_model->biz_groupcombineoperationdetail_save(); $this->Orders_model->biz_groupcombineoperationdetail_save();
} }
} }
// 用房 // 用房 ...
// 用餐 // 用餐
if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) && if (isset($detail_jsonResp->orderDetail->operationDetails->restraurantOperations) &&
empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "restraurantOperations"))) { empty($this->Orders_model->combineoperation_exist($detail_jsonResp->orderDetail->groupOrderNo, "restraurantOperations"))) {
@ -389,7 +397,7 @@ class TulanduoApi extends CI_Controller
->setOrderType(2) // todo ->setOrderType(2) // todo
->setRouteName($routeName) ->setRouteName($routeName)
->setRouteType("北京目的地线路") // todo ->setRouteType("北京目的地线路") // todo
->setAgcOrderNo($orderinfo[0]->COLI_GroupCode) ->setAgcOrderNo($orderinfo[0]->COLI_GroupCode) // todo 加上 -BJ,-SH, -XA
->setAdultNum($orderinfo[0]->COLD_PersonNum) ->setAdultNum($orderinfo[0]->COLD_PersonNum)
->setChildNum($orderinfo[0]->COLD_ChildNum) ->setChildNum($orderinfo[0]->COLD_ChildNum)
->setDestination("北京") // todo ->setDestination("北京") // todo

@ -1,6 +1,6 @@
<?php <?php
class Orders_model extends CI_Model { class Order_insert extends CI_Model {
function __construct() { function __construct() {
parent::__construct(); parent::__construct();
@ -127,6 +127,63 @@ class Orders_model extends CI_Model {
return $query->result(); return $query->result();
} }
public $VAS_GRI_SN;
public $VAS_VEI_SN;
public $VAS_IsSendSucceed;
public $VAS_IsConfirm;
public $VAS_SendTime;
public $VAS_ConfirmTime;
public $VAS_IsCancel;
public $VAS_LMI_SN;
public $VAS_FaxNo;
public $VAS_VendorEmail;
public function vendorarrangestate_save()
{
$sql = "INSERT INTO VendorArrangeState
(VAS_GRI_SN
,VAS_VEI_SN
,VAS_IsSendSucceed
,VAS_IsConfirm
,VAS_SendTime
,VAS_ConfirmTime
,VAS_IsCancel
,VAS_LMI_SN
,VAS_FaxNo
,VAS_VendorEmail
,Creator
,LastEditTime
,DeleteFlag
) VALUES
(?
,?
,?
,?
,?
,?
,?
,?
,?
,?
,0
,GETDATE()
,0
)";
$query = $this->HT->query($sql, array(
$this->VAS_GRI_SN
,$this->VAS_VEI_SN
,$this->VAS_IsSendSucceed
,$this->VAS_IsConfirm
,$this->VAS_SendTime
,$this->VAS_ConfirmTime
,$this->VAS_IsCancel
,$this->VAS_LMI_SN
,$this->VAS_FaxNo
,$this->VAS_VendorEmail
));
return $query;
}
/** 团信息 */
public $GRI_SN=0; // 团号 public $GRI_SN=0; // 团号
public $GRI_No; // 团号 public $GRI_No; // 团号
public $GRI_OrderType; // 订单类型 public $GRI_OrderType; // 订单类型
@ -135,7 +192,6 @@ class Orders_model extends CI_Model {
public $GRI_Days; // 行程天数 public $GRI_Days; // 行程天数
public $GRI_IsCancel=0; public $GRI_IsCancel=0;
public $GRI_DeleteFlag=0; public $GRI_DeleteFlag=0;
/** 团信息 */
public function groupinfo_save() public function groupinfo_save()
{ {
$sql = "INSERT INTO GRoupInfo $sql = "INSERT INTO GRoupInfo
@ -160,6 +216,7 @@ class Orders_model extends CI_Model {
return $this->GRI_SN; return $this->GRI_SN;
} }
/** 目的地订单 拼团信息 */
public $GCI_SN; public $GCI_SN;
public $GCI_combineNo=''; // 拼团团号 public $GCI_combineNo=''; // 拼团团号
public $GCI_COLI_SN; // 订单key public $GCI_COLI_SN; // 订单key
@ -169,7 +226,6 @@ class Orders_model extends CI_Model {
public $GCI_travelDate; public $GCI_travelDate;
public $GCI_leaveDate; public $GCI_leaveDate;
public $GCI_createTime; public $GCI_createTime;
/** 目的地订单 拼团信息 */
public function biz_groupcombineinfo_save() public function biz_groupcombineinfo_save()
{ {
$sql = "IF NOT EXISTS( $sql = "IF NOT EXISTS(

@ -397,6 +397,25 @@ class Orders_model extends CI_Model {
return NULL; return NULL;
} }
/*!
* 获取地接社接受计划的人员信息
* @param $vendorID 地接社ID
*/
public function get_vendorContact($vendorID)
{
$sql = "SELECT top 1 lmi2.LMI2_Name,
lmi.LMI_SN,
lmi.LMI_AutoFax,
lmi.LMI_Telephone,
lmi.LMI_Mobile,
lmi.LMI_ListMail
FROM LinkmanInfo lmi
INNER JOIN LinkManInfo2 lmi2 ON lmi2.LMI2_LMI_SN=lmi.LMI_SN
WHERE LMI_Receiver='Yes' AND LMI_VEI_SN=$vendorID";
$query = $this->HT->query($sql);
return $query->row();
}
var $BIZ_COLI_SN; var $BIZ_COLI_SN;
var $BIZ_COLI_ID; var $BIZ_COLI_ID;
var $BIZ_COLI_GUT_SN; //联系人id var $BIZ_COLI_GUT_SN; //联系人id

Loading…
Cancel
Save