Commit e0bd2dde authored by clone's avatar clone

数据转换

parent d0369116
...@@ -5,7 +5,9 @@ namespace app\api\controller; ...@@ -5,7 +5,9 @@ namespace app\api\controller;
use app\api\extend\Basic; use app\api\extend\Basic;
use app\model\Applies; use app\model\Applies;
use app\model\GHouses; use app\model\GHouses;
use app\model\JournalAccounts;
use app\model\OMarchInModel; use app\model\OMarchInModel;
use app\model\OPayLogModel;
use app\model\OrderModel; use app\model\OrderModel;
use app\model\OReportModel; use app\model\OReportModel;
use app\model\RefundTables; use app\model\RefundTables;
...@@ -31,16 +33,18 @@ class ConvertOrder extends Basic ...@@ -31,16 +33,18 @@ class ConvertOrder extends Basic
private $remarksModel; private $remarksModel;
private $marchInModel; private $marchInModel;
private $refundModel; private $refundModel;
private $journalaccountsModel;
public function __construct($request = null) public function __construct($request = null)
{ {
$this->appliesModel = new Applies(); $this->appliesModel = new Applies();
$this->userModel = new Users(); $this->userModel = new Users();
$this->reportModel = new OReportModel(); $this->reportModel = new OReportModel();
$this->orderModel = new OrderModel(); $this->orderModel = new OrderModel();
$this->remarksModel = new Remarks(); $this->remarksModel = new Remarks();
$this->marchInModel = new OMarchInModel(); $this->marchInModel = new OMarchInModel();
$this->refundModel = new RefundTables(); $this->refundModel = new RefundTables();
$this->journalaccountsModel = new JournalAccounts();
parent::__construct($request); parent::__construct($request);
} }
...@@ -106,38 +110,124 @@ class ConvertOrder extends Basic ...@@ -106,38 +110,124 @@ class ConvertOrder extends Basic
ob_flush(); ob_flush();
} }
public function convertCollectingBill()
{
$field = "a.type,a.moneytype,a.money,a.trademark,a.remarks,a.created,a.modified,d.id as agent_id,b.id as report_id,c.id as order_id,c.order_no";
$collectingBillList = $this->journalaccountsModel->getJournalAccountsListByStatus(1, 2000, $field);
dump($collectingBillList);
$collectingBillArr = [];
foreach ($collectingBillList as $key => $item) {
$collectingBillParams = $this->collectingBillBin(0, $item["moneytype"], $item["type"], $item["money"],
$item["agent_id"], $item["report_id"], $item["order_id"], $item["order_no"], "---", $item["trademark"],
$item["remarks"], "", $item["created"], $item["modified"]);
array_push($collectingBillArr, $collectingBillParams);
}
$payLogModel = new OPayLogModel();
$payLogModel->addPayLog($collectingBillArr);
ob_flush();
}
//收款
private function collectingBillBin($father_id, $type, $pay_type, $money, $agent_id, $report_id, $order_id, $order_no, $house_number,
$industry_type, $remark, $transfer_img, $created, $modified)
{
//付款类型 10意向金 20定金 30保管金 40押金 50 租金 60 进场费 70转让费 80其他'
$types = 80;
switch ($type) {
case 1:
$types = 10;
break;
case 2:
$types = 20;
break;
case 3:
$types = 30;
break;
case 4:
$types = 40;
break;
case 5:
$types = 50;
break;
case 6:
$types = 60;
break;
case 7:
$types = 70;
break;
}
//0表示pos(扫码) ,1表示pos,2表示现金,3表示转账,4表示其他',
//支付方式 10支付宝 20 微信 30pos机器 40转账 50现金 60 其他
$pay_types = 60;
switch ($pay_type) {
case 0:
$pay_types = 30;
break;
case 1:
$pay_types = 30;
break;
case 2:
$pay_types = 50;
break;
case 3:
$pay_types = 40;
break;
case 4:
$pay_types = 60;
break;
}
$arr["father_id"] = $father_id;
$arr["type"] = $types;
$arr["pay_type"] = $pay_types;
$arr["money"] = $money;
$arr["agent_id"] = $agent_id;
$arr["report_id"] = $report_id;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["house_number"] = $house_number;
$arr["industry_type"] = $industry_type;
$arr["remark"] = $remark;
$arr["transfer_img"] = $transfer_img;
$arr["create_time"] = $created;
$arr["update_time"] = $modified;
return $arr;
}
/** /**
* 退款 * 退款
*/ */
public function convertRefund() public function convertRefund()
{ {
/* $field = "a.apply_id,a.tui_money,a.name,a.bank,a.bank_card,a.content,a.transaction_status,a.time,a.admin, /* $field = "a.apply_id,a.tui_money,a.name,a.bank,a.bank_card,a.content,a.transaction_status,a.time,a.admin,
b.id as report_id,c.id as order_id,c.order_no"; b.id as report_id,c.id as order_id,c.order_no";
$refundList = $this->refundModel->getRefundList($field); $refundList = $this->refundModel->getRefundList($field);
foreach ($refundList as $item) { foreach ($refundList as $item) {
$this->refundBin(); $this->refundBin();
}*/ }*/
} }
//退款 //退款
private function refundBin() private function refundBin()
{ {
/* $arr["agent_id"] = $report_id; /* $arr["agent_id"] = $report_id;
$arr["report_id"] = $father_id; $arr["report_id"] = $father_id;
$arr["order_id"] = $order_no; $arr["order_id"] = $order_no;
$arr["order_no"] = $order_id; $arr["order_no"] = $order_id;
$arr["refund_money"] = $agent_id; $arr["refund_money"] = $agent_id;
$arr["name"] = $collecting_arr["type"]; $arr["name"] = $collecting_arr["type"];
$arr["bank"] = $collecting_arr["pay_type"]; $arr["bank"] = $collecting_arr["pay_type"];
$arr["card_no"] = $collecting_arr["money"]; $arr["card_no"] = $collecting_arr["money"];
$arr["remark"] = $house_number; $arr["remark"] = $house_number;
$arr["remark_img"] = $industry_type; $arr["remark_img"] = $industry_type;
$arr["create_time"] = date("Y-m-d H:i:s", time()); $arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time()); $arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr; return $arr;
//todo 判断此单是否有付款 //todo 判断此单是否有付款
$is_ok = $this->o_refund_model->addRefund($params);*/ $is_ok = $this->o_refund_model->addRefund($params);*/
} }
private function reportBin($id, $report_agent_id, $report_agent_phone, $report_agent_name, $report_store_id, $user_id, $user_phone, $user_name, private function reportBin($id, $report_agent_id, $report_agent_phone, $report_agent_name, $report_store_id, $user_id, $user_phone, $user_name,
...@@ -197,7 +287,7 @@ class ConvertOrder extends Basic ...@@ -197,7 +287,7 @@ class ConvertOrder extends Basic
} }
//成交报告 //成交报告 产品沟通之前线上没有
private function bargainBin($father_id, $commission_val, $submit_agent_id, $report_id, $order_id, $order_no, $trade_type, $price, $commission) private function bargainBin($father_id, $commission_val, $submit_agent_id, $report_id, $order_id, $order_no, $trade_type, $price, $commission)
{ {
$arr["report_id"] = $report_id; $arr["report_id"] = $report_id;
...@@ -240,29 +330,6 @@ class ConvertOrder extends Basic ...@@ -240,29 +330,6 @@ class ConvertOrder extends Basic
$is_ok = $this->fulModel->addFollowUpLog($params); $is_ok = $this->fulModel->addFollowUpLog($params);
} }
//收款
private function collectingBillBin($father_id, $collecting_arr, $agent_id, $report_id, $order_id, $order_no, $house_number,
$industry_type, $remark, $transfer_img)
{
$arr["report_id"] = $report_id;
$arr["father_id"] = $father_id;
$arr["order_no"] = $order_no;
$arr["order_id"] = $order_id;
$arr["agent_id"] = $agent_id;
$arr["type"] = $collecting_arr["type"];
$arr["pay_type"] = $collecting_arr["pay_type"];
$arr["money"] = $collecting_arr["money"];
$arr["house_number"] = $house_number;
$arr["industry_type"] = $industry_type;
$arr["remark"] = $remark;
$arr["transfer_img"] = $transfer_img;
$arr["create_time"] = date("Y-m-d H:i:s", time());
$arr["update_time"] = date("Y-m-d H:i:s", time());
return $arr;
}
private function marchInBin($reception_id, $report_id, $order_id, $order_no, $march_in_remark, $march_in_img, $march_in_area, $create_time, $update_time) private function marchInBin($reception_id, $report_id, $order_id, $order_no, $march_in_remark, $march_in_img, $march_in_area, $create_time, $update_time)
{ {
......
...@@ -50,6 +50,7 @@ class Basic extends Controller ...@@ -50,6 +50,7 @@ class Basic extends Controller
"api/commentAndDeal", "api/commentAndDeal",
"api/check_code", "api/check_code",
"api/convertOrderByTime", "api/convertOrderByTime",
"api/convertCollectingBill",
); );
/** /**
......
...@@ -7,7 +7,7 @@ use think\helper\Time; ...@@ -7,7 +7,7 @@ use think\helper\Time;
class JournalAccounts extends Model class JournalAccounts extends Model
{ {
// 设置当前模型对应的完整数据表名称 // 设置当前模型对应的完整数据表名称
protected $table = 'Journalaccounts'; protected $table = 'journalaccounts';
protected $db; protected $db;
function __construct() function __construct()
...@@ -108,4 +108,20 @@ class JournalAccounts extends Model ...@@ -108,4 +108,20 @@ class JournalAccounts extends Model
->page($pageNo) ->page($pageNo)
->select(); ->select();
} }
public function getJournalAccountsListByStatus($pageNo = 1, $pageSize = 15, $field)
{
$params["a.transaction_status"] = array("in","2,3");
return $this->db
->field($field)
->alias("a")
->join('o_report b', 'a.apply_id = b.id', 'LEFT')
->join('o_order c', 'b.id = c.f_id', 'LEFT')
->join('agents d', 'a.operaaccount = d.realname', 'LEFT')
->where($params)
->limit($pageSize)
->page($pageNo)
->select();
}
} }
...@@ -279,6 +279,7 @@ Route::group('api', [ ...@@ -279,6 +279,7 @@ Route::group('api', [
'convertOrderByTime' => [ 'api/ConvertOrder/convertOrderByTime', [ 'method' => 'post|get' ] ], 'convertOrderByTime' => [ 'api/ConvertOrder/convertOrderByTime', [ 'method' => 'post|get' ] ],
'convertCollectingBill' => [ 'api/ConvertOrder/convertCollectingBill', [ 'method' => 'post|get' ] ],
'houseTable' => [ 'api/TransferHouseInfo/table', [ 'method' => 'post|get' ] ], //转商铺表 'houseTable' => [ 'api/TransferHouseInfo/table', [ 'method' => 'post|get' ] ], //转商铺表
'houseImgTable' => [ 'api/TransferHouseInfo/houseImg', [ 'method' => 'post|get' ] ], //转楼盘表 'houseImgTable' => [ 'api/TransferHouseInfo/houseImg', [ 'method' => 'post|get' ] ], //转楼盘表
]); ]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment